|
Cppcheck
|
Check class variables, variables that are allocated in the constructor should be deallocated in the destructor More...
#include <checkmemoryleak.h>
Public Member Functions | |
| CheckMemoryLeakInClass () | |
| CheckMemoryLeakInClass (const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog) | |
| void | runSimplifiedChecks (const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog) |
| run checks, the token list is simplified | |
| void | check () |
Private Member Functions | |
| void | variable (const Scope *scope, const Token *tokVarname) |
| void | checkPublicFunctions (const Scope *scope, const Token *classtok) |
| Public functions: possible double-allocation. | |
| void | publicAllocationError (const Token *tok, const std::string &varname) |
| void | unsafeClassError (const Token *tok, const std::string &classname, const std::string &varname) |
| void | getErrorMessages (ErrorLogger *e, const Settings *settings) const |
| get error messages | |
| std::string | classInfo () const |
| get information about this class, used to generate documentation | |
Static Private Member Functions | |
| static std::string | myName () |
Check class variables, variables that are allocated in the constructor should be deallocated in the destructor
Definition at line 351 of file checkmemoryleak.h.
| CheckMemoryLeakInClass::CheckMemoryLeakInClass | ( | ) | [inline] |
Definition at line 353 of file checkmemoryleak.h.
| CheckMemoryLeakInClass::CheckMemoryLeakInClass | ( | const Tokenizer * | tokenizr, |
| const Settings * | settings, | ||
| ErrorLogger * | errLog | ||
| ) | [inline] |
Definition at line 356 of file checkmemoryleak.h.
| void CheckMemoryLeakInClass::check | ( | ) |
Definition at line 2331 of file checkmemoryleak.cpp.
References Check::_tokenizer, checkPublicFunctions(), SymbolDatabase::classAndStructScopes, Tokenizer::getSymbolDatabase(), Token::isStandardType(), variable(), and Scope::varlist.
Referenced by runSimplifiedChecks().
| void CheckMemoryLeakInClass::checkPublicFunctions | ( | const Scope * | scope, |
| const Token * | classtok | ||
| ) | [private] |
Public functions: possible double-allocation.
Definition at line 2493 of file checkmemoryleak.cpp.
References Check::_settings, Check::_tokenizer, Scope::className, SymbolDatabase::debugMessage(), Function::eFunction, Function::eOperatorEqual, Scope::functionList, CheckMemoryLeak::getAllocationType(), Tokenizer::getSymbolDatabase(), Settings::isEnabled(), Token::Match(), Token::next(), CheckMemoryLeak::No, Public, publicAllocationError(), Token::str(), Token::strAt(), Token::tokAt(), and Token::varId().
Referenced by check().
| std::string CheckMemoryLeakInClass::classInfo | ( | ) | const [inline, private, virtual] |
get information about this class, used to generate documentation
Implements Check.
Definition at line 389 of file checkmemoryleak.h.
| void CheckMemoryLeakInClass::getErrorMessages | ( | ErrorLogger * | errorLogger, |
| const Settings * | settings | ||
| ) | const [inline, private, virtual] |
get error messages
Implements Check.
Definition at line 379 of file checkmemoryleak.h.
References publicAllocationError(), and unsafeClassError().
| static std::string CheckMemoryLeakInClass::myName | ( | ) | [inline, static, private] |
Definition at line 385 of file checkmemoryleak.h.
| void CheckMemoryLeakInClass::publicAllocationError | ( | const Token * | tok, |
| const std::string & | varname | ||
| ) | [private] |
Definition at line 2531 of file checkmemoryleak.cpp.
References Check::reportError(), and Severity::warning.
Referenced by checkPublicFunctions(), and getErrorMessages().
| void CheckMemoryLeakInClass::runSimplifiedChecks | ( | const Tokenizer * | tokenizer, |
| const Settings * | settings, | ||
| ErrorLogger * | errorLogger | ||
| ) | [inline, virtual] |
run checks, the token list is simplified
Implements Check.
Definition at line 360 of file checkmemoryleak.h.
References check(), and Tokenizer::isCPP().
| void CheckMemoryLeakInClass::unsafeClassError | ( | const Token * | tok, |
| const std::string & | classname, | ||
| const std::string & | varname | ||
| ) | [private] |
Definition at line 2485 of file checkmemoryleak.cpp.
References Check::reportError(), and Severity::style.
Referenced by getErrorMessages(), and variable().
| void CheckMemoryLeakInClass::variable | ( | const Scope * | scope, |
| const Token * | tokVarname | ||
| ) | [private] |
Definition at line 2367 of file checkmemoryleak.cpp.
References Scope::className, Function::eConstructor, Function::eDestructor, Scope::functionList, CheckMemoryLeak::getAllocationType(), CheckMemoryLeak::getDeallocationType(), Token::link(), CheckMemoryLeak::Many, Token::Match(), CheckMemoryLeak::mismatchAllocDealloc(), Token::next(), CheckMemoryLeak::No, Token::str(), CheckMemoryLeakInFunction::test_white_list(), unsafeClassError(), and Token::varId().
Referenced by check().
1.7.6.1