Use recently implemented new constructor of ErrorLogger::ErrorMessage in checkmemoryleak.cpp and symboldatabase.cpp

Fixed test failure introduced in f105bf75a6
This commit is contained in:
PKEuS 2012-05-06 04:01:56 -07:00
parent 28f6e2f4a9
commit 6ef92c4fd7
3 changed files with 5 additions and 23 deletions

View File

@ -359,19 +359,7 @@ void CheckMemoryLeak::reportErr(const Token *tok, Severity::SeverityType severit
void CheckMemoryLeak::reportErr(const std::list<const Token *> &callstack, Severity::SeverityType severity, const std::string &id, const std::string &msg) const
{
std::list<ErrorLogger::ErrorMessage::FileLocation> locations;
for (std::list<const Token *>::const_iterator it = callstack.begin(); it != callstack.end(); ++it) {
const Token * const tok = *it;
ErrorLogger::ErrorMessage::FileLocation loc;
loc.line = tok->linenr();
loc.setfile(tokenizer->list.file(tok));
locations.push_back(loc);
}
const ErrorLogger::ErrorMessage errmsg(locations, severity, msg, id, false);
const ErrorLogger::ErrorMessage errmsg(callstack, tokenizer?&tokenizer->list:0, severity, id, msg, false);
if (errorLogger)
errorLogger->reportErr(errmsg);

View File

@ -1222,21 +1222,14 @@ const Token *SymbolDatabase::initBaseInfo(Scope *scope, const Token *tok)
void SymbolDatabase::debugMessage(const Token *tok, const std::string &msg) const
{
if (tok && _settings->debugwarnings) {
std::list<ErrorLogger::ErrorMessage::FileLocation> locationList;
ErrorLogger::ErrorMessage::FileLocation loc;
loc.line = tok->linenr();
loc.setfile(_tokenizer->list.file(tok));
locationList.push_back(loc);
const ErrorLogger::ErrorMessage errmsg(locationList,
const std::list<const Token*> locationList(1, tok);
const ErrorLogger::ErrorMessage errmsg(locationList, &_tokenizer->list,
Severity::debug,
msg,
"debug",
false);
if (_errorLogger)
_errorLogger->reportErr(errmsg);
else
Check::reportError(errmsg);
}
}

View File

@ -21,6 +21,7 @@
#include "tokenize.h"
#include "token.h"
#include "settings.h"
#include "path.h"
#include <cstring>
extern std::ostringstream errout;
@ -4108,7 +4109,7 @@ private:
std::istringstream istr(code);
tokenizer.tokenize(istr, "a.cpp");
ASSERT_EQUALS("[c:\\a.h:1]", tokenizer.list.fileLine(tokenizer.tokens()));
ASSERT_EQUALS(Path::toNativeSeparators("[c:\\a.h:1]"), tokenizer.list.fileLine(tokenizer.tokens()));
}