Clang import: Fix Variable::mTypeStartToken for const argument

This commit is contained in:
Daniel Marjamäki 2020-10-31 17:43:36 +01:00
parent 5b156d20bd
commit 597a6eb99c
2 changed files with 5 additions and 0 deletions

View File

@ -1837,6 +1837,8 @@ Variable::Variable(const Token *name_, const std::string &clangType, const Token
mTypeStartToken = mTypeEndToken;
while (Token::Match(mTypeStartToken->previous(), "%type%|*|&"))
mTypeStartToken = mTypeStartToken->previous();
if (mTypeStartToken->str() == "const")
mTypeStartToken = mTypeStartToken->next();
}
if (Token::simpleMatch(mTypeStartToken, "static"))
setFlag(fIsStatic, true);

View File

@ -91,6 +91,9 @@ def test_symbol_database_2():
def test_symbol_database_3():
check_symbol_database('struct Fred { int a; }; int b; void f(int c, int d) { int e; }')
def test_symbol_database_4():
check_symbol_database('void f(const int x) {}')
def test_ast_calculations():
check_ast('int x = 5; int y = (x + 4) * 2;')
check_ast('long long dostuff(int x) { return x ? 3 : 5; }')