Skip to content

Commit

Permalink
Fix #12583 debug: valueFlowBailoutIncompleteVar reported for "using n…
Browse files Browse the repository at this point in the history
…amespace" declaration
  • Loading branch information
chrchr-github committed Jul 16, 2024
1 parent 9eba96e commit 420cc1c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1460,10 +1460,16 @@ void SymbolDatabase::createSymbolDatabaseIncompleteVars()
tok = tok->link();
continue;
}
if (tok->isCpp() && (Token::Match(tok, "catch|typeid (") ||
Token::Match(tok, "static_cast|dynamic_cast|const_cast|reinterpret_cast"))) {
tok = tok->linkAt(1);
continue;
if (tok->isCpp()) {
if (Token::Match(tok, "catch|typeid (") ||
Token::Match(tok, "static_cast|dynamic_cast|const_cast|reinterpret_cast")) {
tok = tok->linkAt(1);
continue;
}
if (tok->str() == "using") {
tok = Token::findsimplematch(tok, ";");
continue;
}
}
if (tok->str() == "NULL")
continue;
Expand Down
8 changes: 8 additions & 0 deletions test/testsymboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5894,6 +5894,14 @@ class TestSymbolDatabase : public TestFixture {
const Token* s = Token::findsimplematch(tokenizer.tokens(), "string");
ASSERT(s && !s->isIncompleteVar());
}
{
GET_SYMBOL_DB("void f() {\n" // #12583
" using namespace N;\n"
"}\n");
ASSERT(db && errout_str().empty());
const Token* N = Token::findsimplematch(tokenizer.tokens(), "N");
ASSERT(N && !N->isIncompleteVar());
}
}

void enum1() {
Expand Down

0 comments on commit 420cc1c

Please sign in to comment.