Cppcheck
|
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 Token * | initBaseInfo (const Token *tok, const Token *tok1) |
const Function * | getFunction (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 Token * | classDef |
Points to "class" token. More... | |
const Scope * | classScope |
const Scope * | enclosingScope |
enum Type::NeedInitialization | needInitialization = NeedInitialization::Unknown |
std::vector< BaseInfo > | derivedFrom |
std::vector< FriendInfo > | friendList |
const Token * | typeStart {} |
const Token * | typeEnd {} |
MathLib::bigint | sizeOf {} |
Information about a class type.
Definition at line 66 of file symboldatabase.h.
|
strong |
Enumerator | |
---|---|
Unknown | |
True | |
False |
Definition at line 71 of file symboldatabase.h.
|
inlineexplicit |
Definition at line 100 of file symboldatabase.h.
References Token::linkAt(), Token::next(), Token::simpleMatch(), and Token::tokAt().
bool Type::findDependency | ( | const Type * | ancestor | ) | const |
Check for dependency.
ancestor | potential ancestor |
Definition at line 3652 of file symboldatabase.cpp.
References derivedFrom.
Referenced by SymbolDatabase::createSymbolDatabaseClassInfo(), and initBaseInfo().
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().
bool Type::hasCircularDependencies | ( | std::set< BaseInfo > * | ancestors = nullptr | ) | const |
Check for circulare dependencies, i.e.
loops within the class hierarchy
ancestors | list of ancestors. For internal usage only, clients should not supply this argument. |
Definition at line 3631 of file symboldatabase.cpp.
References derivedFrom.
Definition at line 3478 of file symboldatabase.cpp.
References Type::BaseInfo::access, Scope::check, classScope, derivedFrom, enclosingScope, findDependency(), SymbolDatabase::findType(), Type::BaseInfo::isVirtual, Token::link(), Token::Match(), Type::BaseInfo::name, Type::BaseInfo::nameTok, Token::next(), Private, Protected, Public, Token::str(), Token::tokAt(), and Type::BaseInfo::type.
Referenced by SymbolDatabase::createSymbolDatabaseFindAllScopes().
bool Type::isClassType | ( | ) | const |
Definition at line 3456 of file symboldatabase.cpp.
References classScope, and Scope::type.
Referenced by valueFlowLifetimeClassConstructor().
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().
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().
bool Type::isStructType | ( | ) | const |
Definition at line 3468 of file symboldatabase.cpp.
References classScope, and Scope::type.
Referenced by CheckUninitVar::checkScope(), and valueFlowLifetimeClassConstructor().
|
inline |
Definition at line 129 of file symboldatabase.h.
References Token::str().
bool Type::isUnionType | ( | ) | const |
Definition at line 3473 of file symboldatabase.cpp.
References classScope, and Scope::type.
Referenced by CheckUnusedVar::checkFunctionVariableUsage(), and needsInitialization().
std::string Type::name | ( | ) | const |
Definition at line 3562 of file symboldatabase.cpp.
References classDef, classScope, emptyString, Scope::enumClass, isEnumType(), Token::isName(), Token::link(), Token::Match(), Token::next(), Token::str(), and Token::tokAt().
Referenced by CheckClass::checkDuplInheritedMembersRecursive(), SymbolDatabase::createSymbolDatabaseFindAllScopes(), Scope::findRecordInBase(), isUniqueExpression(), SymbolDatabase::printVariable(), typesMatch(), valueFlowLifetimeClassConstructor(), and CheckClass::virtualDestructor().
|
inline |
Definition at line 120 of file symboldatabase.h.
References emptyString, and Token::str().
Referenced by Scope::findAssociatedScopes(), SymbolDatabase::findEnumerator(), findEnumScopeInBase(), Scope::findFunctionInBase(), Scope::findRecordInBase(), SymbolDatabase::findVariableTypeInBase(), isUniqueExpression(), and SymbolDatabase::printVariable().
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().
const Scope* Type::classScope |
Definition at line 69 of file symboldatabase.h.
Referenced by CheckIO::ArgumentInfo::ArgumentInfo(), CheckClass::assignAllVarsVisibleFromScope(), CheckClass::checkConstFunc(), CheckClass::checkCopyCtorAndEqOperator(), CheckClass::checkDuplInheritedMembersRecursive(), checkFunctionUsage(), CheckClass::checkMemsetType(), SymbolDatabase::createSymbolDatabaseFindAllScopes(), SymbolDatabase::createSymbolDatabaseSetVariablePointers(), Scope::findAssociatedScopes(), SymbolDatabase::findEnumerator(), findEnumScopeInBase(), SymbolDatabase::findFunction(), Scope::findFunction(), Scope::findFunctionInBase(), Scope::findRecordInBase(), SymbolDatabase::findVariableTypeInBase(), getAllVariableMembers(), getArgumentVars(), getDuplInheritedMemberFunctionsRecursive(), getDuplInheritedMembersRecursive(), getFunction(), Scope::getVariable(), hasNonCopyableBase(), initBaseInfo(), CheckClass::initializeVarList(), isAutoDeallocType(), CheckClass::isBaseClassMutableMemberFunc(), isClassType(), CheckClass::isConstMemberFunc(), CheckUnusedVar::isEmptyType(), isEnumType(), CheckClass::isMemberFunc(), CheckClass::isMemberVar(), isRaiiClass(), CheckUnusedVar::isRecordTypeWithoutSideEffects(), isStructType(), isUnionType(), name(), SymbolDatabase::setValueType(), valueFlowLifetimeClassConstructor(), valueFlowSetConstantValue(), and CheckClass::virtualDestructor().
std::vector<BaseInfo> Type::derivedFrom |
Definition at line 93 of file symboldatabase.h.
Referenced by CheckClass::assignAllVarsVisibleFromScope(), CheckMemoryLeakInClass::check(), CheckClass::checkConst(), CheckClass::checkMemsetType(), CheckClass::checkOverride(), CheckClass::checkUselessOverride(), CheckClass::constructors(), CheckClass::copyconstructors(), Scope::findAssociatedScopes(), findDependency(), SymbolDatabase::findEnumerator(), findEnumScopeInBase(), Scope::findFunctionInBase(), Scope::findRecordInBase(), SymbolDatabase::findVariableTypeInBase(), getAllVariableMembers(), getDuplInheritedMemberFunctionsRecursive(), getDuplInheritedMembersRecursive(), getFunction(), Scope::getVariable(), hasCircularDependencies(), hasNonCopyableBase(), initBaseInfo(), isAutoDeallocType(), CheckClass::isBaseClassMutableMemberFunc(), CheckClass::isConstMemberFunc(), isDerivedFrom(), CheckUnusedVar::isEmptyType(), CheckClass::isMemberFunc(), CheckClass::isMemberVar(), CheckUnusedVar::isRecordTypeWithoutSideEffects(), CheckIO::ArgumentInfo::isStdContainer(), isVclTypeInit(), CheckClass::operatorEqToSelf(), CheckClass::privateFunctions(), valueFlowLifetimeClassConstructor(), and CheckClass::virtualDestructor().
const Scope* Type::enclosingScope |
Definition at line 70 of file symboldatabase.h.
Referenced by checkFunctionUsage(), initBaseInfo(), and ValueType::str().
std::vector<FriendInfo> Type::friendList |
Definition at line 94 of file symboldatabase.h.
Referenced by SymbolDatabase::createSymbolDatabaseFindAllScopes(), CheckClass::initializeVarList(), and CheckClass::privateFunctions().
enum Type::NeedInitialization Type::needInitialization = NeedInitialization::Unknown |
MathLib::bigint Type::sizeOf {} |
Definition at line 98 of file symboldatabase.h.
Referenced by setValues(), and ValueType::typeSize().
const Token* Type::typeEnd {} |
Definition at line 97 of file symboldatabase.h.
const Token* Type::typeStart {} |
Definition at line 96 of file symboldatabase.h.