parent
63e00ea918
commit
099d96ffa1
|
@ -8911,8 +8911,12 @@ Token* Tokenizer::getAttributeFuncTok(Token* tok, bool gccattr) const {
|
|||
Token *prev = tok->previous();
|
||||
while (Token::Match(prev, "%name%"))
|
||||
prev = prev->previous();
|
||||
if (Token::simpleMatch(prev, ")") && Token::Match(prev->link()->previous(), "%name% ("))
|
||||
return prev->link()->previous();
|
||||
if (Token::simpleMatch(prev, ")")) {
|
||||
if (Token::Match(prev->link()->previous(), "%name% ("))
|
||||
return prev->link()->previous();
|
||||
if (Token::Match(prev->link()->tokAt(-2), "%name% ) ("))
|
||||
return prev->link()->tokAt(-2);
|
||||
}
|
||||
if (Token::simpleMatch(prev, ")") && Token::Match(prev->link()->tokAt(-2), "operator %op% (") && isCPP())
|
||||
return prev->link()->tokAt(-2);
|
||||
if ((!prev || Token::Match(prev, "[;{}*]")) && Token::Match(tok->previous(), "%name%"))
|
||||
|
|
|
@ -1317,6 +1317,7 @@ private:
|
|||
ASSERT_EQUALS("blah :: blah f ( ) ;", tok("__attribute__ ((visibility(\"default\"))) blah::blah f();"));
|
||||
ASSERT_EQUALS("template < T > Result < T > f ( ) ;", tok("template<T> __attribute__ ((warn_unused_result)) Result<T> f();"));
|
||||
ASSERT_EQUALS("template < T , U > Result < T , U > f ( ) ;", tok("template<T, U> __attribute__ ((warn_unused_result)) Result<T, U> f();"));
|
||||
ASSERT_EQUALS("void ( * fp ) ( ) ; fp = nullptr ;", tok("typedef void (*fp_t)() __attribute__((noreturn)); fp_t fp = nullptr;")); // #12137
|
||||
}
|
||||
|
||||
void simplifyFunctorCall() {
|
||||
|
|
Loading…
Reference in New Issue