Clang import: Fix Variable::mTypeStartToken for const argument
This commit is contained in:
parent
5b156d20bd
commit
597a6eb99c
|
@ -1837,6 +1837,8 @@ Variable::Variable(const Token *name_, const std::string &clangType, const Token
|
||||||
mTypeStartToken = mTypeEndToken;
|
mTypeStartToken = mTypeEndToken;
|
||||||
while (Token::Match(mTypeStartToken->previous(), "%type%|*|&"))
|
while (Token::Match(mTypeStartToken->previous(), "%type%|*|&"))
|
||||||
mTypeStartToken = mTypeStartToken->previous();
|
mTypeStartToken = mTypeStartToken->previous();
|
||||||
|
if (mTypeStartToken->str() == "const")
|
||||||
|
mTypeStartToken = mTypeStartToken->next();
|
||||||
}
|
}
|
||||||
if (Token::simpleMatch(mTypeStartToken, "static"))
|
if (Token::simpleMatch(mTypeStartToken, "static"))
|
||||||
setFlag(fIsStatic, true);
|
setFlag(fIsStatic, true);
|
||||||
|
|
|
@ -91,6 +91,9 @@ def test_symbol_database_2():
|
||||||
def test_symbol_database_3():
|
def test_symbol_database_3():
|
||||||
check_symbol_database('struct Fred { int a; }; int b; void f(int c, int d) { int e; }')
|
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():
|
def test_ast_calculations():
|
||||||
check_ast('int x = 5; int y = (x + 4) * 2;')
|
check_ast('int x = 5; int y = (x + 4) * 2;')
|
||||||
check_ast('long long dostuff(int x) { return x ? 3 : 5; }')
|
check_ast('long long dostuff(int x) { return x ? 3 : 5; }')
|
||||||
|
|
Loading…
Reference in New Issue