Skip to content

Commit

Permalink
Fix valueFlowBailoutIncompleteVar with ptr to ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Sep 27, 2023
1 parent e38e097 commit fa62770
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,7 @@ void SymbolDatabase::createSymbolDatabaseIncompleteVars()
continue;
if (Token::Match(tok->next(), "::|.|(|{|:|%var%"))
continue;
if (Token::Match(tok->next(), "&|&&|* )|,|%var%|const"))
if (Token::Match(tok->next(), "&|&&|* *| *| )|,|%var%|const"))
continue;
// Very likely a typelist
if (Token::Match(tok->tokAt(-2), "%type% ,") || Token::Match(tok->next(), ", %type%"))
Expand Down
14 changes: 14 additions & 0 deletions test/testsymboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5494,6 +5494,20 @@ class TestSymbolDatabase : public TestFixture {
const Token* u = Token::findsimplematch(s, "uint64_t");
ASSERT(u && !u->isIncompleteVar());
}
{
GET_SYMBOL_DB("void f() {\n"
" T** p;\n"
" T*** q;\n"
" T** const * r;\n"
"}\n");
ASSERT(db && errout.str().empty());
const Token* p = Token::findsimplematch(tokenizer.tokens(), "p");
ASSERT(p && !p->isIncompleteVar());
const Token* q = Token::findsimplematch(p, "q");
ASSERT(q && !q->isIncompleteVar());
const Token* r = Token::findsimplematch(q, "r");
ASSERT(r && !r->isIncompleteVar());
}
}

void enum1() {
Expand Down

0 comments on commit fa62770

Please sign in to comment.