renamed `Check::reportError(const ErrorMessage&)` to `writeToErrorList()` to reflect its actual behavior (#5322)
This commit is contained in:
parent
bfb50ca9d8
commit
e669b102f8
|
@ -55,7 +55,7 @@ Check::Check(const std::string &aname)
|
||||||
instances().insert(it, this);
|
instances().insert(it, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Check::reportError(const ErrorMessage &errmsg)
|
void Check::writeToErrorList(const ErrorMessage &errmsg)
|
||||||
{
|
{
|
||||||
std::cout << errmsg.toXML() << std::endl;
|
std::cout << errmsg.toXML() << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ void Check::reportError(const std::list<const Token *> &callstack, Severity::Sev
|
||||||
if (mErrorLogger)
|
if (mErrorLogger)
|
||||||
mErrorLogger->reportErr(errmsg);
|
mErrorLogger->reportErr(errmsg);
|
||||||
else
|
else
|
||||||
reportError(errmsg);
|
writeToErrorList(errmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Check::reportError(const ErrorPath &errorPath, Severity::SeverityType severity, const char id[], const std::string &msg, const CWE &cwe, Certainty certainty)
|
void Check::reportError(const ErrorPath &errorPath, Severity::SeverityType severity, const char id[], const std::string &msg, const CWE &cwe, Certainty certainty)
|
||||||
|
@ -76,7 +76,7 @@ void Check::reportError(const ErrorPath &errorPath, Severity::SeverityType sever
|
||||||
if (mErrorLogger)
|
if (mErrorLogger)
|
||||||
mErrorLogger->reportErr(errmsg);
|
mErrorLogger->reportErr(errmsg);
|
||||||
else
|
else
|
||||||
reportError(errmsg);
|
writeToErrorList(errmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Check::wrongData(const Token *tok, const char *str)
|
bool Check::wrongData(const Token *tok, const char *str)
|
||||||
|
|
|
@ -91,11 +91,11 @@ public:
|
||||||
virtual std::string classInfo() const = 0;
|
virtual std::string classInfo() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write given error to errorlogger or to out stream in xml format.
|
* Write given error to stdout in xml format.
|
||||||
* This is for for printout out the error list with --errorlist
|
* This is for for printout out the error list with --errorlist
|
||||||
* @param errmsg Error message to write
|
* @param errmsg Error message to write
|
||||||
*/
|
*/
|
||||||
static void reportError(const ErrorMessage &errmsg);
|
static void writeToErrorList(const ErrorMessage &errmsg);
|
||||||
|
|
||||||
/** Base class used for whole-program analysis */
|
/** Base class used for whole-program analysis */
|
||||||
class CPPCHECKLIB FileInfo {
|
class CPPCHECKLIB FileInfo {
|
||||||
|
|
|
@ -293,7 +293,7 @@ void CheckMemoryLeak::reportErr(const std::list<const Token *> &callstack, Sever
|
||||||
if (mErrorLogger_)
|
if (mErrorLogger_)
|
||||||
mErrorLogger_->reportErr(errmsg);
|
mErrorLogger_->reportErr(errmsg);
|
||||||
else
|
else
|
||||||
Check::reportError(errmsg);
|
Check::writeToErrorList(errmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckMemoryLeak::memleakError(const Token *tok, const std::string &varname) const
|
void CheckMemoryLeak::memleakError(const Token *tok, const std::string &varname) const
|
||||||
|
|
|
@ -357,7 +357,7 @@ void CheckUnusedFunctions::unusedFunctionError(ErrorLogger * const errorLogger,
|
||||||
if (errorLogger)
|
if (errorLogger)
|
||||||
errorLogger->reportErr(errmsg);
|
errorLogger->reportErr(errmsg);
|
||||||
else
|
else
|
||||||
reportError(errmsg);
|
Check::writeToErrorList(errmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
Check::FileInfo *CheckUnusedFunctions::getFileInfo(const Tokenizer *tokenizer, const Settings *settings) const
|
Check::FileInfo *CheckUnusedFunctions::getFileInfo(const Tokenizer *tokenizer, const Settings *settings) const
|
||||||
|
|
|
@ -43,6 +43,7 @@ ErrorMessage::ErrorMessage()
|
||||||
: severity(Severity::none), cwe(0U), certainty(Certainty::normal), hash(0)
|
: severity(Severity::none), cwe(0U), certainty(Certainty::normal), hash(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
// TODO: id and msg are swapped compared to other calls
|
||||||
ErrorMessage::ErrorMessage(std::list<FileLocation> callStack, std::string file1, Severity::SeverityType severity, const std::string &msg, std::string id, Certainty certainty) :
|
ErrorMessage::ErrorMessage(std::list<FileLocation> callStack, std::string file1, Severity::SeverityType severity, const std::string &msg, std::string id, Certainty certainty) :
|
||||||
callStack(std::move(callStack)), // locations for this error message
|
callStack(std::move(callStack)), // locations for this error message
|
||||||
id(std::move(id)), // set the message id
|
id(std::move(id)), // set the message id
|
||||||
|
@ -57,7 +58,7 @@ ErrorMessage::ErrorMessage(std::list<FileLocation> callStack, std::string file1,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: id and msg are swapped compared to other calls
|
||||||
ErrorMessage::ErrorMessage(std::list<FileLocation> callStack, std::string file1, Severity::SeverityType severity, const std::string &msg, std::string id, const CWE &cwe, Certainty certainty) :
|
ErrorMessage::ErrorMessage(std::list<FileLocation> callStack, std::string file1, Severity::SeverityType severity, const std::string &msg, std::string id, const CWE &cwe, Certainty certainty) :
|
||||||
callStack(std::move(callStack)), // locations for this error message
|
callStack(std::move(callStack)), // locations for this error message
|
||||||
id(std::move(id)), // set the message id
|
id(std::move(id)), // set the message id
|
||||||
|
|
|
@ -10139,7 +10139,7 @@ void Tokenizer::reportError(const std::list<const Token*>& callstack, Severity::
|
||||||
if (mErrorLogger)
|
if (mErrorLogger)
|
||||||
mErrorLogger->reportErr(errmsg);
|
mErrorLogger->reportErr(errmsg);
|
||||||
else
|
else
|
||||||
Check::reportError(errmsg);
|
Check::writeToErrorList(errmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tokenizer::setPodTypes()
|
void Tokenizer::setPodTypes()
|
||||||
|
|
Loading…
Reference in New Issue