From 6ef92c4fd797f45ae2e43ead00a63f14c84589ac Mon Sep 17 00:00:00 2001 From: PKEuS Date: Sun, 6 May 2012 04:01:56 -0700 Subject: [PATCH] Use recently implemented new constructor of ErrorLogger::ErrorMessage in checkmemoryleak.cpp and symboldatabase.cpp Fixed test failure introduced in f105bf75a6f19230b442e9d096dbb724ded79f32 --- lib/checkmemoryleak.cpp | 14 +------------- lib/symboldatabase.cpp | 11 ++--------- test/testtokenize.cpp | 3 ++- 3 files changed, 5 insertions(+), 23 deletions(-) diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index d597250b2..41809c62e 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -359,19 +359,7 @@ void CheckMemoryLeak::reportErr(const Token *tok, Severity::SeverityType severit void CheckMemoryLeak::reportErr(const std::list &callstack, Severity::SeverityType severity, const std::string &id, const std::string &msg) const { - std::list locations; - - for (std::list::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); diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 8d925ccee..23b735266 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -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 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 locationList(1, tok); + const ErrorLogger::ErrorMessage errmsg(locationList, &_tokenizer->list, Severity::debug, msg, "debug", false); if (_errorLogger) _errorLogger->reportErr(errmsg); - else - Check::reportError(errmsg); } } diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index b23e75ea0..433f60bca 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -21,6 +21,7 @@ #include "tokenize.h" #include "token.h" #include "settings.h" +#include "path.h" #include 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())); }