This commit is contained in:
parent
87886576fc
commit
8c63c8ced1
|
@ -1454,8 +1454,11 @@ static Token * createAstAtToken(Token *tok, bool cpp)
|
|||
return tok2;
|
||||
}
|
||||
if (Token::Match(tok, "%type%") && !Token::Match(tok, "return|throw|if|while|new|delete")) {
|
||||
bool isStandardTypeOrQualifier = false;
|
||||
Token* type = tok;
|
||||
while (Token::Match(type, "%type%|*|&|<")) {
|
||||
if (type->isName() && (type->isStandardType() || Token::Match(type, "const|mutable|static|volatile")))
|
||||
isStandardTypeOrQualifier = true;
|
||||
if (type->str() == "<") {
|
||||
if (type->link())
|
||||
type = type->link();
|
||||
|
@ -1464,6 +1467,8 @@ static Token * createAstAtToken(Token *tok, bool cpp)
|
|||
}
|
||||
type = type->next();
|
||||
}
|
||||
if (isStandardTypeOrQualifier && Token::Match(type, "%var% [;,)]"))
|
||||
return type;
|
||||
if (Token::Match(type, "( * *| %var%") &&
|
||||
Token::Match(type->link()->previous(), "%var%|] ) (") &&
|
||||
Token::Match(type->link()->linkAt(1), ") [;,)]"))
|
||||
|
|
|
@ -6483,6 +6483,7 @@ private:
|
|||
|
||||
ASSERT_EQUALS("", testAst("void f(enum E* var){}"));
|
||||
ASSERT_EQUALS("", testAst("void f(enum E*& var){}"));
|
||||
ASSERT_EQUALS("", testAst("void f(bool& var){}"));
|
||||
}
|
||||
|
||||
void astunaryop() const { // unary operators
|
||||
|
|
Loading…
Reference in New Issue