parent
aa281501c9
commit
cbbf500cd4
|
@ -1482,7 +1482,7 @@ void SymbolDatabase::createSymbolDatabaseIncompleteVars()
|
|||
continue;
|
||||
if (tok->type())
|
||||
continue;
|
||||
if (Token::Match(tok->next(), "::|.|(|:|%var%"))
|
||||
if (Token::Match(tok->next(), "::|.|(|{|:|%var%"))
|
||||
continue;
|
||||
if (Token::Match(tok->next(), "&|&&|* )|,|%var%"))
|
||||
continue;
|
||||
|
|
|
@ -373,6 +373,8 @@ private:
|
|||
TEST_CASE(createSymbolDatabaseFindAllScopes5);
|
||||
TEST_CASE(createSymbolDatabaseFindAllScopes6);
|
||||
|
||||
TEST_CASE(createSymbolDatabaseIncompleteVars);
|
||||
|
||||
TEST_CASE(enum1);
|
||||
TEST_CASE(enum2);
|
||||
TEST_CASE(enum3);
|
||||
|
@ -5426,6 +5428,19 @@ private:
|
|||
ASSERT_EQUALS(classNC.derivedFrom[1].type, &classNB);
|
||||
}
|
||||
|
||||
void createSymbolDatabaseIncompleteVars()
|
||||
{
|
||||
GET_SYMBOL_DB("void f() {\n"
|
||||
" auto s1 = std::string{ \"abc\" };\n"
|
||||
" auto s2 = std::string(\"def\");\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, "string (");
|
||||
ASSERT(s2 && !s2->isIncompleteVar());
|
||||
}
|
||||
|
||||
void enum1() {
|
||||
GET_SYMBOL_DB("enum BOOL { FALSE, TRUE }; enum BOOL b;");
|
||||
|
||||
|
|
Loading…
Reference in New Issue