Symbol database: Fixed the error reporting so errors are shown in the gui. Ticket: #1895

This commit is contained in:
Robert Reif 2010-08-17 17:20:54 +02:00 committed by Daniel Marjamäki
parent 64cdee62ef
commit 86f1718b1c
2 changed files with 3 additions and 15 deletions

View File

@ -63,7 +63,7 @@ void CheckClass::createSymbolDatabase()
if (Token::Match(tok, "class|struct|namespace %var% [{:]"))
{
SpaceInfo *new_info = new SpaceInfo;
new_info->tokenizer = _tokenizer;
new_info->check = this;
new_info->isNamespace = tok->str() == "namespace";
new_info->className = tok->next()->str();
new_info->classDef = tok;
@ -578,22 +578,10 @@ void CheckClass::SpaceInfo::getVarList()
// If the vartok was set in the if-blocks above, create a entry for this variable..
if (vartok && vartok->str() != "operator")
{
#ifndef NDEBUG
if (vartok->varId() == 0)
{
std::list<ErrorLogger::ErrorMessage::FileLocation> locationList;
ErrorLogger::ErrorMessage::FileLocation loc;
loc.line = vartok->linenr();
loc.setfile(tokenizer->file(vartok));
locationList.push_back(loc);
const ErrorLogger::ErrorMessage errmsg(locationList,
Severity::error,
"Internal error. CheckClass::SpaceInfo::getVarList found variable with varid 0.",
"cppcheckError");
Check::reportError(errmsg);
check->reportError(vartok, Severity::error, "cppcheckError", "Internal error. CheckClass::SpaceInfo::getVarList found variable \'" + vartok->str() + "\' with varid 0.");
}
#endif
varlist.push_back(Var(vartok, false, priv, isMutable, isStatic, isClass));
}

View File

@ -214,7 +214,7 @@ private:
struct SpaceInfo
{
const Tokenizer *tokenizer;
CheckClass *check;
bool isNamespace;
std::string className;
const Token *classDef; // class/struct/namespace token