Clang import; robustness

This commit is contained in:
Daniel Marjamäki 2020-01-09 13:40:38 +01:00
parent 060c695f80
commit 64612bf93e
1 changed files with 4 additions and 2 deletions

View File

@ -488,9 +488,11 @@ Token *clangastdump::AstNode::createTokens(TokenList *tokenList)
if (memberName.compare(0, 2, "->") == 0) { if (memberName.compare(0, 2, "->") == 0) {
dot->originalName("->"); dot->originalName("->");
memberName = memberName.substr(2); memberName = memberName.substr(2);
} else { } else if (memberName.compare(0, 1, ".") == 0) {
memberName = memberName.substr(1); memberName = memberName.substr(1);
} }
if (memberName.empty())
memberName = "<unknown>";
Token *member = addtoken(tokenList, memberName); Token *member = addtoken(tokenList, memberName);
mData->ref(mExtTokens.back(), member); mData->ref(mExtTokens.back(), member);
dot->astOperand1(s); dot->astOperand1(s);