Fixed #5468 (crash: freebsd: llvm/RegionPrinter.cpp - AST failure)
This commit is contained in:
parent
d37359217c
commit
c050a92bae
|
@ -758,6 +758,9 @@ static Token * createAstAtToken(Token *tok)
|
|||
if (Token::simpleMatch(tok, "( {"))
|
||||
return tok;
|
||||
|
||||
if (Token::Match(tok, "%type% <") && Token::Match(tok->linkAt(1), "> !!("))
|
||||
return tok->linkAt(1);
|
||||
|
||||
if (tok->str() == "return" || !tok->previous() || Token::Match(tok, "%var% %op%|(|[|.|=|::") || Token::Match(tok->previous(), "[;{}] %cop%|( !!{")) {
|
||||
std::stack<Token *> operands;
|
||||
Token * const tok1 = tok;
|
||||
|
|
|
@ -10077,6 +10077,8 @@ private:
|
|||
links.pop();
|
||||
} else if (Token::Match(tok, "< %type% >")) {
|
||||
Token::createMutualLinks(tok, tok->tokAt(2));
|
||||
} else if (Token::Match(tok, "< %type% * >")) {
|
||||
Token::createMutualLinks(tok, tok->tokAt(3));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10194,13 +10196,14 @@ private:
|
|||
testAst("extern int for_each_commit_graft(int (*)(int*), void *);"); // don't crash
|
||||
testAst("for (;;) {}"); // don't crash
|
||||
ASSERT_EQUALS("xsizeofvoid(=", testAst("x=sizeof(void*)"));
|
||||
|
||||
ASSERT_EQUALS("publica::b::", testAst("class C : public ::a::b<bool> { };"));
|
||||
}
|
||||
|
||||
void asttemplate() const { // uninstantiated templates will have <,>,etc..
|
||||
ASSERT_EQUALS("a(3==", testAst("a<int>()==3"));
|
||||
ASSERT_EQUALS("ab(== f(", testAst("a == b<c>(); f();"));
|
||||
|
||||
ASSERT_EQUALS("publica::b::", testAst("class C : public ::a::b<bool> { };"));
|
||||
ASSERT_EQUALS("f( abc+=", testAst("struct A : public B<C*> { void f() { a=b+c; } };"));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue