Fixed #3804 (False positive: Member not initialized (simplifyTokenList removes const on pointers))
This commit is contained in:
parent
20005fdad1
commit
a96ec0ad46
|
@ -3229,11 +3229,6 @@ bool Tokenizer::simplifyTokenList()
|
||||||
delete _symbolDatabase;
|
delete _symbolDatabase;
|
||||||
_symbolDatabase = NULL;
|
_symbolDatabase = NULL;
|
||||||
|
|
||||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
|
||||||
if (Token::simpleMatch(tok, "* const"))
|
|
||||||
tok->deleteNext();
|
|
||||||
}
|
|
||||||
|
|
||||||
// simplify references
|
// simplify references
|
||||||
simplifyReference();
|
simplifyReference();
|
||||||
|
|
||||||
|
@ -3435,6 +3430,13 @@ bool Tokenizer::simplifyTokenList()
|
||||||
|
|
||||||
list.front()->assignProgressValues();
|
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) {
|
if (_settings->debug) {
|
||||||
list.front()->printOut(0, list.getFiles());
|
list.front()->printOut(0, list.getFiles());
|
||||||
|
|
||||||
|
|
|
@ -2387,7 +2387,7 @@ private:
|
||||||
" A* const a;\n"
|
" A* const a;\n"
|
||||||
" B& operator=(const B& r) { }\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"
|
check("struct B {\n"
|
||||||
" const int a;\n"
|
" const int a;\n"
|
||||||
|
|
Loading…
Reference in New Issue