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. More... | |
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... | |
Static Public Attributes | |
static const std::set< std::string > | stl_containers_not_const = { "map", "unordered_map", "std :: map|unordered_map <" } |
Set of the STL types whose operator[] is not const. More... | |
Private Types | |
enum class | Bool { TRUE , FALSE , BAILOUT } |
enum class | MemberAccess { NONE , SELF , MEMBER } |
Private Member Functions | |
CheckClass (const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) | |
This constructor is used when running checks. More... | |
void | runChecks (const Tokenizer &tokenizer, ErrorLogger *errorLogger) override |
Run checks on the normal token list. More... | |
void | constructors () |
Check that all class constructors are ok More... | |
void | checkExplicitConstructors () |
Check that constructors with single parameter are explicit, if they has to be. More... | |
void | privateFunctions () |
Check that all private functions are called More... | |
void | checkMemset () |
Check that the memsets are valid. More... | |
void | checkMemsetType (const Scope *start, const Token *tok, const Scope *type, bool allocation, std::set< const Scope * > parsedTypes) |
void | operatorEqRetRefThis () |
'operator=' should return reference to *this More... | |
void | operatorEqToSelf () |
'operator=' should check for assignment to self More... | |
void | virtualDestructor () |
The destructor in a base class should be virtual. More... | |
void | thisSubtraction () |
warn for "this-x". More... | |
void | checkConst () |
can member function be const? More... | |
void | initializerListOrder () |
Check initializer list order. More... | |
void | initializationListUsage () |
Suggest using initialization list. More... | |
void | checkSelfInitialization () |
Check for initialization of a member with itself. More... | |
void | copyconstructors () |
void | checkVirtualFunctionCallInConstructor () |
call of virtual function in constructor/destructor More... | |
void | checkDuplInheritedMembers () |
Check duplicated inherited members. More... | |
void | checkCopyCtorAndEqOperator () |
Check that copy constructor and operator defined together. More... | |
void | checkOverride () |
Check that the override keyword is used when overriding virtual functions. More... | |
void | checkUselessOverride () |
Check that the overriden function is not identical to the base function. More... | |
void | checkReturnByReference () |
Check that large members are returned by reference from getter function. More... | |
void | checkThisUseAfterFree () |
When "self pointer" is destroyed, 'this' might become invalid. More... | |
void | checkUnsafeClassRefMember () |
Unsafe class check - const reference member. More... | |
Check::FileInfo * | getFileInfo (const Tokenizer &tokenizer, const Settings &settings) const override |
Parse current TU and extract file info. More... | |
Check::FileInfo * | loadFileInfoFromXml (const tinyxml2::XMLElement *xmlElement) const override |
bool | analyseWholeProgram (const CTU::FileInfo *ctu, const std::list< Check::FileInfo * > &fileInfo, const Settings &settings, ErrorLogger &errorLogger) override |
Analyse all file infos for all TU. More... | |
void | noConstructorError (const Token *tok, const std::string &classname, bool isStruct) |
void | noExplicitConstructorError (const Token *tok, const std::string &classname, bool isStruct) |
void | copyConstructorShallowCopyError (const Token *tok, const std::string &varname) |
void | noCopyConstructorError (const Scope *scope, bool isdefault, const Token *alloc, bool inconclusive) |
void | noOperatorEqError (const Scope *scope, bool isdefault, const Token *alloc, bool inconclusive) |
void | noDestructorError (const Scope *scope, bool isdefault, const Token *alloc) |
void | uninitVarError (const Token *tok, bool isprivate, Function::Type functionType, const std::string &classname, const std::string &varname, bool derived, bool inconclusive) |
void | uninitVarError (const Token *tok, const std::string &classname, const std::string &varname) |
void | missingMemberCopyError (const Token *tok, Function::Type functionType, const std::string &classname, const std::string &varname) |
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, bool isContainer=false) |
void | memsetErrorReference (const Token *tok, const std::string &memfunc, const std::string &type) |
void | memsetErrorFloat (const Token *tok, 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 | virtualDestructorError (const Token *tok, const std::string &Base, const std::string &Derived, bool inconclusive) |
void | thisSubtractionError (const Token *tok) |
void | operatorEqRetRefThisError (const Token *tok) |
void | operatorEqShouldBeLeftUnimplementedError (const Token *tok) |
void | operatorEqMissingReturnStatementError (const Token *tok, bool error) |
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, const std::string &argname={}) |
void | suggestInitializationList (const Token *tok, const std::string &varname) |
void | selfInitializationError (const Token *tok, const std::string &varname) |
void | pureVirtualFunctionCallInConstructorError (const Function *scopeFunction, const std::list< const Token * > &tokStack, const std::string &purefuncname) |
void | virtualFunctionCallInConstructorError (const Function *scopeFunction, const std::list< const Token * > &tokStack, const std::string &funcname) |
void | duplInheritedMembersError (const Token *tok1, const Token *tok2, const std::string &derivedName, const std::string &baseName, const std::string &memberName, bool derivedIsStruct, bool baseIsStruct, bool isFunction=false) |
void | copyCtorAndEqOperatorError (const Token *tok, const std::string &classname, bool isStruct, bool hasCopyCtor) |
void | overrideError (const Function *funcInBase, const Function *funcInDerived) |
void | uselessOverrideError (const Function *funcInBase, const Function *funcInDerived, bool isSameCode=false) |
void | returnByReferenceError (const Function *func, const Variable *var) |
void | thisUseAfterFree (const Token *self, const Token *free, const Token *use) |
void | unsafeClassRefMemberError (const Token *tok, const std::string &varname) |
void | checkDuplInheritedMembersRecursive (const Type *typeCurrent, const Type *typeBase) |
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... | |
void | checkReturnPtrThis (const Scope *scope, const Function *func, const Token *tok, const Token *last) |
void | checkReturnPtrThis (const Scope *scope, const Function *func, const Token *tok, const Token *last, std::set< const Function * > &analyzedFunctions) |
bool | hasAllocation (const Function *func, const Scope *scope) const |
bool | hasAllocation (const Function *func, const Scope *scope, const Token *start, const Token *end) const |
bool | hasAllocationInIfScope (const Function *func, const Scope *scope, const Token *ifStatementScopeStart) const |
bool | isMemberVar (const Scope *scope, const Token *tok) const |
bool | checkConstFunc (const Scope *scope, const Function *func, MemberAccess &memberAccessed) const |
void | initializeVarList (const Function &func, std::list< const Function * > &callstack, const Scope *scope, std::vector< Usage > &usage) const |
parse a scope for a constructor or member function and set the "init" flags in the provided varlist More... | |
const std::list< const Token * > & | getVirtualFunctionCalls (const Function &function, std::map< const Function *, std::list< const Token * >> &virtualFunctionCallsMap) |
gives a list of tokens where virtual functions are called directly or indirectly More... | |
bool | checkThisUseAfterFreeRecursive (const Scope *classScope, const Function *func, const Variable *selfPointer, std::set< const Function * > callstack, const Token *&freeToken) |
Helper for checkThisUseAfterFree. More... | |
Static Private Member Functions | |
static std::string | myName () |
static bool | hasAssignSelf (const Function *func, const Token *rhs, const Token *&out_ifStatementScopeStart) |
static Bool | isInverted (const Token *tok, const Token *rhs) |
static const Token * | getIfStmtBodyStart (const Token *tok, const Token *rhs) |
static bool | isMemberFunc (const Scope *scope, const Token *tok) |
static bool | isConstMemberFunc (const Scope *scope, const Token *tok) |
static bool | isBaseClassMutableMemberFunc (const Token *tok, const Scope *scope) |
static std::vector< Usage > | createUsageList (const Scope *scope) |
Create usage list that contains all scope members and also members of base classes without constructors. More... | |
static void | assignVar (std::vector< Usage > &usageList, nonneg int varid) |
assign a variable in the varlist More... | |
static void | assignVar (std::vector< Usage > &usageList, const Token *vartok) |
assign a variable in the varlist More... | |
static void | initVar (std::vector< Usage > &usageList, nonneg int varid) |
initialize a variable in the varlist More... | |
static void | assignAllVar (std::vector< Usage > &usageList) |
set all variables in list assigned More... | |
static void | assignAllVarsVisibleFromScope (std::vector< Usage > &usageList, const Scope *scope) |
set all variable in list assigned, if visible from given scope More... | |
static void | clearAllVar (std::vector< Usage > &usageList) |
set all variables in list not assigned and not initialized More... | |
static void | getFirstVirtualFunctionCallStack (std::map< const Function *, std::list< const Token * >> &virtualFunctionCallsMap, const Token *callToken, std::list< const Token * > &pureFuncStack) |
looks for the first virtual function call stack More... | |
static bool | canNotCopy (const Scope *scope) |
static bool | canNotMove (const Scope *scope) |
Private Attributes | |
const SymbolDatabase * | mSymbolDatabase {} |
Friends | |
class | TestClass |
class | TestConstructors |
class | TestUnusedPrivateFunction |
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 {} |
Check classes.
Uninitialized member variables, non-conforming operators, missing virtual destructor, etc
Definition at line 52 of file checkclass.h.
|
strongprivate |
Enumerator | |
---|---|
TRUE | |
FALSE | |
BAILOUT |
Definition at line 302 of file checkclass.h.
|
strongprivate |
Enumerator | |
---|---|
NONE | |
SELF | |
MEMBER |
Definition at line 310 of file checkclass.h.
|
inline |
This constructor is used when registering the CheckClass.
Definition at line 59 of file checkclass.h.
|
private |
This constructor is used when running checks.
Definition at line 119 of file checkclass.cpp.
|
overrideprivatevirtual |
Analyse all file infos for all TU.
Reimplemented from Check.
Definition at line 3640 of file checkclass.cpp.
References CWE_ONE_DEFINITION_RULE, emptyString, error, Check::logChecker(), normal, and ErrorLogger::reportErr().
|
staticprivate |
set all variables in list assigned
usageList | reference to usage vector |
Definition at line 694 of file checkclass.cpp.
Referenced by initializeVarList().
|
staticprivate |
set all variable in list assigned, if visible from given scope
usageList | reference to usage vector |
scope | scope from which usages must be visible |
Definition at line 700 of file checkclass.cpp.
References Type::classScope, Scope::definedType, Type::derivedFrom, and Type::BaseInfo::type.
Referenced by initializeVarList().
assign a variable in the varlist
usageList | reference to usage vector |
vartok | variable token |
Definition at line 671 of file checkclass.cpp.
References assignVar(), and Token::varId().
assign a variable in the varlist
usageList | reference to usage vector |
varid | id of variable to mark assigned |
Definition at line 662 of file checkclass.cpp.
Referenced by assignVar(), checkConstFunc(), and initializeVarList().
|
staticprivate |
Definition at line 581 of file checkclass.cpp.
References Function::access, Function::eCopyConstructor, Function::eOperatorEqual, Scope::functionList, Function::isConstructor(), Public, and Function::type.
Referenced by constructors().
|
staticprivate |
Definition at line 605 of file checkclass.cpp.
References Function::access, Function::eCopyConstructor, Function::eMoveConstructor, Function::eOperatorEqual, Scope::functionList, Function::isConstructor(), Public, and Function::type.
Referenced by constructors().
|
private |
can member function be const?
Definition at line 2093 of file checkclass.cpp.
References Settings::certainty, checkConstError(), checkConstError2(), checkConstFunc(), SymbolDatabase::classAndStructScopes, Scope::className, SymbolDatabase::debugMessage(), Scope::definedType, Type::derivedFrom, Function::eFunction, Scope::eGlobal, endsWith(), Scope::functionList, Function::hasBody(), Function::hasVirtualSpecifier(), inconclusive, Function::isConst(), SimpleEnableGroup< T >::isEnabled(), Function::isFriend(), Function::isImplicitlyVirtual(), Function::isInline(), Token::isName(), Function::isOperator(), Settings::isPremiumEnabled(), Library::isSmartPointer(), Function::isStatic(), Token::isUpperCaseName(), Settings::library, Check::logChecker(), Token::Match(), MEMBER, Check::mSettings, mSymbolDatabase, Scope::nestedIn, Token::next(), NONE, precedes(), Function::retDef, Function::returnsPointer(), Function::returnsReference(), Settings::severity, Token::str(), style, Function::token, Function::tokenDef, Function::type, Scope::type, and Token::type().
Referenced by runChecks().
|
private |
Definition at line 2602 of file checkclass.cpp.
References checkConstError2().
Referenced by checkConst(), and getErrorMessages().
|
private |
Definition at line 2607 of file checkclass.cpp.
References CWE398, inconclusive, performance, Check::reportError(), and style.
Referenced by checkConst(), and checkConstError().
|
private |
Definition at line 2357 of file checkclass.cpp.
References assignVar(), Token::astOperand1(), Token::astOperand2(), Token::astParent(), Token::astTop(), Scope::bodyEnd, Scope::bodyStart, Type::classScope, ValueType::container, Token::eIncDecOp, Library::Container::END_ITERATOR, Scope::findFunction(), Token::function(), Scope::functionList, Scope::functionMap, Function::functionScope, getArguments(), getFuncTokFromThis(), Library::Container::getYield(), Tokenizer::hasIfdef(), Variable::isArrayOrPointer(), Token::isAssignmentOp(), Variable::isConst(), Function::isConst(), ValueType::isConst(), isConstMemberFunc(), Library::isFunctionConst(), isLikelyStreamRead(), isMemberFunc(), isMemberVar(), Variable::isMutable(), Token::isName(), Variable::isReference(), Variable::isSmartPointer(), Variable::isStlType(), Token::isUnaryOp(), Settings::library, Token::link(), Token::linkAt(), Token::Match(), MEMBER, Check::mSettings, Check::mTokenizer, Variable::nameToken(), Token::next(), nonneg, ValueType::pointer, Token::previous(), previousBeforeAstLeftmostLeaf(), Function::retType, SELF, Token::simpleMatch(), Variable::smartPointerType(), Library::Container::START_ITERATOR, stl_containers_not_const, Token::str(), Token::strAt(), Token::tokAt(), Token::tokType(), Variable::typeScope(), Variable::valueType(), Token::valueType(), Token::variable(), and Token::varId().
Referenced by checkConst().
|
private |
Check that copy constructor and operator defined together.
Definition at line 3086 of file checkclass.cpp.
References SymbolDatabase::classAndStructScopes, Scope::classDef, Scope::className, Type::classScope, copyCtorAndEqOperatorError(), Function::eCopyConstructor, Function::eMoveConstructor, Function::eOperatorEqual, Scope::eStruct, Scope::functionList, Function::getArgumentVar(), Function::hasBody(), SimpleEnableGroup< T >::isEnabled(), Check::mSettings, mSymbolDatabase, NO, Settings::severity, Variable::type(), Function::type, Scope::type, Scope::varlist, warning, WITH_BODY, and WITHOUT_BODY.
Referenced by runChecks().
|
private |
Check duplicated inherited members.
Definition at line 2954 of file checkclass.cpp.
References checkDuplInheritedMembersRecursive(), SimpleEnableGroup< T >::isEnabled(), Settings::isPremiumEnabled(), Check::logChecker(), Check::mSettings, mSymbolDatabase, Settings::severity, SymbolDatabase::typeList, and warning.
Referenced by runChecks().
|
private |
Definition at line 3039 of file checkclass.cpp.
References Type::classScope, duplInheritedMembersError(), Scope::eStruct, getDuplInheritedMemberFunctionsRecursive(), getDuplInheritedMembersRecursive(), Type::name(), and Scope::type.
Referenced by checkDuplInheritedMembers().
|
private |
Check that constructors with single parameter are explicit, if they has to be.
Definition at line 339 of file checkclass.cpp.
References Function::access, Function::argCount(), Function::argumentList, SymbolDatabase::classAndStructScopes, Scope::className, Standards::cpp, Standards::CPP11, Function::eCopyConstructor, Function::eMoveConstructor, Scope::eStruct, Scope::functionList, Function::hasBody(), Function::isConstructor(), Function::isDelete(), SimpleEnableGroup< T >::isEnabled(), Function::isExplicit(), Settings::isPremiumEnabled(), Check::logChecker(), Function::minArgCount(), Check::mSettings, mSymbolDatabase, noExplicitConstructorError(), Scope::numConstructors, Private, Settings::severity, Token::simpleMatch(), Settings::standards, style, Function::templateDef, Function::tokenDef, Function::type, and Scope::type.
Referenced by runChecks().
|
private |
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 1353 of file checkclass.cpp.
References Token::astOperand1(), Token::astOperand2(), Scope::bodyEnd, Scope::bodyStart, Library::AllocFunc::bufferSize, checkMemsetType(), Library::detectContainerOrIterator(), Variable::dimensions(), findFunctionOf(), SymbolDatabase::functionScopes, Library::getAllocFuncInfo(), Library::getReallocFuncInfo(), Variable::getTypeName(), Variable::isArray(), Variable::isArrayOrPointer(), SimpleEnableGroup< T >::isEnabled(), Variable::isPointer(), Settings::library, Check::logChecker(), mallocOnClassWarning(), Token::Match(), memsetError(), Check::mSettings, mSymbolDatabase, Token::next(), Token::nextArgument(), Library::AllocFunc::none, Token::previous(), Token::scope(), Settings::severity, Token::simpleMatch(), Token::str(), Token::strAt(), Token::tokAt(), Token::type(), Variable::typeEndToken(), Variable::typeScope(), Variable::typeStartToken(), Token::variable(), and warning.
Referenced by runChecks().
|
private |
Definition at line 1450 of file checkclass.cpp.
References Scope::classDef, Type::classScope, Scope::definedType, Type::derivedFrom, Scope::functionList, Function::hasVirtualSpecifier(), Variable::isArray(), Variable::isConst(), SimpleEnableGroup< T >::isEnabled(), Variable::isFloatingType(), Variable::isPointer(), Variable::isReference(), Variable::isStatic(), Variable::isStlType(), Settings::library, mallocOnClassError(), Token::Match(), memsetError(), memsetErrorFloat(), memsetErrorReference(), Check::mSettings, Library::podtype(), portability, Settings::severity, Token::str(), Token::tokAt(), Type::BaseInfo::type, Variable::typeEndToken(), Variable::typeScope(), Variable::typeStartToken(), and Scope::varlist.
Referenced by checkMemset().
|
private |
Check that the override keyword is used when overriding virtual functions.
Definition at line 3149 of file checkclass.cpp.
References SymbolDatabase::classAndStructScopes, Standards::cpp, Standards::CPP11, Scope::definedType, Type::derivedFrom, Scope::functionList, Function::getOverriddenFunction(), Function::hasFinalSpecifier(), Function::hasOverrideSpecifier(), SimpleEnableGroup< T >::isEnabled(), Settings::isPremiumEnabled(), Check::logChecker(), Check::mSettings, mSymbolDatabase, overrideError(), Settings::severity, Settings::standards, and style.
Referenced by runChecks().
|
private |
Check that large members are returned by reference from getter function.
Definition at line 3322 of file checkclass.cpp.
References SymbolDatabase::classAndStructScopes, Library::detectContainer(), Scope::functionList, Function::functionScope, getSingleReturnVar(), ValueFlow::getSizeOf(), SimpleEnableGroup< T >::isEnabled(), Function::isImplicitlyVirtual(), Function::isOperator(), Settings::isPremiumEnabled(), Settings::library, Check::logChecker(), Check::mSettings, mSymbolDatabase, performance, Settings::platform, Function::retDef, returnByReferenceError(), Function::returnsPointer(), Function::returnsReference(), Function::returnsStandardType(), Settings::severity, and Platform::sizeof_pointer.
Referenced by runChecks().
|
private |
Definition at line 1590 of file checkclass.cpp.
Referenced by checkReturnPtrThis(), and operatorEqRetRefThis().
|
private |
Definition at line 1596 of file checkclass.cpp.
References Function::access, Function::argDef, Token::astOperand1(), checkReturnPtrThis(), Scope::className, Function::eFunction, Scope::functionList, isLambdaCaptureList(), Library::isScopeNoReturn(), Token::isUnaryOp(), Settings::library, Token::link(), Token::linkAt(), Token::Match(), Check::mSettings, Token::next(), operatorEqMissingReturnStatementError(), operatorEqRetRefThisError(), operatorEqShouldBeLeftUnimplementedError(), Public, Token::simpleMatch(), Token::str(), Token::strAt(), Token::tokAt(), and Function::token.
|
private |
Check for initialization of a member with itself.
Definition at line 2744 of file checkclass.cpp.
References Token::astParent(), Scope::bodyStart, Scope::function, SymbolDatabase::functionScopes, Token::link(), Check::logChecker(), Token::Match(), mSymbolDatabase, Token::next(), selfInitializationError(), Token::str(), and Token::varId().
Referenced by runChecks().
|
private |
When "self pointer" is destroyed, 'this' might become invalid.
Definition at line 3367 of file checkclass.cpp.
References Scope::bodyEnd, Scope::bodyStart, checkThisUseAfterFreeRecursive(), SymbolDatabase::classAndStructScopes, Variable::declarationId(), Scope::definedType, Scope::functionList, Function::functionScope, Function::hasBody(), SimpleEnableGroup< T >::isEnabled(), Variable::isStatic(), Check::logChecker(), Token::Match(), Check::mSettings, mSymbolDatabase, Token::next(), ValueType::parseDecl(), Settings::severity, ValueType::smartPointerType, Function::type, ValueType::typeScope, Variable::typeStartToken(), Variable::valueType(), Scope::varlist, and warning.
Referenced by runChecks().
|
private |
Helper for checkThisUseAfterFree.
Definition at line 3416 of file checkclass.cpp.
References Scope::bodyEnd, Scope::bodyStart, Scope::function, Function::functionScope, Function::isStatic(), Token::Match(), Variable::nameToken(), Token::next(), thisUseAfterFree(), and Token::tokAt().
Referenced by checkThisUseAfterFree().
|
private |
Unsafe class check - const reference member.
Definition at line 3467 of file checkclass.cpp.
References SymbolDatabase::classAndStructScopes, Settings::SafeChecks::classes, Scope::className, Function::constructorMemberInitialization(), Scope::functionList, Function::hasBody(), Variable::isArgument(), Variable::isConst(), Function::isConstructor(), SimpleEnableGroup< T >::isEnabled(), Variable::isReference(), Token::linkAt(), Check::logChecker(), Token::Match(), Check::mSettings, mSymbolDatabase, Variable::name(), Token::next(), Settings::safeChecks, Settings::severity, Token::tokAt(), unsafeClassRefMemberError(), Token::variable(), and warning.
Referenced by runChecks().
|
private |
Check that the overriden function is not identical to the base function.
Definition at line 3251 of file checkclass.cpp.
References Function::access, Function::argDef, Scope::bodyEnd, Scope::bodyStart, SymbolDatabase::classAndStructScopes, compareTokenRanges(), Scope::definedType, Type::derivedFrom, Scope::functionList, Function::functionScope, getArguments(), getDuplInheritedMemberFunctionsRecursive(), getDuplInheritedMembersRecursive(), Function::getOverriddenFunction(), getSingleFunctionCall(), Function::hasFinalSpecifier(), SimpleEnableGroup< T >::isEnabled(), Token::isExpandedMacro(), Settings::isPremiumEnabled(), Function::isPure(), Token::link(), Check::logChecker(), Check::mSettings, mSymbolDatabase, Settings::severity, style, Function::token, Function::tokenDef, and uselessOverrideError().
Referenced by runChecks().
|
private |
call of virtual function in constructor/destructor
Definition at line 2783 of file checkclass.cpp.
References Scope::classDef, Scope::function, SymbolDatabase::functionScopes, getFirstVirtualFunctionCallStack(), getVirtualFunctionCalls(), Function::hasBody(), Function::hasFinalSpecifier(), Function::hasOverrideSpecifier(), Function::hasVirtualSpecifier(), Function::isConstructor(), Function::isDestructor(), SimpleEnableGroup< T >::isEnabled(), Token::isFinalType(), Function::isPure(), Check::logChecker(), Check::mSettings, mSymbolDatabase, Function::nestedIn, pureVirtualFunctionCallInConstructorError(), Settings::severity, virtualFunctionCallInConstructorError(), and warning.
Referenced by runChecks().
|
inlineoverrideprivatevirtual |
get information about this class, used to generate documentation
Implements Check.
Definition at line 267 of file checkclass.h.
|
staticprivate |
set all variables in list not assigned and not initialized
usageList | reference to usage vector |
Definition at line 716 of file checkclass.cpp.
Referenced by constructors().
|
private |
Check that all class constructors are ok
Definition at line 128 of file checkclass.cpp.
References Function::access, Function::arg, Function::argCount(), bailout, Scope::bodyStart, canNotCopy(), canNotMove(), Settings::certainty, SymbolDatabase::classAndStructScopes, Scope::classDef, Scope::className, clearAllVar(), Function::constructorMemberInitialization(), ValueType::containerTypeToken, Standards::cpp, Standards::CPP11, createUsageList(), Scope::definedType, Type::derivedFrom, Function::eConstructor, Function::eCopyConstructor, Function::eMoveConstructor, Token::eName, Function::eOperatorEqual, Scope::eUnion, Type::False, Scope::functionList, Function::functionScope, Library::getTypeCheck(), Variable::getTypeName(), Function::hasBody(), Variable::hasDefault(), Settings::hasLib(), inconclusive, initializeVarList(), Variable::isClass(), Variable::isConst(), Function::isConstructor(), Function::isDefault(), SimpleEnableGroup< T >::isEnabled(), Variable::isInit(), Function::isOperator(), Variable::isPointer(), Variable::isPointerArray(), Settings::isPremiumEnabled(), Variable::isPrivate(), Token::isStandardType(), Variable::isStatic(), Variable::isStlType(), isVariableCopyNeeded(), isVclTypeInit(), Settings::library, Token::link(), Check::logChecker(), Token::Match(), missingMemberCopyError(), Check::mSettings, mSymbolDatabase, Variable::name(), Variable::nameToken(), Type::needInitialization, Function::nestedIn, Scope::nestedIn, Scope::nestedList, Token::next(), noConstructorError(), Scope::numConstructors, Scope::numCopyOrMoveConstructors, operatorEqVarError(), Library::podtype(), ValueType::pointer, precedes(), Token::previous(), Private, Variable::scope(), Token::scope(), SymbolDatabase::scopeList, Settings::severity, Token::simpleMatch(), Settings::standards, Token::str(), style, Library::suppress, Function::token, Function::tokenDef, Token::tokType(), Type::True, Variable::type(), Function::type, Scope::type, Token::type(), Variable::typeScope(), uninitVarError(), Variable::valueType(), Scope::varlist, and warning.
Referenced by runChecks().
|
private |
Definition at line 408 of file checkclass.cpp.
References Scope::bodyEnd, Scope::bodyStart, SymbolDatabase::classAndStructScopes, copyConstructorShallowCopyError(), Type::derivedFrom, Function::eConstructor, Function::eCopyConstructor, Function::eDestructor, Function::eOperatorEqual, Scope::functionList, Function::functionScope, Library::getAllocFuncInfo(), Library::getReallocFuncInfo(), hasNonCopyableBase(), Token::isCpp(), Function::isDefault(), SimpleEnableGroup< T >::isEnabled(), Variable::isPointer(), Variable::isStatic(), Settings::library, Token::linkAt(), Check::logChecker(), Token::Match(), Check::mSettings, mSymbolDatabase, Token::next(), noCopyConstructorError(), noDestructorError(), noOperatorEqError(), Variable::scope(), Settings::severity, Token::str(), Token::tokAt(), Function::token, Function::tokenDef, Variable::type(), Function::type, Variable::typeScope(), Token::variable(), Token::varId(), and warning.
Referenced by runChecks().
|
private |
Definition at line 540 of file checkclass.cpp.
References CWE398, normal, Check::reportError(), and warning.
Referenced by copyconstructors(), and getErrorMessages().
|
private |
Definition at line 3139 of file checkclass.cpp.
References Function::eCopyConstructor, Function::eOperatorEqual, getFunctionTypeName(), Check::reportError(), and warning.
Referenced by checkCopyCtorAndEqOperator(), and getErrorMessages().
|
staticprivate |
Create usage list that contains all scope members and also members of base classes without constructors.
scope | current class scope |
Definition at line 650 of file checkclass.cpp.
References getAllVariableMembers().
Referenced by constructors().
|
private |
Definition at line 3058 of file checkclass.cpp.
References CWE398, normal, Check::reportError(), and warning.
Referenced by checkDuplInheritedMembersRecursive(), and getErrorMessages().
|
inlineoverrideprivatevirtual |
get error messages
Implements Check.
Definition at line 220 of file checkclass.h.
References checkConstError(), copyConstructorShallowCopyError(), copyCtorAndEqOperatorError(), duplInheritedMembersError(), Function::eConstructor, emptyString, initializerListError(), mallocOnClassError(), mallocOnClassWarning(), memsetError(), memsetErrorFloat(), memsetErrorReference(), missingMemberCopyError(), noConstructorError(), noCopyConstructorError(), noDestructorError(), noExplicitConstructorError(), noOperatorEqError(), operatorEqMissingReturnStatementError(), operatorEqRetRefThisError(), operatorEqShouldBeLeftUnimplementedError(), operatorEqToSelfError(), operatorEqVarError(), overrideError(), pureVirtualFunctionCallInConstructorError(), returnByReferenceError(), selfInitializationError(), suggestInitializationList(), thisSubtractionError(), thisUseAfterFree(), uninitVarError(), unsafeClassRefMemberError(), unusedPrivateFunctionError(), uselessOverrideError(), virtualDestructorError(), and virtualFunctionCallInConstructorError().
|
overrideprivatevirtual |
Parse current TU and extract file info.
Reimplemented from Check.
Definition at line 3543 of file checkclass.cpp.
References Scope::bodyEnd, Scope::bodyStart, SymbolDatabase::classAndStructScopes, Scope::classDef, Scope::className, TokenList::file(), Function::functionScope, Tokenizer::getSymbolDatabase(), Scope::isClassOrStruct(), Tokenizer::isCPP(), Tokenizer::list, Token::Match(), Check::name(), Scope::nestedIn, Token::next(), Token::simpleMatch(), and Scope::type.
|
staticprivate |
looks for the first virtual function call stack
virtualFunctionCallsMap | map of results obtained from getVirtualFunctionCalls | |
callToken | token where pure virtual function is called directly or indirectly | |
[in,out] | pureFuncStack | list to append the stack |
Definition at line 2871 of file checkclass.cpp.
References Token::function(), Function::hasBody(), Function::isImplicitlyVirtual(), Function::isPure(), and Function::tokenDef.
Referenced by checkVirtualFunctionCallInConstructor().
Definition at line 1846 of file checkclass.cpp.
References Token::astParent(), Token::astTop(), BAILOUT, FALSE, isInverted(), Token::link(), Token::simpleMatch(), and TRUE.
|
private |
gives a list of tokens where virtual functions are called directly or indirectly
function | function to be checked |
virtualFunctionCallsMap | map of results for already checked functions |
Definition at line 2813 of file checkclass.cpp.
References Function::eConstructor, Function::eCopyConstructor, Function::eDestructor, Scope::eLambda, Function::eMoveConstructor, Library::ignorefunction(), Function::isImplicitlyVirtual(), Function::isPure(), Settings::library, Token::link(), Token::Match(), Check::mSettings, Function::nestedIn, Token::previous(), Token::simpleMatch(), and Token::str().
Referenced by checkVirtualFunctionCallInConstructor().
Definition at line 1766 of file checkclass.cpp.
References Scope::bodyEnd, Scope::bodyStart, and Function::functionScope.
Referenced by hasAllocationInIfScope(), and operatorEqToSelf().
|
private |
Definition at line 1771 of file checkclass.cpp.
References Scope::bodyEnd, Function::functionScope, Library::getAllocFuncInfo(), Library::getDeallocFuncInfo(), isMemberVar(), Settings::library, Token::Match(), Check::mSettings, Token::next(), Token::tokAt(), and Token::varId().
|
private |
Definition at line 1756 of file checkclass.cpp.
References Scope::bodyEnd, Function::functionScope, hasAllocation(), Token::link(), and Token::str().
Referenced by operatorEqToSelf().
|
staticprivate |
Definition at line 1862 of file checkclass.cpp.
References Scope::bodyEnd, Scope::bodyStart, done, Function::functionScope, Token::next(), op1_and_op2, Token::simpleMatch(), and visitAstNodes().
Referenced by operatorEqToSelf().
|
private |
Suggest using initialization list.
Definition at line 1136 of file checkclass.cpp.
References Scope::bodyEnd, Scope::bodyStart, Scope::className, Function::constructorMemberInitialization(), done, Token::findExpressionStartEndTokens(), findLambdaEndToken(), Scope::function, Scope::functionOf, SymbolDatabase::functionScopes, Function::isConstructor(), SimpleEnableGroup< T >::isEnabled(), Variable::isEnumType(), isMemberFunc(), Variable::isPointer(), Variable::isReference(), Variable::isStatic(), Check::logChecker(), Token::Match(), Check::mSettings, mSymbolDatabase, Token::next(), op1_and_op2, performance, Variable::scope(), Settings::severity, Token::str(), Token::strAt(), suggestInitializationList(), Token::tokAt(), ValueType::type, Variable::valueType(), visitAstNodes(), and WRONG_DATA.
Referenced by runChecks().
|
private |
Definition at line 2723 of file checkclass.cpp.
References CWE398, inconclusive, Check::reportError(), and style.
Referenced by getErrorMessages(), and initializerListOrder().
|
private |
Check initializer list order.
Definition at line 2648 of file checkclass.cpp.
References Token::astParent(), Settings::certainty, SymbolDatabase::classAndStructScopes, Scope::className, Scope::functionList, Scope::getVariable(), inconclusive, initializerListError(), SimpleEnableGroup< T >::isEnabled(), Variable::isPointer(), Settings::isPremiumEnabled(), Variable::isReference(), Token::link(), Token::linkAt(), Check::logChecker(), Token::Match(), Check::mSettings, mSymbolDatabase, Token::next(), Settings::severity, Token::simpleMatch(), Token::str(), style, and Token::variable().
Referenced by runChecks().
|
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 751 of file checkclass.cpp.
References Function::arg, assignAllVar(), assignAllVarsVisibleFromScope(), assignVar(), astIsRangeBasedForDecl(), Token::astParent(), bailout, Scope::bodyEnd, Type::classScope, Scope::definedType, Function::eOperatorEqual, Type::friendList, Token::function(), Function::functionScope, Function::hasBody(), initVar(), isBaseClassMutableMemberFunc(), Function::isConst(), Function::isConstructor(), isLikelyStreamRead(), Function::isStatic(), isVariableChangedByFunctionCall(), Token::link(), Token::linkAt(), Token::Match(), Check::mSettings, Function::name(), Function::nestedIn, Token::next(), ValueType::pointer, Token::previous(), Token::simpleMatch(), Token::str(), Token::strAt(), Token::tokAt(), Function::tokenDef, Function::type, Token::valueType(), Token::variable(), Token::varId(), and Scope::varlist.
Referenced by constructors().
initialize a variable in the varlist
usageList | reference to usage vector |
varid | id of variable to mark initialized |
Definition at line 685 of file checkclass.cpp.
Referenced by initializeVarList().
|
staticprivate |
Definition at line 724 of file checkclass.cpp.
References Type::classScope, Scope::definedType, Type::derivedFrom, Scope::functionList, and Type::BaseInfo::type.
Referenced by initializeVarList().
Definition at line 2330 of file checkclass.cpp.
References Type::classScope, Scope::definedType, Type::derivedFrom, Token::function(), and Type::BaseInfo::type.
Referenced by checkConstFunc().
|
staticprivate |
Definition at line 1817 of file checkclass.cpp.
References BAILOUT, FALSE, isFalseKeyword(), isTrueKeyword(), Token::simpleMatch(), Token::str(), and TRUE.
Referenced by getIfStmtBodyStart().
Definition at line 2289 of file checkclass.cpp.
References Function::argCount(), Type::classScope, Scope::definedType, Type::derivedFrom, Token::function(), Scope::functionList, Function::isVariadic(), Function::minArgCount(), Function::name(), Token::nextArgument(), Token::str(), Token::tokAt(), and Type::BaseInfo::type.
Referenced by checkConstFunc(), and initializationListUsage().
Definition at line 2214 of file checkclass.cpp.
References Scope::className, Type::classScope, SymbolDatabase::debugMessage(), Scope::definedType, Type::derivedFrom, getFuncTokFromThis(), Token::isKeyword(), Token::isStandardType(), Variable::isStatic(), Token::link(), Token::linkAt(), Token::Match(), mSymbolDatabase, Variable::name(), Scope::nestedIn, Token::previous(), Token::simpleMatch(), Token::str(), Token::strAt(), Token::tokAt(), Type::BaseInfo::type, Scope::type, Token::varId(), and Scope::varlist.
Referenced by checkConstFunc(), and hasAllocation().
|
overrideprivatevirtual |
|
private |
Definition at line 1526 of file checkclass.cpp.
References CWE665, error, normal, and Check::reportError().
Referenced by checkMemsetType(), and getErrorMessages().
|
private |
Definition at line 1516 of file checkclass.cpp.
References CWE762, normal, Check::reportError(), and warning.
Referenced by checkMemset(), and getErrorMessages().
|
private |
Definition at line 1537 of file checkclass.cpp.
References CWE762, error, normal, and Check::reportError().
Referenced by checkMemset(), checkMemsetType(), and getErrorMessages().
|
private |
Definition at line 1556 of file checkclass.cpp.
References CWE758, normal, portability, and Check::reportError().
Referenced by checkMemsetType(), and getErrorMessages().
|
private |
Definition at line 1549 of file checkclass.cpp.
References CWE665, error, normal, and Check::reportError().
Referenced by checkMemsetType(), and getErrorMessages().
|
private |
Definition at line 1117 of file checkclass.cpp.
References CWE398, inconclusive, Check::reportError(), and warning.
Referenced by constructors(), and getErrorMessages().
|
inlinestaticprivate |
Definition at line 263 of file checkclass.h.
|
private |
Definition at line 1079 of file checkclass.cpp.
References CWE398, normal, Check::reportError(), and style.
Referenced by constructors(), and getErrorMessages().
|
private |
Definition at line 566 of file checkclass.cpp.
References CWE398, inconclusive, noMemberErrorMessage(), normal, Check::reportError(), and warning.
Referenced by copyconstructors(), and getErrorMessages().
|
private |
Definition at line 576 of file checkclass.cpp.
References CWE398, noMemberErrorMessage(), normal, Check::reportError(), and warning.
Referenced by copyconstructors(), and getErrorMessages().
|
private |
Definition at line 1087 of file checkclass.cpp.
References CWE398, normal, Check::reportError(), and style.
Referenced by checkExplicitConstructors(), and getErrorMessages().
|
private |
Definition at line 571 of file checkclass.cpp.
References CWE398, inconclusive, noMemberErrorMessage(), normal, Check::reportError(), and warning.
Referenced by copyconstructors(), and getErrorMessages().
|
private |
Definition at line 1692 of file checkclass.cpp.
References CWE398, error, normal, operatorEqRetRefThisError(), and Check::reportError().
Referenced by checkReturnPtrThis(), and getErrorMessages().
|
private |
'operator=' should return reference to *this
Definition at line 1571 of file checkclass.cpp.
References Scope::bodyStart, checkReturnPtrThis(), SymbolDatabase::classAndStructScopes, Function::eOperatorEqual, Scope::functionList, SimpleEnableGroup< T >::isEnabled(), Settings::isPremiumEnabled(), Check::logChecker(), Check::mSettings, mSymbolDatabase, Settings::severity, and style.
Referenced by runChecks().
|
private |
Definition at line 1682 of file checkclass.cpp.
References CWE398, normal, Check::reportError(), and style.
Referenced by checkReturnPtrThis(), getErrorMessages(), and operatorEqMissingReturnStatementError().
|
private |
Definition at line 1687 of file checkclass.cpp.
References CWE398, normal, Check::reportError(), and style.
Referenced by checkReturnPtrThis(), and getErrorMessages().
|
private |
'operator=' should check for assignment to self
Definition at line 1715 of file checkclass.cpp.
References Function::argumentList, SymbolDatabase::classAndStructScopes, Scope::className, Scope::definedType, Type::derivedFrom, Function::eOperatorEqual, Scope::functionList, hasAllocation(), hasAllocationInIfScope(), hasAssignSelf(), Function::hasBody(), SimpleEnableGroup< T >::isEnabled(), Settings::isPremiumEnabled(), Check::logChecker(), Token::Match(), Check::mSettings, mSymbolDatabase, operatorEqToSelfError(), Token::previous(), Function::retDef, Settings::severity, Token::str(), Function::token, Function::type, and warning.
Referenced by runChecks().
|
private |
Definition at line 1896 of file checkclass.cpp.
References CWE398, normal, Check::reportError(), and warning.
Referenced by getErrorMessages(), and operatorEqToSelf().
|
private |
Definition at line 1127 of file checkclass.cpp.
References CWE398, inconclusive, normal, Check::reportError(), and warning.
Referenced by constructors(), and getErrorMessages().
|
private |
Definition at line 3169 of file checkclass.cpp.
References CWE, Function::isDestructor(), Function::name(), normal, Check::reportError(), style, and Function::tokenDef.
Referenced by checkOverride(), and getErrorMessages().
|
private |
Check that all private functions are called
Definition at line 1278 of file checkclass.cpp.
References Function::access, Scope::bodyEnd, Scope::bodyStart, checkFunctionUsage(), SymbolDatabase::classAndStructScopes, Scope::className, Scope::definedType, Type::derivedFrom, Function::eFunction, Token::findsimplematch(), Type::friendList, Scope::functionList, SimpleEnableGroup< T >::isEnabled(), Function::isOperator(), Settings::isPremiumEnabled(), Check::logChecker(), Check::mSettings, mSymbolDatabase, Private, Settings::severity, style, Function::type, and unusedPrivateFunctionError().
Referenced by runChecks().
|
private |
Definition at line 2929 of file checkclass.cpp.
References CWE, getFunctionTypeName(), normal, Check::reportError(), Function::type, and warning.
Referenced by checkVirtualFunctionCallInConstructor(), and getErrorMessages().
Definition at line 3360 of file checkclass.cpp.
References Variable::name(), Function::name(), performance, Check::reportError(), and Function::tokenDef.
Referenced by checkReturnByReference(), and getErrorMessages().
|
inlineoverrideprivatevirtual |
Run checks on the normal token list.
Implements Check.
Definition at line 69 of file checkclass.h.
References checkConst(), checkCopyCtorAndEqOperator(), checkDuplInheritedMembers(), checkExplicitConstructors(), checkMemset(), checkOverride(), checkReturnByReference(), checkSelfInitialization(), checkThisUseAfterFree(), checkUnsafeClassRefMember(), checkUselessOverride(), checkVirtualFunctionCallInConstructor(), constructors(), copyconstructors(), Tokenizer::getSettings(), initializationListUsage(), initializerListOrder(), Tokenizer::isC(), operatorEqRetRefThis(), operatorEqToSelf(), privateFunctions(), thisSubtraction(), and virtualDestructor().
|
private |
Definition at line 2773 of file checkclass.cpp.
References CWE665, error, normal, and Check::reportError().
Referenced by checkSelfInitialization(), and getErrorMessages().
|
private |
Definition at line 1216 of file checkclass.cpp.
References CWE398, normal, performance, and Check::reportError().
Referenced by getErrorMessages(), and initializationListUsage().
|
private |
warn for "this-x".
The indented code may be "this->x"
Definition at line 2064 of file checkclass.cpp.
References Token::findmatch(), SimpleEnableGroup< T >::isEnabled(), Check::logChecker(), Check::mSettings, Check::mTokenizer, Token::next(), Settings::severity, Token::strAt(), thisSubtractionError(), Tokenizer::tokens(), and warning.
Referenced by runChecks().
|
private |
Definition at line 2084 of file checkclass.cpp.
References CWE398, normal, Check::reportError(), and warning.
Referenced by getErrorMessages(), and thisSubtraction().
|
private |
Definition at line 3455 of file checkclass.cpp.
References CWE, Token::function(), normal, Check::reportError(), Token::str(), and warning.
Referenced by checkThisUseAfterFreeRecursive(), and getErrorMessages().
|
private |
Definition at line 1094 of file checkclass.cpp.
References CWE398, Function::eCopyConstructor, Function::eMoveConstructor, inconclusive, normal, Check::reportError(), and warning.
Referenced by constructors(), and getErrorMessages().
|
private |
Definition at line 1109 of file checkclass.cpp.
References CWE398, normal, Check::reportError(), and warning.
|
private |
Definition at line 3491 of file checkclass.cpp.
References CWE, normal, Check::reportError(), and warning.
Referenced by checkUnsafeClassRefMember(), and getErrorMessages().
|
private |
Definition at line 1334 of file checkclass.cpp.
References CWE398, normal, Check::reportError(), and style.
Referenced by getErrorMessages(), and privateFunctions().
|
private |
Definition at line 3187 of file checkclass.cpp.
References CWE, Function::isDestructor(), Function::name(), normal, Check::reportError(), style, and Function::tokenDef.
Referenced by checkUselessOverride(), and getErrorMessages().
|
private |
The destructor in a base class should be virtual.
Definition at line 1908 of file checkclass.cpp.
References Type::BaseInfo::access, Function::access, Settings::certainty, SymbolDatabase::classAndStructScopes, Type::classDef, Scope::classDef, Type::classScope, Standards::cpp, Standards::CPP03, Scope::definedType, Type::derivedFrom, emptyString, Scope::functionList, Scope::getDestructor(), Function::hasBody(), Function::hasVirtualSpecifier(), inconclusive, SimpleEnableGroup< T >::isEnabled(), Token::linkAt(), Check::logChecker(), Token::Match(), Check::mSettings, mSymbolDatabase, Check::mTokenizer, Type::name(), Token::next(), Private, Public, Token::simpleMatch(), Settings::standards, Token::str(), Token::tokAt(), Function::token, Tokenizer::tokens(), Type::BaseInfo::type, SymbolDatabase::variableList(), and virtualDestructorError().
Referenced by runChecks().
|
private |
Definition at line 2043 of file checkclass.cpp.
References CWE404, error, inconclusive, SimpleEnableGroup< T >::isEnabled(), Check::mSettings, normal, Check::reportError(), Settings::severity, and warning.
Referenced by getErrorMessages(), and virtualDestructor().
|
private |
Definition at line 2891 of file checkclass.cpp.
References Function::argDef, CWE, getFunctionTypeName(), SimpleEnableGroup< T >::isEnabled(), Settings::isPremiumEnabled(), Token::link(), Token::Match(), Check::mSettings, Token::next(), normal, Token::previous(), Check::reportError(), Settings::severity, Token::str(), style, Function::tokenDef, and Function::type.
Referenced by checkVirtualFunctionCallInConstructor(), and getErrorMessages().
|
friend |
Definition at line 53 of file checkclass.h.
|
friend |
Definition at line 54 of file checkclass.h.
|
friend |
Definition at line 55 of file checkclass.h.
|
private |
Definition at line 178 of file checkclass.h.
Referenced by checkConst(), checkCopyCtorAndEqOperator(), checkDuplInheritedMembers(), checkExplicitConstructors(), checkMemset(), checkOverride(), checkReturnByReference(), checkSelfInitialization(), checkThisUseAfterFree(), checkUnsafeClassRefMember(), checkUselessOverride(), checkVirtualFunctionCallInConstructor(), constructors(), copyconstructors(), initializationListUsage(), initializerListOrder(), isMemberVar(), operatorEqRetRefThis(), operatorEqToSelf(), privateFunctions(), and virtualDestructor().
|
static |
Set of the STL types whose operator[] is not const.
Definition at line 62 of file checkclass.h.
Referenced by checkConstFunc(), and isWithoutSideEffects().