Cppcheck
Namespaces | Enumerations | Functions | Variables
checkclass.cpp File Reference
#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 ScopefindFunctionOf (const Scope *scope)
 
static bool isTrueKeyword (const Token *tok)
 
static bool isFalseKeyword (const Token *tok)
 
static const TokengetFuncTokFromThis (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 TokengetSingleFunctionCall (const Scope *scope)
 
static bool compareTokenRanges (const Token *start1, const Token *end1, const Token *start2, const Token *end2)
 
static const VariablegetSingleReturnVar (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)
 

Enumeration Type Documentation

◆ CtorType

enum CtorType
strong
Enumerator
NO 
WITHOUT_BODY 
WITH_BODY 

Definition at line 3080 of file checkclass.cpp.

Function Documentation

◆ checkFunctionUsage()

static bool checkFunctionUsage ( const Function privfunc,
const Scope scope 
)
static

◆ compareTokenRanges()

static bool compareTokenRanges ( const Token start1,
const Token end1,
const Token start2,
const Token end2 
)
static

◆ findFunctionOf()

static const Scope* findFunctionOf ( const Scope scope)
static

Definition at line 1343 of file checkclass.cpp.

References Scope::eFunction, Scope::functionOf, Scope::nestedIn, and Scope::type.

Referenced by CheckClass::checkMemset().

◆ getAllVariableMembers()

static void getAllVariableMembers ( const Scope scope,
std::vector< const Variable * > &  varList 
)
static

◆ getDuplInheritedMemberFunctionsRecursive()

static std::vector<DuplMemberFuncInfo> getDuplInheritedMemberFunctionsRecursive ( const Type typeCurrent,
const Type typeBase,
bool  skipPrivate = true 
)
static

◆ getDuplInheritedMembersRecursive()

static std::vector<DuplMemberInfo> getDuplInheritedMembersRecursive ( const Type typeCurrent,
const Type typeBase,
bool  skipPrivate = true 
)
static

◆ getFunctionTypeName()

static const char* getFunctionTypeName ( Function::Type  type)
static

◆ getFuncTokFromThis()

static const Token* getFuncTokFromThis ( const Token tok)
static

◆ getSingleFunctionCall()

static const Token* getSingleFunctionCall ( const Scope scope)
static

◆ getSingleReturnVar()

static const Variable* getSingleReturnVar ( const Scope scope)
static

◆ hasNonCopyableBase()

static bool hasNonCopyableBase ( const Scope scope,
bool *  unknown 
)
static

◆ isFalseKeyword()

static bool isFalseKeyword ( const Token tok)
static

Definition at line 1808 of file checkclass.cpp.

References Token::getKnownIntValue(), and Token::hasKnownIntValue().

Referenced by CheckClass::isInverted().

◆ isTrueKeyword()

static bool isTrueKeyword ( const Token tok)
static

Definition at line 1803 of file checkclass.cpp.

References Token::getKnownIntValue(), and Token::hasKnownIntValue().

Referenced by CheckClass::isInverted().

◆ isVariableCopyNeeded()

static bool isVariableCopyNeeded ( const Variable var,
Function::Type  type 
)
static

◆ isVclTypeInit()

static bool isVclTypeInit ( const Type type)
static

Definition at line 105 of file checkclass.cpp.

References Type::derivedFrom.

Referenced by CheckClass::constructors().

◆ noMemberErrorMessage()

static std::string noMemberErrorMessage ( const Scope scope,
const char  function[],
bool  isdefault 
)
static

Variable Documentation

◆ CWE398

const CWE CWE398(398U) ( 398U  )
static

◆ CWE404

const CWE CWE404(404U) ( 404U  )
static

◆ CWE665

const CWE CWE665(665U) ( 665U  )
static

◆ CWE758

const CWE CWE758(758U) ( 758U  )
static

◆ CWE762

const CWE CWE762(762U) ( 762U  )
static

◆ CWE_ONE_DEFINITION_RULE

const CWE CWE_ONE_DEFINITION_RULE(758U) ( 758U  )
static