|
Cppcheck
|
Check classes. More...
#include <checkclass.h>
Classes | |
| struct | Usage |
| Information about a member variable. More... | |
Public Member Functions | |
| CheckClass () | |
| This constructor is used when registering the CheckClass. | |
| CheckClass (const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) | |
| This constructor is used when running checks. | |
| void | runChecks (const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) |
| Run checks on the normal token list. | |
| void | runSimplifiedChecks (const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) |
| Run checks on the simplified token list. | |
| void | constructors () |
| Check that all class constructors are ok | |
| void | privateFunctions () |
| Check that all private functions are called | |
| void | noMemset () |
| Check that the memsets are valid. | |
| void | checkMemsetType (const Scope *start, const Token *tok, const Scope *type, bool allocation) |
| void | operatorEq () |
| 'operator=' should return something and it should not be const. | |
| void | operatorEqRetRefThis () |
| 'operator=' should return reference to *this | |
| void | operatorEqToSelf () |
| 'operator=' should check for assignment to self | |
| void | virtualDestructor () |
| The destructor in a base class should be virtual. | |
| void | thisSubtraction () |
| warn for "this-x". | |
| void | checkConst () |
| can member function be const? | |
| void | initializerListOrder () |
| Check initializer list order. | |
| void | initializationListUsage () |
| void | copyconstructors () |
Private Member Functions | |
| void | noConstructorError (const Token *tok, const std::string &classname, bool isStruct) |
| void | copyConstructorShallowCopyError (const Token *tok, const std::string &varname) |
| void | noCopyConstructorError (const Token *tok, const std::string &classname, bool isStruct) |
| void | uninitVarError (const Token *tok, const std::string &classname, const std::string &varname, bool inconclusive) |
| void | operatorEqVarError (const Token *tok, const std::string &classname, const std::string &varname, bool inconclusive) |
| void | unusedPrivateFunctionError (const Token *tok, const std::string &classname, const std::string &funcname) |
| void | memsetError (const Token *tok, const std::string &memfunc, const std::string &classname, const std::string &type) |
| void | mallocOnClassError (const Token *tok, const std::string &memfunc, const Token *classTok, const std::string &classname) |
| void | mallocOnClassWarning (const Token *tok, const std::string &memfunc, const Token *classTok) |
| void | operatorEqReturnError (const Token *tok, const std::string &className) |
| void | virtualDestructorError (const Token *tok, const std::string &Base, const std::string &Derived) |
| void | thisSubtractionError (const Token *tok) |
| void | operatorEqRetRefThisError (const Token *tok) |
| void | operatorEqToSelfError (const Token *tok) |
| void | checkConstError (const Token *tok, const std::string &classname, const std::string &funcname, bool suggestStatic) |
| void | checkConstError2 (const Token *tok1, const Token *tok2, const std::string &classname, const std::string &funcname, bool suggestStatic) |
| void | initializerListError (const Token *tok1, const Token *tok2, const std::string &classname, const std::string &varname) |
| void | suggestInitializationList (const Token *tok, const std::string &varname) |
| void | getErrorMessages (ErrorLogger *errorLogger, const Settings *settings) const |
| get error messages | |
| std::string | classInfo () const |
| get information about this class, used to generate documentation | |
| void | checkReturnPtrThis (const Scope *scope, const Function *func, const Token *tok, const Token *last) |
| bool | hasAllocation (const Function *func, const Scope *scope) |
| bool | isMemberVar (const Scope *scope, const Token *tok) |
| bool | isMemberFunc (const Scope *scope, const Token *tok) |
| bool | isConstMemberFunc (const Scope *scope, const Token *tok) |
| bool | checkConstFunc (const Scope *scope, const Function *func, bool &memberAccessed) |
| void | initializeVarList (const Function &func, std::list< const Function * > &callstack, const Scope *scope, std::vector< Usage > &usage) |
| parse a scope for a constructor or member function and set the "init" flags in the provided varlist | |
Static Private Member Functions | |
| static std::string | myName () |
| static bool | hasAssignSelf (const Function *func, const Token *rhs) |
| static bool | isBaseClassFunc (const Token *tok, const Scope *scope) |
| static void | assignVar (const std::string &varname, const Scope *scope, std::vector< Usage > &usage) |
| assign a variable in the varlist | |
| static void | initVar (const std::string &varname, const Scope *scope, std::vector< Usage > &usage) |
| initialize a variable in the varlist | |
| static void | assignAllVar (std::vector< Usage > &usage) |
| set all variables in list assigned | |
| static void | clearAllVar (std::vector< Usage > &usage) |
| set all variables in list not assigned and not initialized | |
| static bool | canNotCopy (const Scope *scope) |
Private Attributes | |
| const SymbolDatabase * | symbolDatabase |
Check classes.
Uninitialized member variables, non-conforming operators, missing virtual destructor, etc
Definition at line 36 of file checkclass.h.
| CheckClass::CheckClass | ( | ) | [inline] |
This constructor is used when registering the CheckClass.
Definition at line 39 of file checkclass.h.
| CheckClass::CheckClass | ( | const Tokenizer * | tokenizer, |
| const Settings * | settings, | ||
| ErrorLogger * | errorLogger | ||
| ) |
This constructor is used when running checks.
Definition at line 40 of file checkclass.cpp.
| void CheckClass::assignAllVar | ( | std::vector< Usage > & | usage | ) | [static, private] |
set all variables in list assigned
| usage | reference to usage vector |
Definition at line 339 of file checkclass.cpp.
Referenced by initializeVarList().
| void CheckClass::assignVar | ( | const std::string & | varname, |
| const Scope * | scope, | ||
| std::vector< Usage > & | usage | ||
| ) | [static, private] |
assign a variable in the varlist
| varname | name of variable to mark assigned |
| scope | pointer to variable Scope |
| usage | reference to usage vector |
Definition at line 313 of file checkclass.cpp.
References Scope::varlist.
Referenced by initializeVarList().
| bool CheckClass::canNotCopy | ( | const Scope * | scope | ) | [static, private] |
Definition at line 294 of file checkclass.cpp.
References Function::eConstructor, Function::eCopyConstructor, Function::eOperatorEqual, Scope::functionList, and Public.
Referenced by constructors().
| void CheckClass::checkConst | ( | ) |
can member function be const?
Definition at line 1380 of file checkclass.cpp.
References Check::_settings, checkConstError(), checkConstError2(), checkConstFunc(), SymbolDatabase::classAndStructScopes, Scope::className, Scope::definedType, Type::derivedFrom, Function::eFunction, Scope::eGlobal, Scope::functionList, Settings::inconclusive, SymbolDatabase::isClassOrStruct(), Settings::isEnabled(), Token::isUpperCaseName(), Token::Match(), Scope::nestedIn, Token::previous(), Token::str(), symbolDatabase, and Scope::type.
Referenced by runSimplifiedChecks().
| void CheckClass::checkConstError | ( | const Token * | tok, |
| const std::string & | classname, | ||
| const std::string & | funcname, | ||
| bool | suggestStatic | ||
| ) | [private] |
Definition at line 1734 of file checkclass.cpp.
References checkConstError2().
Referenced by checkConst(), and getErrorMessages().
| void CheckClass::checkConstError2 | ( | const Token * | tok1, |
| const Token * | tok2, | ||
| const std::string & | classname, | ||
| const std::string & | funcname, | ||
| bool | suggestStatic | ||
| ) | [private] |
Definition at line 1739 of file checkclass.cpp.
References Severity::performance, Check::reportError(), and Severity::style.
Referenced by checkConst(), and checkConstError().
| bool CheckClass::checkConstFunc | ( | const Scope * | scope, |
| const Function * | func, | ||
| bool & | memberAccessed | ||
| ) | [private] |
Definition at line 1625 of file checkclass.cpp.
References Scope::classEnd, Scope::classStart, Token::eAssignmentOp, Token::eIncDecOp, Function::functionScope, isConstMemberFunc(), isMemberFunc(), isMemberVar(), Variable::isMutable(), Token::link(), Token::linkAt(), Token::Match(), Token::next(), Token::simpleMatch(), Token::strAt(), Token::tokAt(), Token::type(), Variable::typeScope(), Variable::typeStartToken(), Token::variable(), and Token::varId().
Referenced by checkConst().
| void CheckClass::checkMemsetType | ( | const Scope * | start, |
| const Token * | tok, | ||
| const Scope * | type, | ||
| bool | allocation | ||
| ) |
Definition at line 906 of file checkclass.cpp.
References Scope::classDef, Scope::definedType, Type::derivedFrom, Scope::functionList, mallocOnClassError(), memsetError(), Token::simpleMatch(), Token::str(), Token::strAt(), and Scope::varlist.
Referenced by noMemset().
| void CheckClass::checkReturnPtrThis | ( | const Scope * | scope, |
| const Function * | func, | ||
| const Token * | tok, | ||
| const Token * | last | ||
| ) | [private] |
Definition at line 1041 of file checkclass.cpp.
References Scope::className, Function::eFunction, Scope::functionList, Token::linkAt(), Token::Match(), Token::next(), operatorEqRetRefThisError(), Token::simpleMatch(), Token::str(), Token::strAt(), Token::tokAt(), and Function::token.
Referenced by operatorEqRetRefThis().
| std::string CheckClass::classInfo | ( | ) | const [inline, private, virtual] |
get information about this class, used to generate documentation
Implements Check.
Definition at line 172 of file checkclass.h.
| void CheckClass::clearAllVar | ( | std::vector< Usage > & | usage | ) | [static, private] |
set all variables in list not assigned and not initialized
| usage | reference to usage vector |
Definition at line 345 of file checkclass.cpp.
Referenced by constructors().
| void CheckClass::constructors | ( | ) |
Check that all class constructors are ok
Definition at line 51 of file checkclass.cpp.
References Check::_settings, canNotCopy(), SymbolDatabase::classAndStructScopes, Scope::classDef, Scope::className, clearAllVar(), Function::eConstructor, Function::eCopyConstructor, Function::eOperatorEqual, Scope::eUnion, Scope::functionList, Settings::inconclusive, initializeVarList(), Settings::isEnabled(), Token::isName(), Token::link(), Scope::nestedList, noConstructorError(), Scope::numConstructors, operatorEqVarError(), Private, Token::str(), symbolDatabase, Type::True, Scope::type, uninitVarError(), and Scope::varlist.
Referenced by runSimplifiedChecks().
| void CheckClass::copyconstructors | ( | ) |
Definition at line 191 of file checkclass.cpp.
References Check::_settings, SymbolDatabase::classAndStructScopes, Scope::classDef, Scope::className, copyConstructorShallowCopyError(), Scope::definedType, Type::derivedFrom, Function::eConstructor, Function::eCopyConstructor, Scope::eStruct, Scope::functionList, Settings::isEnabled(), Variable::isPointer(), Token::linkAt(), Token::Match(), Token::next(), noCopyConstructorError(), Variable::scope(), Token::str(), symbolDatabase, Token::tokAt(), Scope::type, Token::variable(), and Token::varId().
Referenced by runSimplifiedChecks().
| void CheckClass::copyConstructorShallowCopyError | ( | const Token * | tok, |
| const std::string & | varname | ||
| ) | [private] |
Definition at line 281 of file checkclass.cpp.
References Check::reportError(), and Severity::style.
Referenced by copyconstructors(), and getErrorMessages().
| void CheckClass::getErrorMessages | ( | ErrorLogger * | errorLogger, |
| const Settings * | settings | ||
| ) | const [inline, private, virtual] |
get error messages
Implements Check.
Definition at line 145 of file checkclass.h.
References checkConstError(), copyConstructorShallowCopyError(), initializerListError(), mallocOnClassError(), mallocOnClassWarning(), memsetError(), noConstructorError(), noCopyConstructorError(), operatorEqRetRefThisError(), operatorEqReturnError(), operatorEqToSelfError(), operatorEqVarError(), suggestInitializationList(), thisSubtractionError(), uninitVarError(), unusedPrivateFunctionError(), and virtualDestructorError().
| bool CheckClass::hasAllocation | ( | const Function * | func, |
| const Scope * | scope | ||
| ) | [private] |
Definition at line 1155 of file checkclass.cpp.
References Scope::classEnd, Scope::classStart, Function::functionScope, isMemberVar(), Token::Match(), Token::next(), Token::str(), and Token::tokAt().
Referenced by operatorEqToSelf().
| bool CheckClass::hasAssignSelf | ( | const Function * | func, |
| const Token * | rhs | ||
| ) | [static, private] |
Definition at line 1190 of file checkclass.cpp.
References Scope::classEnd, Scope::classStart, Function::functionScope, Token::link(), Token::Match(), Token::next(), Token::simpleMatch(), Token::str(), Token::strAt(), and Token::tokAt().
Referenced by operatorEqToSelf().
| void CheckClass::initializationListUsage | ( | ) |
Definition at line 680 of file checkclass.cpp.
References Check::_settings, Scope::classEnd, Scope::classStart, Function::eConstructor, Function::eCopyConstructor, Scope::function, Scope::functionOf, SymbolDatabase::functionScopes, Settings::isEnabled(), isMemberFunc(), Variable::isPointer(), Variable::isStatic(), Token::linkAt(), Token::Match(), Token::next(), Variable::scope(), Token::simpleMatch(), Token::str(), suggestInitializationList(), symbolDatabase, Token::tokAt(), Variable::type(), Function::type, and Variable::typeStartToken().
Referenced by runSimplifiedChecks().
| void CheckClass::initializerListError | ( | const Token * | tok1, |
| const Token * | tok2, | ||
| const std::string & | classname, | ||
| const std::string & | varname | ||
| ) | [private] |
Definition at line 1833 of file checkclass.cpp.
References Check::reportError(), and Severity::style.
Referenced by getErrorMessages(), and initializerListOrder().
| void CheckClass::initializerListOrder | ( | ) |
Check initializer list order.
Definition at line 1775 of file checkclass.cpp.
References Check::_settings, SymbolDatabase::classAndStructScopes, Scope::className, Function::eConstructor, Function::eCopyConstructor, Scope::functionList, Scope::getVariable(), Settings::inconclusive, initializerListError(), Settings::isEnabled(), Token::link(), Token::Match(), Token::next(), Token::str(), Token::strAt(), symbolDatabase, and Token::tokAt().
Referenced by runSimplifiedChecks().
| void CheckClass::initializeVarList | ( | const Function & | func, |
| std::list< const Function * > & | callstack, | ||
| const Scope * | scope, | ||
| std::vector< Usage > & | usage | ||
| ) | [private] |
parse a scope for a constructor or member function and set the "init" flags in the provided varlist
| func | reference to the function that should be checked |
| callstack | the function doesn't look into recursive function calls. |
| scope | pointer to variable Scope |
| usage | reference to usage vector |
Definition at line 377 of file checkclass.cpp.
References Function::arg, assignAllVar(), assignVar(), Scope::classEnd, Scope::definedType, Function::eConstructor, Function::eCopyConstructor, Function::eOperatorEqual, Scope::findFunction(), Type::friendList, Token::function(), Function::functionScope, Function::hasBody, initVar(), isBaseClassFunc(), Token::link(), Token::linkAt(), Token::Match(), Function::name(), Token::next(), Token::previous(), Token::simpleMatch(), Token::str(), Token::strAt(), Token::tokAt(), Function::type, Token::varId(), and Scope::varlist.
Referenced by constructors().
| void CheckClass::initVar | ( | const std::string & | varname, |
| const Scope * | scope, | ||
| std::vector< Usage > & | usage | ||
| ) | [static, private] |
initialize a variable in the varlist
| varname | name of variable to mark initialized |
| scope | pointer to variable Scope |
| usage | reference to usage vector |
Definition at line 326 of file checkclass.cpp.
References Scope::varlist.
Referenced by initializeVarList().
| bool CheckClass::isBaseClassFunc | ( | const Token * | tok, |
| const Scope * | scope | ||
| ) | [static, private] |
Definition at line 353 of file checkclass.cpp.
References Type::classScope, Scope::definedType, Type::derivedFrom, Scope::functionList, and Token::str().
Referenced by initializeVarList().
| bool CheckClass::isConstMemberFunc | ( | const Scope * | scope, |
| const Token * | tok | ||
| ) | [private] |
Definition at line 1585 of file checkclass.cpp.
References Type::classScope, countMinArgs(), countParameters(), Scope::definedType, Type::derivedFrom, Scope::functionList, and Token::str().
Referenced by checkConstFunc().
| bool CheckClass::isMemberFunc | ( | const Scope * | scope, |
| const Token * | tok | ||
| ) | [private] |
Definition at line 1555 of file checkclass.cpp.
References Type::classScope, countMinArgs(), countParameters(), Scope::definedType, Type::derivedFrom, Scope::functionList, and Token::str().
Referenced by checkConstFunc(), and initializationListUsage().
| bool CheckClass::isMemberVar | ( | const Scope * | scope, |
| const Token * | tok | ||
| ) | [private] |
Definition at line 1467 of file checkclass.cpp.
References Type::classScope, SymbolDatabase::debugMessage(), Scope::definedType, Type::derivedFrom, Token::link(), Token::linkAt(), Token::Match(), Token::previous(), Token::simpleMatch(), Token::str(), symbolDatabase, Token::tokAt(), Token::varId(), and Scope::varlist.
Referenced by checkConstFunc(), and hasAllocation().
| void CheckClass::mallocOnClassError | ( | const Token * | tok, |
| const std::string & | memfunc, | ||
| const Token * | classTok, | ||
| const std::string & | classname | ||
| ) | [private] |
Definition at line 959 of file checkclass.cpp.
References Severity::error, and Check::reportError().
Referenced by checkMemsetType(), and getErrorMessages().
| void CheckClass::mallocOnClassWarning | ( | const Token * | tok, |
| const std::string & | memfunc, | ||
| const Token * | classTok | ||
| ) | [private] |
Definition at line 948 of file checkclass.cpp.
References Check::reportError(), and Severity::warning.
Referenced by getErrorMessages(), and noMemset().
| void CheckClass::memsetError | ( | const Token * | tok, |
| const std::string & | memfunc, | ||
| const std::string & | classname, | ||
| const std::string & | type | ||
| ) | [private] |
Definition at line 970 of file checkclass.cpp.
References Severity::error, and Check::reportError().
Referenced by checkMemsetType(), and getErrorMessages().
| static std::string CheckClass::myName | ( | ) | [inline, static, private] |
Definition at line 168 of file checkclass.h.
| void CheckClass::noConstructorError | ( | const Token * | tok, |
| const std::string & | classname, | ||
| bool | isStruct | ||
| ) | [private] |
Definition at line 654 of file checkclass.cpp.
References Check::reportError(), and Severity::style.
Referenced by constructors(), and getErrorMessages().
| void CheckClass::noCopyConstructorError | ( | const Token * | tok, |
| const std::string & | classname, | ||
| bool | isStruct | ||
| ) | [private] |
Definition at line 286 of file checkclass.cpp.
References Check::reportError(), and Severity::style.
Referenced by copyconstructors(), and getErrorMessages().
| void CheckClass::noMemset | ( | ) |
Check that the memsets are valid.
The 'memset' function can do dangerous things if used wrong. If it is used on STL containers for instance it will clear all its data and then the STL container may leak memory or worse have an invalid state. It can also overwrite the virtual table. Important: The checking doesn't work on simplified tokens list.
Definition at line 835 of file checkclass.cpp.
References Check::_settings, checkMemsetType(), Scope::classEnd, Type::classScope, Scope::classStart, Variable::dimensions(), findFunctionOf(), SymbolDatabase::findVariableType(), SymbolDatabase::functionScopes, Variable::isArray(), Settings::isEnabled(), Variable::isPointer(), mallocOnClassWarning(), Token::Match(), Token::next(), Token::nextArgument(), Token::scope(), Token::simpleMatch(), Token::str(), Token::strAt(), symbolDatabase, Token::tokAt(), Variable::typeScope(), and Token::variable().
Referenced by runChecks().
| void CheckClass::operatorEq | ( | ) |
'operator=' should return something and it should not be const.
Definition at line 979 of file checkclass.cpp.
References Check::_settings, SymbolDatabase::classAndStructScopes, Scope::className, Function::eOperatorEqual, Scope::functionList, Settings::isEnabled(), Token::Match(), operatorEqReturnError(), Private, and symbolDatabase.
Referenced by runSimplifiedChecks().
| void CheckClass::operatorEqRetRefThis | ( | ) |
'operator=' should return reference to *this
Definition at line 1018 of file checkclass.cpp.
References Check::_settings, checkReturnPtrThis(), SymbolDatabase::classAndStructScopes, Scope::className, Function::eOperatorEqual, Scope::functionList, Settings::isEnabled(), Token::Match(), and symbolDatabase.
Referenced by runSimplifiedChecks().
| void CheckClass::operatorEqRetRefThisError | ( | const Token * | tok | ) | [private] |
Definition at line 1095 of file checkclass.cpp.
References Check::reportError(), and Severity::style.
Referenced by checkReturnPtrThis(), and getErrorMessages().
| void CheckClass::operatorEqReturnError | ( | const Token * | tok, |
| const std::string & | className | ||
| ) | [private] |
Definition at line 1008 of file checkclass.cpp.
References Check::reportError(), and Severity::style.
Referenced by getErrorMessages(), and operatorEq().
| void CheckClass::operatorEqToSelf | ( | ) |
'operator=' should check for assignment to self
Definition at line 1114 of file checkclass.cpp.
References Check::_settings, SymbolDatabase::classAndStructScopes, Scope::className, Scope::definedType, Type::derivedFrom, Function::eOperatorEqual, Scope::functionList, hasAllocation(), hasAssignSelf(), Settings::isEnabled(), Token::Match(), operatorEqToSelfError(), Token::previous(), Token::str(), and symbolDatabase.
Referenced by runSimplifiedChecks().
| void CheckClass::operatorEqToSelfError | ( | const Token * | tok | ) | [private] |
Definition at line 1215 of file checkclass.cpp.
References Check::reportError(), and Severity::warning.
Referenced by getErrorMessages(), and operatorEqToSelf().
| void CheckClass::operatorEqVarError | ( | const Token * | tok, |
| const std::string & | classname, | ||
| const std::string & | varname, | ||
| bool | inconclusive | ||
| ) | [private] |
Definition at line 671 of file checkclass.cpp.
References Check::reportError(), and Severity::warning.
Referenced by constructors(), and getErrorMessages().
| void CheckClass::privateFunctions | ( | ) |
Check that all private functions are called
Definition at line 766 of file checkclass.cpp.
References Check::_settings, checkFunctionUsage(), SymbolDatabase::classAndStructScopes, Scope::classEnd, Scope::className, Scope::classStart, Scope::definedType, Type::derivedFrom, Function::eFunction, Token::findsimplematch(), Type::friendList, Scope::functionList, Settings::isEnabled(), Private, symbolDatabase, and unusedPrivateFunctionError().
Referenced by runSimplifiedChecks().
| void CheckClass::runChecks | ( | const Tokenizer * | tokenizer, |
| const Settings * | settings, | ||
| ErrorLogger * | errorLogger | ||
| ) | [inline, virtual] |
Run checks on the normal token list.
Reimplemented from Check.
Definition at line 46 of file checkclass.h.
References Tokenizer::isC(), and noMemset().
| void CheckClass::runSimplifiedChecks | ( | const Tokenizer * | tokenizer, |
| const Settings * | settings, | ||
| ErrorLogger * | errorLogger | ||
| ) | [inline, virtual] |
Run checks on the simplified token list.
Implements Check.
Definition at line 57 of file checkclass.h.
References checkConst(), constructors(), copyconstructors(), initializationListUsage(), initializerListOrder(), Tokenizer::isC(), operatorEq(), operatorEqRetRefThis(), operatorEqToSelf(), privateFunctions(), thisSubtraction(), and virtualDestructor().
| void CheckClass::suggestInitializationList | ( | const Token * | tok, |
| const std::string & | varname | ||
| ) | [private] |
Definition at line 728 of file checkclass.cpp.
References Severity::performance, and Check::reportError().
Referenced by getErrorMessages(), and initializationListUsage().
| void CheckClass::thisSubtraction | ( | ) |
warn for "this-x".
The indented code may be "this->x"
Definition at line 1353 of file checkclass.cpp.
References Check::_settings, Check::_tokenizer, Token::findmatch(), Settings::isEnabled(), Token::next(), Token::strAt(), thisSubtractionError(), and Tokenizer::tokens().
Referenced by runSimplifiedChecks().
| void CheckClass::thisSubtractionError | ( | const Token * | tok | ) | [private] |
Definition at line 1371 of file checkclass.cpp.
References Check::reportError(), and Severity::warning.
Referenced by getErrorMessages(), and thisSubtraction().
| void CheckClass::uninitVarError | ( | const Token * | tok, |
| const std::string & | classname, | ||
| const std::string & | varname, | ||
| bool | inconclusive | ||
| ) | [private] |
Definition at line 666 of file checkclass.cpp.
References Check::reportError(), and Severity::warning.
Referenced by constructors(), and getErrorMessages().
| void CheckClass::unusedPrivateFunctionError | ( | const Token * | tok, |
| const std::string & | classname, | ||
| const std::string & | funcname | ||
| ) | [private] |
Definition at line 816 of file checkclass.cpp.
References Check::reportError(), and Severity::style.
Referenced by getErrorMessages(), and privateFunctions().
| void CheckClass::virtualDestructor | ( | ) |
The destructor in a base class should be virtual.
Definition at line 1227 of file checkclass.cpp.
References Check::_tokenizer, Function::access, SymbolDatabase::classAndStructScopes, Type::classDef, Scope::classDef, Type::classScope, Scope::definedType, Type::derivedFrom, Scope::getDestructor(), SymbolDatabase::getVariableFromVarId(), SymbolDatabase::getVariableListSize(), Function::hasBody, Variable::isPointer(), Function::isVirtual, Token::linkAt(), Token::Match(), Type::name(), Token::next(), Private, Public, Token::simpleMatch(), Token::str(), symbolDatabase, Token::tokAt(), Function::token, Tokenizer::tokens(), Variable::type(), Variable::varId(), and virtualDestructorError().
Referenced by runSimplifiedChecks().
| void CheckClass::virtualDestructorError | ( | const Token * | tok, |
| const std::string & | Base, | ||
| const std::string & | Derived | ||
| ) | [private] |
Definition at line 1340 of file checkclass.cpp.
References Severity::error, and Check::reportError().
Referenced by getErrorMessages(), and virtualDestructor().
const SymbolDatabase* CheckClass::symbolDatabase [private] |
Definition at line 122 of file checkclass.h.
Referenced by checkConst(), constructors(), copyconstructors(), initializationListUsage(), initializerListOrder(), isMemberVar(), noMemset(), operatorEq(), operatorEqRetRefThis(), operatorEqToSelf(), privateFunctions(), and virtualDestructor().
1.7.6.1