diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index dc2e3c610..652c062e7 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -1239,7 +1239,6 @@ void SymbolDatabase::createSymbolDatabaseSetVariablePointers() const Variable *membervar = var->typeScope()->getVariable(membertok->str()); if (membervar) { membertok->variable(membervar); - const_cast(membertok)->varId(membervar->nameToken()->varId()); } } else if (var && tok->valueType() && tok->valueType()->type == ValueType::CONTAINER) { if (Token::Match(var->typeStartToken(), "std :: %type% < %type% *| *| >")) { @@ -1248,7 +1247,6 @@ void SymbolDatabase::createSymbolDatabaseSetVariablePointers() const Variable *membervar = type->classScope->getVariable(membertok->str()); if (membervar) { membertok->variable(membervar); - const_cast(membertok)->varId(membervar->nameToken()->varId()); } } } diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index cf3212bc4..d2f55e3f7 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -817,7 +817,7 @@ private: tok = tok ? tok->next() : nullptr; ASSERT(db != nullptr); ASSERT(tok && tok->variable() && Token::simpleMatch(tok->variable()->typeStartToken(), "int x ;")); - ASSERT(tok && tok->varId() == 1U); // It's possible to set a varId + ASSERT(tok && tok->varId() == 0U); // It's possible to set a varId } void arrayMemberVar2() { @@ -833,7 +833,7 @@ private: tok = tok ? tok->next() : nullptr; ASSERT(db != nullptr); ASSERT(tok && tok->variable() && Token::simpleMatch(tok->variable()->typeStartToken(), "int x ;")); - ASSERT(tok && tok->varId() == 1U); // It's possible to set a varId + ASSERT(tok && tok->varId() == 0U); // It's possible to set a varId } void arrayMemberVar3() { @@ -849,7 +849,7 @@ private: tok = tok ? tok->next() : nullptr; ASSERT(db != nullptr); ASSERT(tok && tok->variable() && Token::simpleMatch(tok->variable()->typeStartToken(), "int x ;")); - ASSERT(tok && tok->varId() == 1U); // It's possible to set a varId + ASSERT(tok && tok->varId() == 0U); // It's possible to set a varId } void staticMemberVar() { @@ -4588,10 +4588,10 @@ private: vartok = Token::findsimplematch(tokenizer.tokens(), "return"); vartok = Token::findsimplematch(vartok, "i"); - ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); + TODO_ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); vartok = Token::findsimplematch(vartok->next(), "i"); - ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); + TODO_ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); vartok = Token::findsimplematch(vartok->next(), "i"); ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); @@ -4709,31 +4709,31 @@ private: ASSERT(db && vartok && vartok->variable() && !vartok->variable()->isPointer() && !vartok->variable()->isReference() && vartok->variable()->type() && vartok->variable()->type()->name() == "S"); vartok = Token::findsimplematch(vartok, "i"); - ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); + TODO_ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); vartok = Token::findsimplematch(vartok->next(), "b . i"); ASSERT(db && vartok && vartok->variable() && !vartok->variable()->isPointer() && vartok->variable()->isReference() && vartok->variable()->type() && vartok->variable()->type()->name() == "S"); vartok = Token::findsimplematch(vartok->next(), "i"); - ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); + TODO_ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); vartok = Token::findsimplematch(vartok->next(), "c . i"); ASSERT(db && vartok && vartok->variable() && !vartok->variable()->isPointer() && vartok->variable()->isReference() && vartok->variable()->type() && vartok->variable()->type()->name() == "S"); vartok = Token::findsimplematch(vartok->next(), "i"); - ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); + TODO_ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); vartok = Token::findsimplematch(vartok->next(), "d . i"); ASSERT(db && vartok && vartok->variable() && vartok->variable()->isPointer() && !vartok->variable()->isReference() && vartok->variable()->type() && vartok->variable()->type()->name() == "S"); vartok = Token::findsimplematch(vartok->next(), "i"); - ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); + TODO_ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); vartok = Token::findsimplematch(vartok->next(), "e . i"); ASSERT(db && vartok && vartok->variable() && vartok->variable()->isPointer() && !vartok->variable()->isReference() && vartok->variable()->type() && vartok->variable()->type()->name() == "S"); vartok = Token::findsimplematch(vartok->next(), "i"); - ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); + TODO_ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); vartok = Token::findsimplematch(vartok->next(), "i"); ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); @@ -4801,31 +4801,31 @@ private: ASSERT(db && vartok && vartok->variable() && !vartok->variable()->isPointer() && !vartok->variable()->isReference() && vartok->variable()->type() && vartok->variable()->type()->name() == "S"); vartok = Token::findsimplematch(vartok, "i"); - ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); + TODO_ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); vartok = Token::findsimplematch(vartok->next(), "b . i"); ASSERT(db && vartok && vartok->variable() && !vartok->variable()->isPointer() && vartok->variable()->isReference() && vartok->variable()->type() && vartok->variable()->type()->name() == "S"); vartok = Token::findsimplematch(vartok->next(), "i"); - ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); + TODO_ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); vartok = Token::findsimplematch(vartok->next(), "c . i"); ASSERT(db && vartok && vartok->variable() && !vartok->variable()->isPointer() && vartok->variable()->isReference() && vartok->variable()->type() && vartok->variable()->type()->name() == "S"); vartok = Token::findsimplematch(vartok->next(), "i"); - ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); + TODO_ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); vartok = Token::findsimplematch(vartok->next(), "d . i"); ASSERT(db && vartok && vartok->variable() && vartok->variable()->isPointer() && !vartok->variable()->isReference() && vartok->variable()->type() && vartok->variable()->type()->name() == "S"); vartok = Token::findsimplematch(vartok->next(), "i"); - ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); + TODO_ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); vartok = Token::findsimplematch(vartok->next(), "e . i"); ASSERT(db && vartok && vartok->variable() && vartok->variable()->isPointer() && !vartok->variable()->isReference() && vartok->variable()->type() && vartok->variable()->type()->name() == "S"); vartok = Token::findsimplematch(vartok->next(), "i"); - ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); + TODO_ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); vartok = Token::findsimplematch(vartok->next(), "i"); ASSERT(db && vartok && vartok->variable() && vartok->variable()->typeStartToken()->str() == "int"); diff --git a/test/testvarid.cpp b/test/testvarid.cpp index b59ac326a..bfc000227 100644 --- a/test/testvarid.cpp +++ b/test/testvarid.cpp @@ -1344,7 +1344,7 @@ private: "10:\n" "11: void Bar :: f ( )\n" "12: {\n" - "13: foo@2 . x@1 = x@3 ;\n" + "13: foo@2 . x@4 = x@3 ;\n" "14: }\n"; ASSERT_EQUALS(expected, actual); }