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

@ -485,12 +485,14 @@ Token *clangastdump::AstNode::createTokens(TokenList *tokenList)
Token *s = children[0]->createTokens(tokenList);
Token *dot = addtoken(tokenList, ".");
std::string memberName = getSpelling();
if (memberName.compare(0,2,"->") == 0) {
if (memberName.compare(0, 2, "->") == 0) {
dot->originalName("->");
memberName = memberName.substr(2);
} else {
} else if (memberName.compare(0, 1, ".") == 0) {
memberName = memberName.substr(1);
}
if (memberName.empty())
memberName = "<unknown>";
Token *member = addtoken(tokenList, memberName);
mData->ref(mExtTokens.back(), member);
dot->astOperand1(s);