21 #ifndef checknullpointerH
22 #define checknullpointerH
53 friend class TestNullPointer;
68 bool isPointerDeRef(
const Token *tok,
bool &unknown)
const;
70 static bool isPointerDeRef(
const Token *tok,
bool &unknown,
const Settings &settings);
79 static void parseFunctionCall(
const Token &tok,
80 std::list<const Token *> &var,
85 :
Check(myName(), tokenizer, settings, errorLogger) {}
99 void nullConstantDereference();
126 return "Null pointer";
131 return "Null pointers\n"
132 "- null pointer dereferencing\n"
133 "- undefined null pointer arithmetic\n";
140 void nullPointerByDeRefAndChec();
check for null pointer dereferencing
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override
Get error messages.
static std::string myName()
Name of check.
void nullPointer()
possible null pointer dereference
void runChecks(const Tokenizer &tokenizer, ErrorLogger *errorLogger) override
Run checks against the normal token list.
CheckNullPointer()
This constructor is used when registering the CheckNullPointer.
void pointerArithmeticError(const Token *tok, const ValueFlow::Value *value, bool inconclusive)
void redundantConditionWarning(const Token *tok, const ValueFlow::Value *value, const Token *condition, bool inconclusive)
std::string classInfo() const override
class info in WIKI format.
void arithmetic()
undefined null pointer arithmetic
void nullConstantDereference()
dereferencing null constant (after Tokenizer::simplifyKnownVariables)
void nullPointerError(const Token *tok)
CheckNullPointer(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
This constructor is used when running checks.
Base class used for whole-program analysis.
Interface class that cppcheck uses to communicate with the checks.
virtual bool analyseWholeProgram(const CTU::FileInfo *ctu, const std::list< FileInfo * > &fileInfo, const Settings &, ErrorLogger &)
virtual FileInfo * loadFileInfoFromXml(const tinyxml2::XMLElement *xmlElement) const
virtual FileInfo * getFileInfo(const Tokenizer &, const Settings &) const
This is an interface, which the class responsible of error logging should implement.
Library definitions handling.
This is just a container for general settings so that we don't need to pass individual values to func...
The token list that the TokenList generates is a linked-list of this class.
The main purpose is to tokenize the source code.
const Settings & getSettings() const
static const std::string emptyString
Whole program analysis (ctu=Cross Translation Unit)