Cppcheck
|
#include "checkclass.h"
#include "astutils.h"
#include "library.h"
#include "settings.h"
#include "standards.h"
#include "symboldatabase.h"
#include "errorlogger.h"
#include "errortypes.h"
#include "platform.h"
#include "token.h"
#include "tokenize.h"
#include "tokenlist.h"
#include "utils.h"
#include "valueflow.h"
#include <algorithm>
#include <cctype>
#include <cstring>
#include <iterator>
#include <utility>
#include <unordered_map>
#include "xml.h"
Go to the source code of this file.
Namespaces | |
CTU | |
Whole program analysis (ctu=Cross Translation Unit) | |
Enumerations | |
enum class | CtorType { NO , WITHOUT_BODY , WITH_BODY } |
Functions | |
static const char * | getFunctionTypeName (Function::Type type) |
static bool | isVariableCopyNeeded (const Variable &var, Function::Type type) |
static bool | isVclTypeInit (const Type *type) |
static bool | hasNonCopyableBase (const Scope *scope, bool *unknown) |
static std::string | noMemberErrorMessage (const Scope *scope, const char function[], bool isdefault) |
static void | getAllVariableMembers (const Scope *scope, std::vector< const Variable * > &varList) |
static bool | checkFunctionUsage (const Function *privfunc, const Scope *scope) |
static const Scope * | findFunctionOf (const Scope *scope) |
static bool | isTrueKeyword (const Token *tok) |
static bool | isFalseKeyword (const Token *tok) |
static const Token * | getFuncTokFromThis (const Token *tok) |
static std::vector< DuplMemberInfo > | getDuplInheritedMembersRecursive (const Type *typeCurrent, const Type *typeBase, bool skipPrivate=true) |
static std::vector< DuplMemberFuncInfo > | getDuplInheritedMemberFunctionsRecursive (const Type *typeCurrent, const Type *typeBase, bool skipPrivate=true) |
static const Token * | getSingleFunctionCall (const Scope *scope) |
static bool | compareTokenRanges (const Token *start1, const Token *end1, const Token *start2, const Token *end2) |
static const Variable * | getSingleReturnVar (const Scope *scope) |
Variables | |
static const CWE | CWE398 (398U) |
static const CWE | CWE404 (404U) |
static const CWE | CWE665 (665U) |
static const CWE | CWE758 (758U) |
static const CWE | CWE762 (762U) |
static const CWE | CWE_ONE_DEFINITION_RULE (758U) |
|
strong |
Enumerator | |
---|---|
NO | |
WITHOUT_BODY | |
WITH_BODY |
Definition at line 3080 of file checkclass.cpp.
Definition at line 1228 of file checkclass.cpp.
References Scope::bodyStart, Type::classScope, Variable::declarationId(), Scope::definedTypesMap, Function::eCopyConstructor, Type::enclosingScope, Function::eOperatorEqual, Token::findmatch(), Token::function(), Scope::functionList, Variable::isStatic(), Token::linkAt(), Token::Match(), Function::name(), Token::next(), Private, Token::str(), Token::tokAt(), and Scope::varlist.
Referenced by CheckClass::privateFunctions().
|
static |
Definition at line 3228 of file checkclass.cpp.
References Token::function(), isEqual(), Token::isExpandedMacro(), Token::next(), and Token::str().
Referenced by CheckClass::checkUselessOverride().
Definition at line 1343 of file checkclass.cpp.
References Scope::eFunction, Scope::functionOf, Scope::nestedIn, and Scope::type.
Referenced by CheckClass::checkMemset().
|
static |
Definition at line 634 of file checkclass.cpp.
References Type::classScope, Scope::definedType, Type::derivedFrom, Scope::isClassOrStruct(), Scope::numConstructors, Type::BaseInfo::type, and Scope::varlist.
Referenced by CheckClass::createUsageList().
|
static |
Definition at line 3008 of file checkclass.cpp.
References Function::access, Function::argDef, Function::argsMatch(), Type::classScope, Type::derivedFrom, emptyString, Scope::functionList, Function::isConst(), Function::isConstructor(), Function::isDelete(), Function::isDestructor(), Function::isImplicitlyVirtual(), Function::name(), Private, Function::returnsConst(), and Type::BaseInfo::type.
Referenced by CheckClass::checkDuplInheritedMembersRecursive(), and CheckClass::checkUselessOverride().
|
static |
Definition at line 2983 of file checkclass.cpp.
References Type::classScope, Type::derivedFrom, Variable::isPrivate(), Variable::name(), Type::BaseInfo::type, and Scope::varlist.
Referenced by CheckClass::checkDuplInheritedMembersRecursive(), and CheckClass::checkUselessOverride().
|
static |
Definition at line 64 of file checkclass.cpp.
References Function::eConstructor, Function::eCopyConstructor, Function::eDestructor, Function::eFunction, Function::eLambda, Function::eMoveConstructor, and Function::eOperatorEqual.
Referenced by CheckClass::copyCtorAndEqOperatorError(), CheckClass::pureVirtualFunctionCallInConstructorError(), and CheckClass::virtualFunctionCallInConstructorError().
Definition at line 2205 of file checkclass.cpp.
References Token::Match(), Token::next(), Token::simpleMatch(), and Token::tokAt().
Referenced by CheckClass::checkConstFunc(), and CheckClass::isMemberVar().
Definition at line 3211 of file checkclass.cpp.
References Token::astOperand1(), Scope::bodyEnd, Scope::bodyStart, Token::findsimplematch(), Token::function(), Token::Match(), Token::next(), Token::previous(), Token::simpleMatch(), and Token::str().
Referenced by CheckClass::checkUselessOverride().
Definition at line 3310 of file checkclass.cpp.
References Token::astOperand1(), Scope::bodyEnd, Scope::bodyStart, Token::findsimplematch(), Token::next(), and Token::str().
Referenced by CheckClass::checkReturnByReference().
|
static |
Definition at line 384 of file checkclass.cpp.
References Function::access, Type::classScope, Scope::definedType, Type::derivedFrom, Function::eCopyConstructor, Scope::functionList, Function::isDelete(), Private, Type::BaseInfo::type, and Function::type.
Referenced by CheckClass::copyconstructors().
|
static |
Definition at line 1808 of file checkclass.cpp.
References Token::getKnownIntValue(), and Token::hasKnownIntValue().
Referenced by CheckClass::isInverted().
|
static |
Definition at line 1803 of file checkclass.cpp.
References Token::getKnownIntValue(), and Token::hasKnownIntValue().
Referenced by CheckClass::isInverted().
|
static |
Definition at line 85 of file checkclass.cpp.
References Function::eCopyConstructor, Function::eMoveConstructor, Function::eOperatorEqual, Variable::hasDefault(), Variable::isPointer(), Type::needInitialization, Type::True, Variable::type(), ValueType::type, and Variable::valueType().
Referenced by CheckClass::constructors().
|
static |
Definition at line 105 of file checkclass.cpp.
References Type::derivedFrom.
Referenced by CheckClass::constructors().
|
static |
Definition at line 546 of file checkclass.cpp.
References Scope::className, Scope::eStruct, and Scope::type.
Referenced by CheckClass::noCopyConstructorError(), CheckClass::noDestructorError(), and CheckClass::noOperatorEqError().
|
static |
Referenced by CheckClass::checkConstError2(), CheckClass::copyConstructorShallowCopyError(), CheckClass::duplInheritedMembersError(), CheckClass::initializerListError(), CheckClass::missingMemberCopyError(), CheckClass::noConstructorError(), CheckClass::noCopyConstructorError(), CheckClass::noDestructorError(), CheckClass::noExplicitConstructorError(), CheckClass::noOperatorEqError(), CheckClass::operatorEqMissingReturnStatementError(), CheckClass::operatorEqRetRefThisError(), CheckClass::operatorEqShouldBeLeftUnimplementedError(), CheckClass::operatorEqToSelfError(), CheckClass::operatorEqVarError(), CheckClass::suggestInitializationList(), CheckClass::thisSubtractionError(), CheckClass::uninitVarError(), and CheckClass::unusedPrivateFunctionError().
|
static |
Referenced by CheckClass::virtualDestructorError().
|
static |
|
static |
Referenced by CheckClass::memsetErrorFloat().
|
static |
Referenced by CheckClass::mallocOnClassWarning(), and CheckClass::memsetError().
|
static |
Referenced by CheckClass::analyseWholeProgram().