parent
3774d46303
commit
e928f2b5aa
|
@ -1522,6 +1522,13 @@ void SymbolDatabase::createSymbolDatabaseIncompleteVars()
|
|||
}
|
||||
if (mSettings.library.functions.find(fstr) != mSettings.library.functions.end())
|
||||
continue;
|
||||
if (mTokenizer.isCPP()) {
|
||||
const Token* parent = tok->astParent();
|
||||
while (Token::Match(parent, "::|[|{"))
|
||||
parent = parent->astParent();
|
||||
if (Token::simpleMatch(parent, "new"))
|
||||
continue;
|
||||
}
|
||||
const_cast<Token *>(tok)->isIncompleteVar(true); // TODO: avoid const_cast
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5494,6 +5494,23 @@ private:
|
|||
const Token* u = Token::findsimplematch(s, "uint64_t");
|
||||
ASSERT(u && !u->isIncompleteVar());
|
||||
}
|
||||
{
|
||||
GET_SYMBOL_DB("void f() {\n"
|
||||
" std::string* p = new std::string;\n"
|
||||
" std::string* q = new std::string(\"abc\");\n"
|
||||
" std::string* r = new std::string{ \"def\" };\n"
|
||||
" std::string* s = new std::string[3]{ \"ghi\" };\n"
|
||||
"}\n");
|
||||
ASSERT(db && errout.str().empty());
|
||||
const Token* s1 = Token::findsimplematch(tokenizer.tokens(), "string ;");
|
||||
ASSERT(s1 && !s1->isIncompleteVar());
|
||||
const Token* s2 = Token::findsimplematch(s1->next(), "string (");
|
||||
ASSERT(s2 && !s2->isIncompleteVar());
|
||||
const Token* s3 = Token::findsimplematch(s2->next(), "string {");
|
||||
ASSERT(s3 && !s3->isIncompleteVar());
|
||||
const Token* s4 = Token::findsimplematch(s3->next(), "string [");
|
||||
ASSERT(s4 && !s4->isIncompleteVar());
|
||||
}
|
||||
}
|
||||
|
||||
void enum1() {
|
||||
|
|
Loading…
Reference in New Issue