File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4113,6 +4113,12 @@ static const Token* skipPointers(const Token* tok)
41134113 tok = tok->tokAt (2 );
41144114 }
41154115
4116+ if (Token::simpleMatch (tok, " ( *" ) && Token::simpleMatch (tok->link ()->previous (), " ] ) ;" )) {
4117+ const Token *tok2 = skipPointers (tok->next ());
4118+ if (Token::Match (tok2, " %name% [" ) && Token::simpleMatch (tok2->linkAt (1 ), " ] ) ;" ))
4119+ return tok2;
4120+ }
4121+
41164122 return tok;
41174123}
41184124
Original file line number Diff line number Diff line change @@ -324,6 +324,7 @@ class TestSymbolDatabase: public TestFixture {
324324 TEST_CASE (symboldatabase84);
325325 TEST_CASE (symboldatabase85);
326326 TEST_CASE (symboldatabase86);
327+ TEST_CASE (symboldatabase87); // #9922 'extern const char ( * x [ 256 ] ) ;'
327328
328329 TEST_CASE (createSymbolDatabaseFindAllScopes1);
329330
@@ -4739,6 +4740,12 @@ class TestSymbolDatabase: public TestFixture {
47394740 ASSERT (db->scopeList .back ().functionList .front ().hasBody () == false );
47404741 }
47414742
4743+ void symboldatabase87 () { // #9922 'extern const char ( * x [ 256 ] ) ;'
4744+ GET_SYMBOL_DB (" extern const char ( * x [ 256 ] ) ;" );
4745+ const Token *xtok = Token::findsimplematch (tokenizer.tokens (), " x" );
4746+ ASSERT (xtok->variable ());
4747+ }
4748+
47424749 void createSymbolDatabaseFindAllScopes1 () {
47434750 GET_SYMBOL_DB (" void f() { union {int x; char *p;} a={0}; }" );
47444751 ASSERT (db->scopeList .size () == 3 );
You can’t perform that action at this time.
0 commit comments