Cppcheck
|
Wrapper for error messages, provided by reportErr() More...
#include <errorlogger.h>
Classes | |
class | FileLocation |
File name and line number. More... | |
Public Member Functions | |
ErrorMessage (const std::list< FileLocation > &callStack, const std::string &file1, Severity::SeverityType severity, const std::string &msg, const std::string &id, bool inconclusive) | |
ErrorMessage (const std::list< FileLocation > &callStack, const std::string &file1, Severity::SeverityType severity, const std::string &msg, const std::string &id, const CWE &cwe, bool inconclusive) | |
ErrorMessage (const std::list< const Token *> &callstack, const TokenList *list, Severity::SeverityType severity, const std::string &id, const std::string &msg, bool inconclusive) | |
ErrorMessage (const std::list< const Token *> &callstack, const TokenList *list, Severity::SeverityType severity, const std::string &id, const std::string &msg, const CWE &cwe, bool inconclusive) | |
ErrorMessage (const ErrorPath &errorPath, const TokenList *tokenList, Severity::SeverityType severity, const char id[], const std::string &msg, const CWE &cwe, bool inconclusive) | |
ErrorMessage () | |
ErrorMessage (const tinyxml2::XMLElement *const errmsg) | |
std::string | toXML () const |
Format the error message in XML format. More... | |
std::string | toString (bool verbose, const std::string &templateFormat=emptyString, const std::string &templateLocation=emptyString) const |
Format the error message into a string. More... | |
std::string | serialize () const |
bool | deserialize (const std::string &data) |
void | setmsg (const std::string &msg) |
set short and verbose messages More... | |
const std::string & | shortMessage () const |
Short message (single line short message) More... | |
const std::string & | verboseMessage () const |
Verbose message (may be the same as the short message) More... | |
const std::string & | symbolNames () const |
Symbol names. More... | |
Suppressions::ErrorMessage | toSuppressionsErrorMessage () const |
Static Public Member Functions | |
static std::string | getXMLHeader () |
static std::string | getXMLFooter () |
Public Attributes | |
std::list< FileLocation > | callStack |
std::string | id |
std::string | file0 |
For GUI rechecking; source file (not header) More... | |
std::string | function |
For GUI bug hunting; function name. More... | |
bool | incomplete |
For GUI bug hunting; incomplete analysis. More... | |
Severity::SeverityType | severity |
CWE | cwe |
bool | inconclusive |
Static Private Member Functions | |
static void | findAndReplace (std::string &source, const std::string &searchFor, const std::string &replaceWith) |
Replace all occurrences of searchFor with replaceWith in the given source. More... | |
static std::string | fixInvalidChars (const std::string &raw) |
Private Attributes | |
std::string | mShortMessage |
Short message. More... | |
std::string | mVerboseMessage |
Verbose message. More... | |
std::string | mSymbolNames |
symbol names More... | |
Wrapper for error messages, provided by reportErr()
Definition at line 149 of file errorlogger.h.
ErrorLogger::ErrorMessage::ErrorMessage | ( | const std::list< FileLocation > & | callStack, |
const std::string & | file1, | ||
Severity::SeverityType | severity, | ||
const std::string & | msg, | ||
const std::string & | id, | ||
bool | inconclusive | ||
) |
Definition at line 111 of file errorlogger.cpp.
References setmsg().
ErrorLogger::ErrorMessage::ErrorMessage | ( | const std::list< FileLocation > & | callStack, |
const std::string & | file1, | ||
Severity::SeverityType | severity, | ||
const std::string & | msg, | ||
const std::string & | id, | ||
const CWE & | cwe, | ||
bool | inconclusive | ||
) |
Definition at line 126 of file errorlogger.cpp.
References setmsg().
ErrorLogger::ErrorMessage::ErrorMessage | ( | const std::list< const Token *> & | callstack, |
const TokenList * | list, | ||
Severity::SeverityType | severity, | ||
const std::string & | id, | ||
const std::string & | msg, | ||
bool | inconclusive | ||
) |
Definition at line 139 of file errorlogger.cpp.
References callStack, file0, TokenList::getFiles(), and setmsg().
ErrorLogger::ErrorMessage::ErrorMessage | ( | const std::list< const Token *> & | callstack, |
const TokenList * | list, | ||
Severity::SeverityType | severity, | ||
const std::string & | id, | ||
const std::string & | msg, | ||
const CWE & | cwe, | ||
bool | inconclusive | ||
) |
Definition at line 158 of file errorlogger.cpp.
References callStack, file0, TokenList::getFiles(), and setmsg().
ErrorLogger::ErrorMessage::ErrorMessage | ( | const ErrorPath & | errorPath, |
const TokenList * | tokenList, | ||
Severity::SeverityType | severity, | ||
const char | id[], | ||
const std::string & | msg, | ||
const CWE & | cwe, | ||
bool | inconclusive | ||
) |
Definition at line 176 of file errorlogger.cpp.
References callStack, file0, TokenList::getFiles(), and setmsg().
ErrorLogger::ErrorMessage::ErrorMessage | ( | ) |
Definition at line 106 of file errorlogger.cpp.
|
explicit |
Definition at line 195 of file errorlogger.cpp.
References callStack, cwe, Severity::fromString(), CWE::id, inconclusive, mShortMessage, mVerboseMessage, Severity::none, and severity.
bool ErrorLogger::ErrorMessage::deserialize | ( | const std::string & | data | ) |
Definition at line 305 of file errorlogger.cpp.
References callStack, cwe, Severity::fromString(), CWE::id, inconclusive, mShortMessage, mVerboseMessage, ErrorLogger::ErrorMessage::FileLocation::setfile(), ErrorLogger::ErrorMessage::FileLocation::setinfo(), severity, and MathLib::toLongNumber().
Referenced by ThreadExecutor::~ThreadExecutor().
|
staticprivate |
Replace all occurrences of searchFor with replaceWith in the given source.
source | The string to modify |
searchFor | What should be searched for |
replaceWith | What will replace the found item |
Definition at line 483 of file errorlogger.cpp.
Referenced by toString().
|
staticprivate |
Definition at line 421 of file errorlogger.cpp.
Referenced by serialize(), and toXML().
|
static |
Definition at line 414 of file errorlogger.cpp.
Referenced by CppCheckExecutor::check_internal(), and CppCheckExecutor::parseFromArgs().
|
static |
Definition at line 393 of file errorlogger.cpp.
References CppCheck::version().
Referenced by CppCheckExecutor::check_internal(), and CppCheckExecutor::parseFromArgs().
std::string ErrorLogger::ErrorMessage::serialize | ( | ) | const |
Definition at line 277 of file errorlogger.cpp.
References callStack, cwe, fixInvalidChars(), CWE::id, id, inconclusive, mShortMessage, mVerboseMessage, severity, MathLib::toString(), and Severity::toString().
Referenced by ThreadExecutor::~ThreadExecutor().
void ErrorLogger::ErrorMessage::setmsg | ( | const std::string & | msg | ) |
set short and verbose messages
Definition at line 237 of file errorlogger.cpp.
References endsWith(), mShortMessage, mSymbolNames, mVerboseMessage, and replaceStr().
Referenced by CppCheck::analyseClangTidy(), and ErrorMessage().
|
inline |
Short message (single line short message)
Definition at line 292 of file errorlogger.h.
Referenced by ErrorLogger::plistData().
|
inline |
Symbol names.
Definition at line 302 of file errorlogger.h.
std::string ErrorLogger::ErrorMessage::toString | ( | bool | verbose, |
const std::string & | templateFormat = emptyString , |
||
const std::string & | templateLocation = emptyString |
||
) | const |
Format the error message into a string.
verbose | use verbose message |
templateFormat | Empty string to use default output format or template to be used. E.g. "{file}:{line},{severity},{id},{message}" |
templateLocation | Format Empty string to use default output format or template to be used. E.g. "{file}:{line},{info}" |
Definition at line 509 of file errorlogger.cpp.
References callStack, ErrorLogger::callStackToString(), cwe, emptyString, findAndReplace(), CWE::id, inconclusive, mShortMessage, mVerboseMessage, Severity::none, readCode(), severity, MathLib::toString(), and Severity::toString().
Referenced by CppCheckExecutor::reportErr(), CppCheck::reportErr(), and ThreadExecutor::~ThreadExecutor().
Suppressions::ErrorMessage ErrorLogger::ErrorMessage::toSuppressionsErrorMessage | ( | ) | const |
Definition at line 263 of file errorlogger.cpp.
References callStack, Suppressions::ErrorMessage::errorId, id, Suppressions::ErrorMessage::inconclusive, inconclusive, Suppressions::ErrorMessage::lineNumber, mSymbolNames, Suppressions::ErrorMessage::setFileName(), and Suppressions::ErrorMessage::symbolNames.
Referenced by CppCheck::reportErr(), CppCheck::reportInfo(), and ThreadExecutor::~ThreadExecutor().
std::string ErrorLogger::ErrorMessage::toXML | ( | ) | const |
Format the error message in XML format.
Definition at line 441 of file errorlogger.cpp.
References callStack, cwe, file0, fixInvalidChars(), CWE::id, inconclusive, mShortMessage, mSymbolNames, mVerboseMessage, severity, Path::toNativeSeparators(), and Severity::toString().
Referenced by AnalyzerInformation::reportErr(), CppCheckExecutor::reportErr(), and Check::reportError().
|
inline |
Verbose message (may be the same as the short message)
Definition at line 297 of file errorlogger.h.
std::list<FileLocation> ErrorLogger::ErrorMessage::callStack |
Definition at line 274 of file errorlogger.h.
Referenced by CppCheck::analyseClangTidy(), CppCheck::checkFile(), deserialize(), ErrorItem::ErrorItem(), ErrorMessage(), ErrorLogger::plistData(), ErrorLogger::reportUnmatchedSuppressions(), serialize(), toString(), toSuppressionsErrorMessage(), and toXML().
CWE ErrorLogger::ErrorMessage::cwe |
Definition at line 285 of file errorlogger.h.
Referenced by deserialize(), ErrorMessage(), serialize(), toString(), and toXML().
std::string ErrorLogger::ErrorMessage::file0 |
For GUI rechecking; source file (not header)
Definition at line 278 of file errorlogger.h.
Referenced by CppCheck::analyseClangTidy(), ErrorMessage(), CppCheck::reportErr(), and toXML().
std::string ErrorLogger::ErrorMessage::function |
For GUI bug hunting; function name.
Definition at line 280 of file errorlogger.h.
Referenced by ExprEngine::runChecks().
std::string ErrorLogger::ErrorMessage::id |
Definition at line 275 of file errorlogger.h.
Referenced by CppCheck::analyseClangTidy(), NewSuppressionDialog::NewSuppressionDialog(), ErrorLogger::plistData(), serialize(), and toSuppressionsErrorMessage().
bool ErrorLogger::ErrorMessage::incomplete |
For GUI bug hunting; incomplete analysis.
Definition at line 282 of file errorlogger.h.
Referenced by executeAssign(), and ExprEngine::runChecks().
bool ErrorLogger::ErrorMessage::inconclusive |
Definition at line 286 of file errorlogger.h.
Referenced by deserialize(), ErrorMessage(), serialize(), toString(), toSuppressionsErrorMessage(), and toXML().
|
private |
Short message.
Definition at line 321 of file errorlogger.h.
Referenced by deserialize(), ErrorMessage(), serialize(), setmsg(), toString(), and toXML().
|
private |
symbol names
Definition at line 327 of file errorlogger.h.
Referenced by setmsg(), toSuppressionsErrorMessage(), and toXML().
|
private |
Verbose message.
Definition at line 324 of file errorlogger.h.
Referenced by deserialize(), ErrorMessage(), serialize(), setmsg(), toString(), and toXML().
Severity::SeverityType ErrorLogger::ErrorMessage::severity |
Definition at line 284 of file errorlogger.h.
Referenced by CppCheck::analyseClangTidy(), deserialize(), ErrorMessage(), ErrorLogger::plistData(), ThreadResult::reportErr(), serialize(), toString(), and toXML().