Clang import; Set Variable::typeStartToken and Variable::typeEndToken

This commit is contained in:
Daniel Marjamäki 2020-04-13 10:45:31 +02:00
parent c99867421d
commit adb3588b24
2 changed files with 7 additions and 2 deletions

View File

@ -1175,6 +1175,11 @@ Token * clangimport::AstNode::createTokensVarDecl(TokenList *tokenList)
const std::string type = mExtTokens[typeIndex];
const std::string name = mExtTokens[typeIndex - 1];
addTypeTokens(tokenList, type);
if (!startToken && tokenList->back()) {
startToken = tokenList->back();
while (Token::Match(startToken->previous(), "%type%|*|&|&&"))
startToken = startToken->previous();
}
Token *vartok1 = addtoken(tokenList, name);
Scope *scope = const_cast<Scope *>(tokenList->back()->scope());
const AccessControl accessControl = (scope->type == Scope::ScopeType::eGlobal) ? (AccessControl::Global) : (AccessControl::Local);

View File

@ -1787,8 +1787,8 @@ Variable::Variable(const Token *name_, const std::string &clangType, const Token
nonneg int index_, AccessControl access_, const Type *type_,
const Scope *scope_)
: mNameToken(name_),
mTypeStartToken(nullptr),
mTypeEndToken(nullptr),
mTypeStartToken(start),
mTypeEndToken(name_ ? name_->previous() : nullptr),
mIndex(index_),
mAccess(access_),
mFlags(0),