Token::typeDecl: Fix endless recursion for code:
void f() { auto val = val; } I did not manage to pinpoint a good location to put a unit test. However this will be tested when daca@home runs the package gcc-avr.
This commit is contained in:
parent
1cd9d0479d
commit
f31fbba54a
|
@ -2335,7 +2335,7 @@ std::pair<const Token*, const Token*> Token::typeDecl(const Token * tok)
|
||||||
const Token * tok2 = var->declEndToken();
|
const Token * tok2 = var->declEndToken();
|
||||||
if (Token::Match(tok2, "; %varid% =", var->declarationId()))
|
if (Token::Match(tok2, "; %varid% =", var->declarationId()))
|
||||||
tok2 = tok2->tokAt(2);
|
tok2 = tok2->tokAt(2);
|
||||||
if (Token::simpleMatch(tok2, "=") && Token::Match(tok2->astOperand2(), "!!=")) {
|
if (Token::simpleMatch(tok2, "=") && Token::Match(tok2->astOperand2(), "!!=") && tok != tok2->astOperand2()) {
|
||||||
std::pair<const Token*, const Token*> r = typeDecl(tok2->astOperand2());
|
std::pair<const Token*, const Token*> r = typeDecl(tok2->astOperand2());
|
||||||
if (r.first)
|
if (r.first)
|
||||||
return r;
|
return r;
|
||||||
|
|
Loading…
Reference in New Issue