Cppcheck
|
Checking for misusage of variable argument lists. More...
#include <checkvaarg.h>
Public Member Functions | |
CheckVaarg () | |
Public Member Functions inherited from Check | |
Check (const std::string &aname) | |
This constructor is used when registering the CheckClass. More... | |
virtual | ~Check () |
Check (const Check &)=delete | |
Check & | operator= (const Check &)=delete |
const std::string & | name () const |
class name, used to generate documentation More... | |
virtual FileInfo * | getFileInfo (const Tokenizer &, const Settings &) const |
virtual FileInfo * | loadFileInfoFromXml (const tinyxml2::XMLElement *xmlElement) const |
virtual bool | analyseWholeProgram (const CTU::FileInfo *ctu, const std::list< FileInfo * > &fileInfo, const Settings &, ErrorLogger &) |
Private Member Functions | |
CheckVaarg (const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) | |
void | runChecks (const Tokenizer &tokenizer, ErrorLogger *errorLogger) override |
run checks, the token list is not simplified More... | |
void | va_start_argument () |
void | va_list_usage () |
void | wrongParameterTo_va_start_error (const Token *tok, const std::string ¶mIsName, const std::string ¶mShouldName) |
void | referenceAs_va_start_error (const Token *tok, const std::string ¶mName) |
void | va_end_missingError (const Token *tok, const std::string &varname) |
void | va_list_usedBeforeStartedError (const Token *tok, const std::string &varname) |
void | va_start_subsequentCallsError (const Token *tok, const std::string &varname) |
void | getErrorMessages (ErrorLogger *errorLogger, const Settings *settings) const override |
get error messages More... | |
std::string | classInfo () const override |
get information about this class, used to generate documentation More... | |
Static Private Member Functions | |
static std::string | myName () |
Additional Inherited Members | |
Static Public Member Functions inherited from Check | |
static std::list< Check * > & | instances () |
List of registered check classes. More... | |
static void | writeToErrorList (const ErrorMessage &errmsg) |
Write given error to stdout in xml format. More... | |
Protected Member Functions inherited from Check | |
Check (std::string aname, const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) | |
This constructor is used when running checks. More... | |
void | reportError (const Token *tok, const Severity severity, const std::string &id, const std::string &msg) |
report an error More... | |
void | reportError (const Token *tok, const Severity severity, const std::string &id, const std::string &msg, const CWE &cwe, Certainty certainty) |
report an error More... | |
void | reportError (const std::list< const Token * > &callstack, Severity severity, const std::string &id, const std::string &msg) |
report an error More... | |
void | reportError (const std::list< const Token * > &callstack, Severity severity, const std::string &id, const std::string &msg, const CWE &cwe, Certainty certainty) |
report an error More... | |
void | reportError (const ErrorPath &errorPath, Severity severity, const char id[], const std::string &msg, const CWE &cwe, Certainty certainty) |
void | logChecker (const char id[]) |
log checker More... | |
ErrorPath | getErrorPath (const Token *errtok, const ValueFlow::Value *value, std::string bug) const |
bool | wrongData (const Token *tok, const char *str) |
Use WRONG_DATA in checkers when you check for wrong data. More... | |
Static Protected Member Functions inherited from Check | |
static std::string | getMessageId (const ValueFlow::Value &value, const char id[]) |
Protected Attributes inherited from Check | |
const Tokenizer *const | mTokenizer {} |
const Settings *const | mSettings {} |
ErrorLogger *const | mErrorLogger {} |
Checking for misusage of variable argument lists.
Definition at line 42 of file checkvaarg.h.
|
inline |
Definition at line 44 of file checkvaarg.h.
|
inlineprivate |
Definition at line 47 of file checkvaarg.h.
|
inlineoverrideprivatevirtual |
get information about this class, used to generate documentation
Implements Check.
Definition at line 78 of file checkvaarg.h.
|
inlineoverrideprivatevirtual |
get error messages
Implements Check.
Definition at line 65 of file checkvaarg.h.
References referenceAs_va_start_error(), va_end_missingError(), va_list_usedBeforeStartedError(), va_start_subsequentCallsError(), and wrongParameterTo_va_start_error().
|
inlinestaticprivate |
Definition at line 74 of file checkvaarg.h.
|
private |
Definition at line 90 of file checkvaarg.cpp.
References CWE758, error, normal, and Check::reportError().
Referenced by getErrorMessages(), and va_start_argument().
|
inlineoverrideprivatevirtual |
run checks, the token list is not simplified
Implements Check.
Definition at line 50 of file checkvaarg.h.
References Tokenizer::getSettings(), va_list_usage(), and va_start_argument().
|
private |
Definition at line 166 of file checkvaarg.cpp.
References CWE664, error, normal, and Check::reportError().
Referenced by getErrorMessages(), and va_list_usage().
|
private |
Definition at line 101 of file checkvaarg.cpp.
References Settings::clang, findLambdaEndToken(), findNextTokenFromBreak(), Tokenizer::getSymbolDatabase(), Token::isCpp(), Token::linkAt(), Check::logChecker(), Token::Match(), Check::mSettings, Check::mTokenizer, Token::next(), Token::previous(), Token::scope(), Token::simpleMatch(), Token::str(), Token::tokAt(), va_end_missingError(), va_list_usedBeforeStartedError(), va_start_subsequentCallsError(), SymbolDatabase::variableList(), and Token::varId().
Referenced by runChecks().
|
private |
Definition at line 172 of file checkvaarg.cpp.
References CWE664, error, normal, and Check::reportError().
Referenced by getErrorMessages(), and va_list_usage().
|
private |
Definition at line 50 of file checkvaarg.cpp.
References Scope::bodyEnd, Scope::bodyStart, Scope::function, SymbolDatabase::functionScopes, Tokenizer::getSymbolDatabase(), Variable::index(), SimpleEnableGroup< T >::isEnabled(), Variable::isReference(), Check::logChecker(), Check::mSettings, Check::mTokenizer, Variable::name(), Token::next(), Token::nextArgument(), referenceAs_va_start_error(), Settings::severity, Token::simpleMatch(), Token::tokAt(), Token::variable(), warning, and wrongParameterTo_va_start_error().
Referenced by runChecks().
|
private |
Definition at line 178 of file checkvaarg.cpp.
References CWE664, error, normal, and Check::reportError().
Referenced by getErrorMessages(), and va_list_usage().
|
private |
Definition at line 84 of file checkvaarg.cpp.
References CWE688, normal, Check::reportError(), and warning.
Referenced by getErrorMessages(), and va_start_argument().