Cppcheck
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
Type Class Reference

Information about a class type. More...

#include <symboldatabase.h>

Classes

struct  BaseInfo
 
struct  FriendInfo
 

Public Types

enum class  NeedInitialization { Unknown , True , False }
 

Public Member Functions

 Type (const Token *classDef_=nullptr, const Scope *classScope_=nullptr, const Scope *enclosingScope_=nullptr)
 
std::string name () const
 
const std::string & type () const
 
bool isClassType () const
 
bool isEnumType () const
 
bool isStructType () const
 
bool isUnionType () const
 
bool isTypeAlias () const
 
const TokeninitBaseInfo (const Token *tok, const Token *tok1)
 
const FunctiongetFunction (const std::string &funcName) const
 
bool hasCircularDependencies (std::set< BaseInfo > *ancestors=nullptr) const
 Check for circulare dependencies, i.e. More...
 
bool findDependency (const Type *ancestor) const
 Check for dependency. More...
 
bool isDerivedFrom (const std::string &ancestor) const
 

Public Attributes

const TokenclassDef
 Points to "class" token. More...
 
const ScopeclassScope
 
const ScopeenclosingScope
 
enum Type::NeedInitialization needInitialization = NeedInitialization::Unknown
 
std::vector< BaseInfoderivedFrom
 
std::vector< FriendInfofriendList
 
const TokentypeStart {}
 
const TokentypeEnd {}
 
MathLib::bigint sizeOf {}
 

Detailed Description

Information about a class type.

Definition at line 66 of file symboldatabase.h.

Member Enumeration Documentation

◆ NeedInitialization

Enumerator
Unknown 
True 
False 

Definition at line 71 of file symboldatabase.h.

Constructor & Destructor Documentation

◆ Type()

Type::Type ( const Token classDef_ = nullptr,
const Scope classScope_ = nullptr,
const Scope enclosingScope_ = nullptr 
)
inlineexplicit

Definition at line 100 of file symboldatabase.h.

References Token::linkAt(), Token::next(), Token::simpleMatch(), and Token::tokAt().

Member Function Documentation

◆ findDependency()

bool Type::findDependency ( const Type ancestor) const

Check for dependency.

Parameters
ancestorpotential ancestor
Returns
true if there is a dependency

Definition at line 3652 of file symboldatabase.cpp.

References derivedFrom.

Referenced by SymbolDatabase::createSymbolDatabaseClassInfo(), and initBaseInfo().

◆ getFunction()

const Function * Type::getFunction ( const std::string &  funcName) const

Definition at line 3612 of file symboldatabase.cpp.

References classScope, derivedFrom, Scope::functionMap, getFunction(), and Function::type.

Referenced by getFunction(), and isIterator().

◆ hasCircularDependencies()

bool Type::hasCircularDependencies ( std::set< BaseInfo > *  ancestors = nullptr) const

Check for circulare dependencies, i.e.

loops within the class hierarchy

Parameters
ancestorslist of ancestors. For internal usage only, clients should not supply this argument.
Returns
true if there is a circular dependency

Definition at line 3631 of file symboldatabase.cpp.

References derivedFrom.

◆ initBaseInfo()

const Token * Type::initBaseInfo ( const Token tok,
const Token tok1 
)

◆ isClassType()

bool Type::isClassType ( ) const

Definition at line 3456 of file symboldatabase.cpp.

References classScope, and Scope::type.

Referenced by valueFlowLifetimeClassConstructor().

◆ isDerivedFrom()

bool Type::isDerivedFrom ( const std::string &  ancestor) const

Definition at line 3659 of file symboldatabase.cpp.

References derivedFrom.

Referenced by Function::argsMatch(), and ValueType::matchParameter().

◆ isEnumType()

bool Type::isEnumType ( ) const

Definition at line 3461 of file symboldatabase.cpp.

References classDef, classScope, Token::str(), and Scope::type.

Referenced by name(), and Token::type().

◆ isStructType()

bool Type::isStructType ( ) const

Definition at line 3468 of file symboldatabase.cpp.

References classScope, and Scope::type.

Referenced by CheckUninitVar::checkScope(), and valueFlowLifetimeClassConstructor().

◆ isTypeAlias()

bool Type::isTypeAlias ( ) const
inline

Definition at line 129 of file symboldatabase.h.

References Token::str().

◆ isUnionType()

bool Type::isUnionType ( ) const

Definition at line 3473 of file symboldatabase.cpp.

References classScope, and Scope::type.

Referenced by CheckUnusedVar::checkFunctionVariableUsage(), and needsInitialization().

◆ name()

std::string Type::name ( ) const

◆ type()

const std::string& Type::type ( ) const
inline

Member Data Documentation

◆ classDef

const Token* Type::classDef

Points to "class" token.

Definition at line 68 of file symboldatabase.h.

Referenced by isDifferentType(), isEnumType(), name(), SymbolDatabase::printVariable(), and CheckClass::virtualDestructor().

◆ classScope

const Scope* Type::classScope

◆ derivedFrom

std::vector<BaseInfo> Type::derivedFrom

◆ enclosingScope

const Scope* Type::enclosingScope

Definition at line 70 of file symboldatabase.h.

Referenced by checkFunctionUsage(), initBaseInfo(), and ValueType::str().

◆ friendList

std::vector<FriendInfo> Type::friendList

◆ needInitialization

enum Type::NeedInitialization Type::needInitialization = NeedInitialization::Unknown

◆ sizeOf

MathLib::bigint Type::sizeOf {}

Definition at line 98 of file symboldatabase.h.

Referenced by setValues(), and ValueType::typeSize().

◆ typeEnd

const Token* Type::typeEnd {}

Definition at line 97 of file symboldatabase.h.

◆ typeStart

const Token* Type::typeStart {}

Definition at line 96 of file symboldatabase.h.


The documentation for this class was generated from the following files: