Fixed #3804 (False positive: Member not initialized (simplifyTokenList removes const on pointers))

This commit is contained in:
Daniel Marjamäki 2012-07-16 07:28:59 +02:00
parent 20005fdad1
commit a96ec0ad46
2 changed files with 8 additions and 6 deletions

View File

@ -3229,11 +3229,6 @@ bool Tokenizer::simplifyTokenList()
delete _symbolDatabase;
_symbolDatabase = NULL;
for (Token *tok = list.front(); tok; tok = tok->next()) {
if (Token::simpleMatch(tok, "* const"))
tok->deleteNext();
}
// simplify references
simplifyReference();
@ -3435,6 +3430,13 @@ bool Tokenizer::simplifyTokenList()
list.front()->assignProgressValues();
// Create symbol database and then remove const keywords
getSymbolDatabase();
for (Token *tok = list.front(); tok; tok = tok->next()) {
if (Token::simpleMatch(tok, "* const"))
tok->deleteNext();
}
if (_settings->debug) {
list.front()->printOut(0, list.getFiles());

View File

@ -2387,7 +2387,7 @@ private:
" A* const a;\n"
" B& operator=(const B& r) { }\n"
"};");
TODO_ASSERT_EQUALS("", "[test.cpp:4]: (warning) Member variable 'B::a' is not assigned a value in 'B::operator='.\n", errout.str()); // #3804
ASSERT_EQUALS("", errout.str()); // #3804
check("struct B {\n"
" const int a;\n"