@@ -1303,44 +1303,47 @@ bool SymbolDatabase::isFunction(const Token *tok, const Scope* outerScope, const
13031303 tok1 = tok1->tokAt (-1 );
13041304 }
13051305
1306- // skip over pointers and references
1307- while (Token::Match (tok1, " [*&]" ))
1308- tok1 = tok1->tokAt (-1 );
1309-
1310- // skip over template
1311- if (tok1 && tok1->str () == " >" ) {
1312- if (tok1->link ())
1313- tok1 = tok1->link ()->previous ();
1314- else
1315- return false ;
1316- }
1306+ // done if constructor or destructor
1307+ if (!Token::Match (tok1, " {|}|;|public:|protected:|private:" ) && tok1) {
1308+ // skip over pointers and references
1309+ while (Token::Match (tok1, " [*&]" ))
1310+ tok1 = tok1->tokAt (-1 );
13171311
1318- // function can't have number or variable as return type
1319- if (tok1 && (tok1->isNumber () || tok1->varId ()))
1320- return false ;
1312+ // skip over template
1313+ if (tok1 && tok1->str () == " >" ) {
1314+ if (tok1->link ())
1315+ tok1 = tok1->link ()->previous ();
1316+ else
1317+ return false ;
1318+ }
13211319
1322- // skip over return type
1323- if (Token::Match (tok1, " %name%" )) {
1324- if (tok1->str () == " return" )
1320+ // function can't have number or variable as return type
1321+ if (tok1 && (tok1->isNumber () || tok1->varId ()))
13251322 return false ;
1326- tok1 = tok1->previous ();
1327- }
13281323
1329- // skip over qualification
1330- while (Token::simpleMatch (tok1, " ::" )) {
1331- if (Token::Match (tok1->tokAt (-1 ), " %name%" ))
1332- tok1 = tok1->tokAt (-2 );
1333- else
1334- tok1 = tok1->tokAt (-1 );
1335- }
1324+ // skip over return type
1325+ if (Token::Match (tok1, " %name%" )) {
1326+ if (tok1->str () == " return" )
1327+ return false ;
1328+ tok1 = tok1->previous ();
1329+ }
13361330
1337- // skip over modifiers and other stuff
1338- while (Token::Match (tok1, " const|static|extern|template|virtual|struct|class" ))
1339- tok1 = tok1->previous ();
1331+ // skip over qualification
1332+ while (Token::simpleMatch (tok1, " ::" )) {
1333+ if (Token::Match (tok1->tokAt (-1 ), " %name%" ))
1334+ tok1 = tok1->tokAt (-2 );
1335+ else
1336+ tok1 = tok1->tokAt (-1 );
1337+ }
13401338
1341- // should be at a sequence point if this is a function
1342- if (!Token::Match (tok1, " >|{|}|;|public:|protected:|private:" ) && tok1)
1343- return false ;
1339+ // skip over modifiers and other stuff
1340+ while (Token::Match (tok1, " const|static|extern|template|virtual|struct|class" ))
1341+ tok1 = tok1->previous ();
1342+
1343+ // should be at a sequence point if this is a function
1344+ if (!Token::Match (tok1, " >|{|}|;|public:|protected:|private:" ) && tok1)
1345+ return false ;
1346+ }
13441347
13451348 const Token* tok2 = tok->next ()->link ()->next ();
13461349 if (tok2 &&
0 commit comments