Skip to content

Commit

Permalink
Additional call to setValueTypeInTokenList()
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Aug 7, 2023
1 parent de8b415 commit 43893ce
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3346,8 +3346,10 @@ bool Tokenizer::simplifyTokens1(const std::string &configuration)

if (mTimerResults) {
Timer t("Tokenizer::simplifyTokens1::setValueType", mSettings->showtime, mTimerResults);
mSymbolDatabase->setValueTypeInTokenList(false);
mSymbolDatabase->setValueTypeInTokenList(true);
} else {
mSymbolDatabase->setValueTypeInTokenList(false);
mSymbolDatabase->setValueTypeInTokenList(true);
}

Expand Down
17 changes: 17 additions & 0 deletions test/testsymboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ class TestSymbolDatabase : public TestFixture {
TEST_CASE(auto17); // #11163
TEST_CASE(auto18);
TEST_CASE(auto19);
TEST_CASE(auto20);

TEST_CASE(unionWithConstructor);

Expand Down Expand Up @@ -9419,6 +9420,22 @@ class TestSymbolDatabase : public TestFixture {
}
}

void auto20() {
GET_SYMBOL_DB("enum A { A0 };\n"
"enum B { B0 };\n"
"const int& g(A a);\n"
"const int& g(B b);\n"
"void f() {\n"
" const auto& r = g(B::B0);\n"
"}\n");
const Token* a = Token::findsimplematch(tokenizer.tokens(), "auto");
ASSERT(a && a->valueType());
ASSERT_EQUALS(a->valueType()->type, ValueType::INT);
const Token* g = Token::findsimplematch(a, "g ( B ::");
ASSERT(g && g->function());
ASSERT_EQUALS(g->function()->tokenDef->linenr(), 4);
}

void unionWithConstructor() {
GET_SYMBOL_DB("union Fred {\n"
" Fred(int x) : i(x) { }\n"
Expand Down

0 comments on commit 43893ce

Please sign in to comment.