Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
1 change: 0 additions & 1 deletion test/cfg/std.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4788,7 +4788,6 @@ void stdbind_helper(int a)

void stdbind()
{
// cppcheck-suppress valueFlowBailoutIncompleteVar
using namespace std::placeholders;

// TODO cppcheck-suppress ignoredReturnValue #9369
Expand Down
4 changes: 1 addition & 3 deletions test/testsimplifyusing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,9 +856,7 @@ class TestSimplifyUsing : public TestFixture {
"}";

ASSERT_EQUALS(exp, tok(code));
ASSERT_EQUALS("[test.cpp:7]: (debug) valueFlowConditionExpressions bailout: Skipping function due to incomplete variable NS1\n"
"[test.cpp:11]: (debug) valueFlowConditionExpressions bailout: Skipping function due to incomplete variable NS2\n",
errout_str());
ASSERT_EQUALS("", errout_str());
}

void simplifyUsing9381() {
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