From 64612bf93e646a6bec719d03e1f3730768c96ffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 9 Jan 2020 13:40:38 +0100 Subject: [PATCH] Clang import; robustness --- lib/clangastdump.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/clangastdump.cpp b/lib/clangastdump.cpp index 32ac26264..2d8c5eb9a 100644 --- a/lib/clangastdump.cpp +++ b/lib/clangastdump.cpp @@ -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 = ""; Token *member = addtoken(tokenList, memberName); mData->ref(mExtTokens.back(), member); dot->astOperand1(s);