clang API Documentation

Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends
clang::Type Class Reference

#include <Type.h>

Inheritance diagram for clang::Type:
Inheritance graph
[legend]
Collaboration diagram for clang::Type:
Collaboration graph
[legend]

List of all members.

Classes

class  ArrayTypeBitfields
class  AttributedTypeBitfields
class  BuiltinTypeBitfields
class  FunctionTypeBitfields
class  ObjCObjectTypeBitfields
class  ReferenceTypeBitfields
class  TypeBitfields
 Bitfields required by the Type class.
class  TypeWithKeywordBitfields
class  VectorTypeBitfields

Public Types

enum  TypeClass
enum  ScalarTypeKind {
  STK_CPointer, STK_BlockPointer, STK_ObjCObjectPointer, STK_MemberPointer,
  STK_Bool, STK_Integral, STK_Floating, STK_IntegralComplex,
  STK_FloatingComplex
}

Public Member Functions

TypeClass getTypeClass () const
bool isFromAST () const
 Whether this type comes from an AST file.
bool containsUnexpandedParameterPack () const
 Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templates.
bool isCanonicalUnqualified () const
QualType getLocallyUnqualifiedSingleStepDesugaredType () const
bool isIncompleteType (NamedDecl **Def=0) const
 Def If non-NULL, and the type refers to some kind of declaration that can be completed (such as a C struct, C++ class, or Objective-C class), will be set to the declaration.
bool isIncompleteOrObjectType () const
bool isObjectType () const
 Determine whether this type is an object type.
bool isLiteralType () const
bool isStandardLayoutType () const
 Test if this type is a standard-layout type. (C++0x [basic.type]p9)
bool isBuiltinType () const
 isBuiltinType - returns true if the type is a builtin type.
bool isSpecificBuiltinType (unsigned K) const
 isSpecificBuiltinType - Test for a particular builtin type.
bool isPlaceholderType () const
const BuiltinTypegetAsPlaceholderType () const
bool isSpecificPlaceholderType (unsigned K) const
 isSpecificPlaceholderType - Test for a specific placeholder type.
bool isNonOverloadPlaceholderType () const
bool isIntegerType () const
bool isEnumeralType () const
bool isBooleanType () const
bool isCharType () const
bool isWideCharType () const
bool isChar16Type () const
bool isChar32Type () const
bool isAnyCharacterType () const
 Determine whether this type is any of the built-in character types.
bool isIntegralType (ASTContext &Ctx) const
 Determine whether this type is an integral type.
bool isIntegralOrEnumerationType () const
 Determine whether this type is an integral or enumeration type.
bool isIntegralOrUnscopedEnumerationType () const
 Determine whether this type is an integral or unscoped enumeration type.
bool isRealFloatingType () const
 Floating point categories.
bool isComplexType () const
bool isAnyComplexType () const
bool isFloatingType () const
bool isHalfType () const
bool isRealType () const
bool isArithmeticType () const
bool isVoidType () const
 isVoidType - Helper method to determine if this is the 'void' type.
bool isDerivedType () const
bool isScalarType () const
bool isAggregateType () const
 Determines whether the type is a C++ aggregate type or C aggregate or union type.
bool isFundamentalType () const
 Tests whether the type is categorized as a fundamental type.
bool isCompoundType () const
 Tests whether the type is categorized as a compound type.
bool isFunctionType () const
bool isFunctionNoProtoType () const
bool isFunctionProtoType () const
bool isPointerType () const
bool isAnyPointerType () const
bool isBlockPointerType () const
bool isVoidPointerType () const
bool isReferenceType () const
bool isLValueReferenceType () const
bool isRValueReferenceType () const
bool isFunctionPointerType () const
bool isMemberPointerType () const
bool isMemberFunctionPointerType () const
bool isMemberDataPointerType () const
bool isArrayType () const
bool isConstantArrayType () const
bool isIncompleteArrayType () const
bool isVariableArrayType () const
bool isDependentSizedArrayType () const
bool isRecordType () const
bool isClassType () const
bool isStructureType () const
bool isStructureOrClassType () const
bool isUnionType () const
bool isComplexIntegerType () const
bool isVectorType () const
bool isExtVectorType () const
bool isObjCObjectPointerType () const
bool isObjCRetainableType () const
bool isObjCLifetimeType () const
bool isObjCIndirectLifetimeType () const
bool isObjCNSObjectType () const
bool isObjCObjectType () const
bool isObjCQualifiedInterfaceType () const
bool isObjCQualifiedIdType () const
bool isObjCQualifiedClassType () const
bool isObjCObjectOrInterfaceType () const
bool isObjCIdType () const
bool isObjCClassType () const
bool isObjCSelType () const
bool isObjCBuiltinType () const
bool isObjCARCBridgableType () const
 Determine whether the given type T is a "bridgable" Objective-C type, which is either an Objective-C object pointer type or an.
bool isCARCBridgableType () const
 Determine whether the given type T is a "bridgeable" C type.
bool isTemplateTypeParmType () const
bool isNullPtrType () const
bool isAtomicType () const
bool isObjCARCImplicitlyUnretainedType () const
Qualifiers::ObjCLifetime getObjCARCImplicitLifetime () const
 Return the implicit lifetime for this type, which must not be dependent.
ScalarTypeKind getScalarTypeKind () const
 getScalarTypeKind - Given that this is a scalar type, classify it.
bool isDependentType () const
bool isInstantiationDependentType () const
 Determine whether this type is an instantiation-dependent type, meaning that the type involves a template parameter (even if the definition does not actually depend on the type substituted for that template parameter).
bool isVariablyModifiedType () const
 Whether this type is a variably-modified type (C99 6.7.5).
bool hasSizedVLAType () const
 Whether this type involves a variable-length array type with a definite size.
bool hasUnnamedOrLocalType () const
 Whether this type is or contains a local or unnamed type.
bool isOverloadableType () const
 Determines whether this is a type for which one can define an overloaded operator.
bool isElaboratedTypeSpecifier () const
 Determine wither this type is a C++ elaborated-type-specifier.
bool canDecayToPointerType () const
 Determines whether this type can decay to a pointer type.
bool hasPointerRepresentation () const
bool hasObjCPointerRepresentation () const
bool hasIntegerRepresentation () const
 Determine whether this type has an integer representation of some sort, e.g., it is an integer type or a vector.
bool hasSignedIntegerRepresentation () const
 Determine whether this type has an signed integer representation of some sort, e.g., it is an signed integer type or a vector.
bool hasUnsignedIntegerRepresentation () const
 Determine whether this type has an unsigned integer representation of some sort, e.g., it is an unsigned integer type or a vector.
bool hasFloatingRepresentation () const
 Determine whether this type has a floating-point representation of some sort, e.g., it is a floating-point type or a vector thereof.
const RecordTypegetAsStructureType () const
const RecordTypegetAsUnionType () const
 NOTE: getAs*ArrayType are methods on ASTContext.
const ComplexTypegetAsComplexIntegerType () const
const ObjCObjectPointerTypegetAsObjCInterfacePointerType () const
const ObjCObjectPointerTypegetAsObjCQualifiedIdType () const
const ObjCObjectPointerTypegetAsObjCQualifiedClassType () const
const ObjCObjectTypegetAsObjCQualifiedInterfaceType () const
const CXXRecordDeclgetCXXRecordDeclForPointerType () const
CXXRecordDeclgetAsCXXRecordDecl () const
 Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or because it is the injected-class-name type of a class template or class template partial specialization.
AutoTypegetContainedAutoType () const
 Get the AutoType whose type will be deduced for a variable with an initializer of this type. This looks through declarators like pointer types, but not through decltype or typedefs.
template<typename T >
const T * getAs () const
 Member-template getAs<specific type>'.
const ArrayTypegetAsArrayTypeUnsafe () const
template<typename T >
const T * castAs () const
const ArrayTypecastAsArrayTypeUnsafe () const
const TypegetBaseElementTypeUnsafe () const
const TypegetArrayElementTypeNoTypeQual () const
QualType getPointeeType () const
const TypegetUnqualifiedDesugaredType () const
bool isPromotableIntegerType () const
 More type predicates useful for type checking/promotion.
bool isSignedIntegerType () const
bool isUnsignedIntegerType () const
bool isSignedIntegerOrEnumerationType () const
bool isUnsignedIntegerOrEnumerationType () const
bool isConstantSizeType () const
bool isSpecifierType () const
Linkage getLinkage () const
 Determine the linkage of this type.
Visibility getVisibility () const
 Determine the visibility of this type.
bool isVisibilityExplicit () const
 Return true if the visibility was explicitly set is the code.
std::pair< Linkage, VisibilitygetLinkageAndVisibility () const
 Determine the linkage and visibility of this type.
void ClearLinkageCache ()
 Note that the linkage is no longer known.
const char * getTypeClassName () const
QualType getCanonicalTypeInternal () const
CanQualType getCanonicalTypeUnqualified () const
void dump () const

Static Public Member Functions

static bool classof (const Type *)

Protected Member Functions

Typethis_ ()
 Type (TypeClass tc, QualType canon, bool Dependent, bool InstantiationDependent, bool VariablyModified, bool ContainsUnexpandedParameterPack)
void setDependent (bool D=true)
void setInstantiationDependent (bool D=true)
void setVariablyModified (bool VM=true)
void setContainsUnexpandedParameterPack (bool PP=true)

Protected Attributes

union {
   TypeBitfields   TypeBits
   ArrayTypeBitfields   ArrayTypeBits
   AttributedTypeBitfields   AttributedTypeBits
   BuiltinTypeBitfields   BuiltinTypeBits
   FunctionTypeBitfields   FunctionTypeBits
   ObjCObjectTypeBitfields   ObjCObjectTypeBits
   ReferenceTypeBitfields   ReferenceTypeBits
   TypeWithKeywordBitfields   TypeWithKeywordBits
   VectorTypeBitfields   VectorTypeBits
}; 

Friends

class TypePropertyCache
class ASTContext
class ASTReader
class ASTWriter

Detailed Description

Type - This is the base class of the type hierarchy. A central concept with types is that each type always has a canonical type. A canonical type is the type with any typedef names stripped out of it or the types it references. For example, consider:

typedef int foo; typedef foo* bar; 'int *' 'foo *' 'bar'

There will be a Type object created for 'int'. Since int is canonical, its canonicaltype pointer points to itself. There is also a Type for 'foo' (a TypedefType). Its CanonicalType pointer points to the 'int' Type. Next there is a PointerType that represents 'int*', which, like 'int', is canonical. Finally, there is a PointerType type for 'foo*' whose canonical type is 'int*', and there is a TypedefType for 'bar', whose canonical type is also 'int*'.

Non-canonical types are useful for emitting diagnostics, without losing information about typedefs being used. Canonical types are useful for type comparisons (they allow by-pointer equality tests) and useful for reasoning about whether something has a particular form (e.g. is a function type), because they implicitly, recursively, strip all typedefs out of a type.

Types, once created, are immutable.

Definition at line 1086 of file Type.h.


Member Enumeration Documentation

Enumerator:
STK_CPointer 
STK_BlockPointer 
STK_ObjCObjectPointer 
STK_MemberPointer 
STK_Bool 
STK_Integral 
STK_Floating 
STK_IntegralComplex 
STK_FloatingComplex 

Definition at line 1523 of file Type.h.

Definition at line 1088 of file Type.h.


Constructor & Destructor Documentation

clang::Type::Type ( TypeClass  tc,
QualType  canon,
bool  Dependent,
bool  InstantiationDependent,
bool  VariablyModified,
bool  ContainsUnexpandedParameterPack 
) [inline, protected]

Definition at line 1304 of file Type.h.

References clang::NoLinkage.


Member Function Documentation

bool clang::Type::canDecayToPointerType ( ) const [inline]

Determines whether this type can decay to a pointer type.

Definition at line 4825 of file Type.h.

template<typename T >
const T * clang::Type::castAs ( ) const

Member-template castAs<specific type>. Look through sugar for the underlying instance of <specific type>="">.

This method has the same relationship to getAs<T> as cast<T> has to dyn_cast<T>; which is to say, the underlying type *must* have the intended type, and this method will never return null.

Definition at line 4905 of file Type.h.

Referenced by clang::Sema::ActOnFinishDelayedMemberInitializers(), clang::Sema::BuildCallToMemberFunction(), clang::ObjCObjectPointerType::getObjectType(), and handleSentinelAttr().

const ArrayType * clang::Type::castAsArrayTypeUnsafe ( ) const [inline]

A variant of castAs<> for array type which silently discards qualifiers from the outermost type.

Definition at line 4914 of file Type.h.

Referenced by clang::QualType::getBaseTypeIdentifier().

static bool clang::Type::classof ( const Type ) [inline, static]
void Type::ClearLinkageCache ( )

Note that the linkage is no longer known.

Definition at line 2172 of file Type.cpp.

References clang::ExtQualsTypeCommonBase::QualType, and TypeBits.

bool clang::Type::containsUnexpandedParameterPack ( ) const [inline]

Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templates.

A type that contains a parameter pack shall be expanded by the ellipsis operator at some point. For example, the typedef in the following example contains an unexpanded parameter pack 'T':

 template<typename ...T>
 struct X {
   typedef T* pointer_types; // ill-formed; T is a parameter pack.
 };

Note that this routine does not specify which

Definition at line 1356 of file Type.h.

Referenced by clang::NestedNameSpecifier::containsUnexpandedParameterPack().

void Type::dump ( ) const

Definition at line 1150 of file TypePrinter.cpp.

References clang::ExtQualsTypeCommonBase::QualType.

const Type * Type::getArrayElementTypeNoTypeQual ( ) const

getArrayElementTypeNoTypeQual - If this is an array type, return the element type of the array, potentially with type qualifiers missing. This method should never be used when type qualifiers are meaningful.

Definition at line 177 of file Type.cpp.

References getElementType(), and getUnqualifiedDesugaredType().

Referenced by print_elem().

template<typename T >
const T * clang::Type::getAs ( ) const [inline]

Member-template getAs<specific type>'.

Member-template getAs<specific type>'. Look through sugar for an instance of <specific type>="">. This scheme will eventually replace the specific getAsXXXX methods above.

There are some specializations of this member template listed immediately following this class.

Definition at line 1720 of file Type.h.

Referenced by clang::Sema::ActOnConversionDeclarator(), clang::Sema::ActOnCXXDelete(), clang::Sema::ActOnFields(), clang::Sema::ActOnTag(), clang::Sema::ActOnUninitializedDecl(), AdjustFunctionParmAndArgTypesForDeduction(), clang::Sema::AttachBaseSpecifiers(), clang::Sema::BuildExpressionFromIntegralTemplateArgument(), CheckIncrementDecrementOperand(), clang::Sema::CheckMain(), clang::Sema::CheckPointerToMemberOperands(), CollectVisibleConversions(), clang::CollectVRQualifiers(), clang::Sema::computeDeclContext(), clang::Sema::ComputeDefaultedDefaultCtorExceptionSpec(), clang::Sema::ComputeDefaultedDtorExceptionSpec(), clang::Sema::ComputeDefaultedMoveCtorExceptionSpec(), clang::PredefinedExpr::ComputeName(), clang::CodeGen::CodeGenModule::ConstructAttributeList(), ConvertDeclSpecToType(), clang::Sema::CreateBuiltinArraySubscriptExpr(), DeduceTemplateArgumentsByTypeMatch(), clang::Sema::DiagnoseNontrivial(), EmitBaseInitializer(), clang::CodeGen::CodeGenFunction::EmitCXXMemberCallExpr(), clang::CodeGen::CodeGenFunction::EmitCXXMemberPointerCallExpr(), clang::CodeGen::CGCXXABI::EmitLoadOfMemberFunctionPointer(), EvaluateUnaryTypeTrait(), clang::Sema::FindCompositePointerType(), clang::FindConversionForRefInit(), clang::CXXRecordDecl::forallBases(), clang::QualType::getBaseTypeIdentifier(), GetFullTypeForDeclarator(), clang::getFunctionExtInfo(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::CodeCompleteConsumer::OverloadCandidate::getFunctionType(), clang::BlockExpr::getFunctionType(), clang::QualType::getNonReferenceType(), clang::ASTContext::getPreferredTypeAlign(), handleSentinelAttr(), clang::QualType::isCXX11PODType(), isLiteralType(), clang::Expr::isNullPointerConstant(), isStandardLayoutType(), clang::CodeGen::CodeGenFunction::IvarTypeWithAggrGCObjects(), clang::Sema::MarkBaseAndMemberDestructorsReferenced(), clang::ASTContext::mergeTypes(), print_elem(), clang::CodeGen::CodeGenModule::ReturnTypeUsesFP2Ret(), clang::Sema::SetCtorInitializers(), clang::TryReferenceInit(), TryRefInitWithConversionFunction(), TryUserDefinedConversion(), clang::ASTNodeImporter::VisitEnumDecl(), and clang::ASTNodeImporter::VisitRecordDecl().

const ArrayType * clang::Type::getAsArrayTypeUnsafe ( ) const [inline]

A variant of getAs<> for array types which silently discards qualifiers from the outermost type.

Definition at line 4891 of file Type.h.

Referenced by clang::ASTContext::getBaseElementType(), getBaseElementTypeUnsafe(), hasSizedVLAType(), and isObjCLifetimeType().

const ComplexType * Type::getAsComplexIntegerType ( ) const

Definition at line 373 of file Type.cpp.

Referenced by isComplexIntegerType().

CXXRecordDecl * Type::getAsCXXRecordDecl ( ) const

Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or because it is the injected-class-name type of a class template or class template partial specialization.

Definition at line 494 of file Type.cpp.

Referenced by clang::UnresolvedMemberExpr::getNamingClass(), GetUuidAttrOfType(), and print_elem().

const ObjCObjectPointerType * Type::getAsObjCInterfacePointerType ( ) const

Definition at line 479 of file Type.cpp.

const ObjCObjectPointerType * Type::getAsObjCQualifiedClassType ( ) const

Definition at line 469 of file Type.cpp.

const ObjCObjectPointerType * Type::getAsObjCQualifiedIdType ( ) const

Definition at line 459 of file Type.cpp.

const ObjCObjectType * Type::getAsObjCQualifiedInterfaceType ( ) const

Definition at line 445 of file Type.cpp.

Referenced by isObjCQualifiedInterfaceType().

const BuiltinType * clang::Type::getAsPlaceholderType ( ) const [inline]

Definition at line 4798 of file Type.h.

const RecordType * Type::getAsStructureType ( ) const

Definition at line 392 of file Type.cpp.

References getUnqualifiedDesugaredType().

const RecordType * Type::getAsUnionType ( ) const

NOTE: getAs*ArrayType are methods on ASTContext.

Definition at line 411 of file Type.cpp.

References getUnqualifiedDesugaredType().

const Type * clang::Type::getBaseElementTypeUnsafe ( ) const [inline]

getBaseElementTypeUnsafe - Get the base element type of this type, potentially discarding type qualifiers. This method should never be used when type qualifiers are meaningful.

Definition at line 4838 of file Type.h.

References getAsArrayTypeUnsafe().

Referenced by getElementType(), clang::QualType::isCXX11PODType(), isLiteralType(), and isStandardLayoutType().

QualType clang::Type::getCanonicalTypeInternal ( ) const [inline]
CanQualType clang::Type::getCanonicalTypeUnqualified ( ) const [inline]
AutoType * Type::getContainedAutoType ( ) const

Get the AutoType whose type will be deduced for a variable with an initializer of this type. This looks through declarators like pointer types, but not through decltype or typedefs.

Definition at line 555 of file Type.cpp.

Referenced by clang::Sema::BuildDeclaratorGroup().

const CXXRecordDecl * Type::getCXXRecordDeclForPointerType ( ) const

Definition at line 487 of file Type.cpp.

References getPointeeType().

Linkage Type::getLinkage ( ) const

Determine the linkage of this type.

Definition at line 2146 of file Type.cpp.

References clang::TypePropertyCache< Private >::ensure(), and TypeBits.

std::pair< Linkage, Visibility > Type::getLinkageAndVisibility ( ) const

Determine the linkage and visibility of this type.

Definition at line 2167 of file Type.cpp.

References clang::TypePropertyCache< Private >::ensure(), and TypeBits.

QualType Type::getLocallyUnqualifiedSingleStepDesugaredType ( ) const

Pull a single level of sugar off of this locally-unqualified type. Users should generally prefer SplitQualType::getSingleStepDesugaredType() or QualType::getSingleStepDesugaredType(const ASTContext&).

Definition at line 210 of file Type.cpp.

References getTypeClass().

Qualifiers::ObjCLifetime Type::getObjCARCImplicitLifetime ( ) const

Return the implicit lifetime for this type, which must not be dependent.

Definition at line 2178 of file Type.cpp.

References isObjCARCImplicitlyUnretainedType(), clang::Qualifiers::OCL_ExplicitNone, and clang::Qualifiers::OCL_Strong.

QualType Type::getPointeeType ( ) const
Type::ScalarTypeKind Type::getScalarTypeKind ( ) const

getScalarTypeKind - Given that this is a scalar type, classify it.

Definition at line 838 of file Type.cpp.

References isScalarType(), STK_BlockPointer, STK_Bool, STK_CPointer, STK_Floating, STK_FloatingComplex, STK_Integral, STK_IntegralComplex, STK_MemberPointer, and STK_ObjCObjectPointer.

Referenced by matchTypes().

TypeClass clang::Type::getTypeClass ( ) const [inline]

Definition at line 1336 of file Type.h.

Referenced by addAssociatedClassesAndNamespaces(), clang::BuildSimilarlyQualifiedPointerType(), clang::LocInfoType::classof(), clang::BuiltinType::classof(), clang::ComplexType::classof(), clang::ParenType::classof(), clang::PointerType::classof(), clang::BlockPointerType::classof(), clang::ReferenceType::classof(), clang::LValueReferenceType::classof(), clang::RValueReferenceType::classof(), clang::MemberPointerType::classof(), clang::ArrayType::classof(), clang::ConstantArrayType::classof(), clang::IncompleteArrayType::classof(), clang::VariableArrayType::classof(), clang::DependentSizedArrayType::classof(), clang::DependentSizedExtVectorType::classof(), clang::VectorType::classof(), clang::ExtVectorType::classof(), clang::FunctionType::classof(), clang::FunctionNoProtoType::classof(), clang::FunctionProtoType::classof(), clang::UnresolvedUsingType::classof(), clang::TypedefType::classof(), clang::TypeOfExprType::classof(), clang::TypeOfType::classof(), clang::DecltypeType::classof(), clang::UnaryTransformType::classof(), clang::TagType::classof(), clang::RecordType::classof(), clang::EnumType::classof(), clang::AttributedType::classof(), clang::TemplateTypeParmType::classof(), clang::SubstTemplateTypeParmType::classof(), clang::SubstTemplateTypeParmPackType::classof(), clang::AutoType::classof(), clang::TemplateSpecializationType::classof(), clang::InjectedClassNameType::classof(), clang::ElaboratedType::classof(), clang::DependentNameType::classof(), clang::DependentTemplateSpecializationType::classof(), clang::PackExpansionType::classof(), clang::ObjCObjectType::classof(), clang::ObjCInterfaceType::classof(), clang::ObjCObjectPointerType::classof(), clang::AtomicType::classof(), computeCachedProperties(), clang::CodeGen::CodeGenTypes::ConvertType(), clang::Sema::CreateParsedType(), Desugar(), clang::QualType::getBaseTypeIdentifier(), getLocallyUnqualifiedSingleStepDesugaredType(), clang::ASTContext::getTypeInfo(), clang::UnqualTypeLoc::getTypeLocClass(), getUnqualifiedDesugaredType(), clang::ASTContext::getVariableArrayDecayedType(), isSpecifierType(), clang::Sema::MaybeBindToTemporary(), clang::ASTContext::PrintStats(), and clang::TypeVisitor< ASTNodeImporter, QualType >::Visit().

const char * Type::getTypeClassName ( ) const

Definition at line 1473 of file Type.cpp.

References TypeBits.

Referenced by clang::ASTNodeImporter::VisitType().

const Type * Type::getUnqualifiedDesugaredType ( ) const

getUnqualifiedDesugaredType() - Return the specified type with any "sugar" removed from the type, removing any typedefs, typeofs, etc., as well as any qualifiers.

getUnqualifiedDesugaredType - Pull any qualifiers and syntactic sugar off the given type. This should produce an object of the same dynamic type as the canonical type.

Definition at line 294 of file Type.cpp.

References getTypeClass().

Referenced by getArrayElementTypeNoTypeQual(), getAsStructureType(), getAsUnionType(), and clang::ASTContext::getUnqualifiedArrayType().

Visibility Type::getVisibility ( ) const

Determine the visibility of this type.

Determine the linkage of this type.

Definition at line 2152 of file Type.cpp.

References clang::TypePropertyCache< Private >::ensure(), and TypeBits.

bool Type::hasFloatingRepresentation ( ) const

Determine whether this type has a floating-point representation of some sort, e.g., it is a floating-point type or a vector thereof.

Definition at line 786 of file Type.cpp.

References isFloatingType().

bool Type::hasIntegerRepresentation ( ) const

Determine whether this type has an integer representation of some sort, e.g., it is an integer type or a vector.

Definition at line 570 of file Type.cpp.

References isIntegerType().

bool clang::Type::hasObjCPointerRepresentation ( ) const [inline]

hasObjCPointerRepresentation - Whether this type can represent an objective pointer type for the purpose of GC'ability

Definition at line 4834 of file Type.h.

bool clang::Type::hasPointerRepresentation ( ) const [inline]

hasPointerRepresentation - Whether this type is represented natively as a pointer; this includes pointers, references, block pointers, and Objective-C interface, qualified id, and qualified interface types, as well as nullptr_t.

Definition at line 4829 of file Type.h.

bool Type::hasSignedIntegerRepresentation ( ) const

Determine whether this type has an signed integer representation of some sort, e.g., it is an signed integer type or a vector.

Definition at line 723 of file Type.cpp.

References isSignedIntegerType().

bool Type::hasSizedVLAType ( ) const

Whether this type involves a variable-length array type with a definite size.

Definition at line 2251 of file Type.cpp.

References getAsArrayTypeUnsafe(), and isVariablyModifiedType().

Referenced by clang::QualType::isCanonicalAsParam().

bool Type::hasUnnamedOrLocalType ( ) const

Whether this type is or contains a local or unnamed type.

Definition at line 2162 of file Type.cpp.

References clang::TypePropertyCache< Private >::ensure(), and TypeBits.

bool Type::hasUnsignedIntegerRepresentation ( ) const

Determine whether this type has an unsigned integer representation of some sort, e.g., it is an unsigned integer type or a vector.

Definition at line 763 of file Type.cpp.

References isUnsignedIntegerType().

bool Type::isAggregateType ( ) const

Determines whether the type is a C++ aggregate type or C aggregate or union type.

An aggregate type is an array or a class type (struct, union, or class) that has no user-declared constructors, no private or protected non-static data members, no base classes, and no virtual functions (C++ [dcl.init.aggr]p1). The notion of an aggregate type subsumes the notion of C aggregates (C99 6.2.5p21) because it also includes union types.

Definition at line 877 of file Type.cpp.

bool Type::isAnyCharacterType ( ) const

Determine whether this type is any of the built-in character types.

Definition at line 673 of file Type.cpp.

References clang::BuiltinType::getKind().

bool clang::Type::isAnyComplexType ( ) const [inline]

Definition at line 4730 of file Type.h.

Referenced by isLiteralType().

bool clang::Type::isAnyPointerType ( ) const [inline]

Definition at line 4670 of file Type.h.

Referenced by getElementType().

bool Type::isArithmeticType ( ) const

Definition at line 808 of file Type.cpp.

Referenced by clang::ento::MemRegionManager::getVarRegion().

bool clang::Type::isArrayType ( ) const [inline]

Definition at line 4706 of file Type.h.

Referenced by clang::QualType::getBaseTypeIdentifier(), and getElementType().

bool clang::Type::isAtomicType ( ) const [inline]

Definition at line 4749 of file Type.h.

bool clang::Type::isBlockPointerType ( ) const [inline]

Definition at line 4673 of file Type.h.

Referenced by isObjCARCBridgableType(), and isObjCRetainableType().

bool Type::isBooleanType ( ) const

Definition at line 637 of file Type.cpp.

bool clang::Type::isBuiltinType ( ) const [inline]

isBuiltinType - returns true if the type is a builtin type.

Helper methods to distinguish type categories. All type predicates operate on the canonical type, ignoring typedefs and qualifiers.

Definition at line 4721 of file Type.h.

bool clang::Type::isCanonicalUnqualified ( ) const [inline]
bool Type::isCARCBridgableType ( ) const

Determine whether the given type T is a "bridgeable" C type.

Definition at line 2242 of file Type.cpp.

References clang::PointerType::getPointeeType().

bool Type::isChar16Type ( ) const

Definition at line 659 of file Type.cpp.

bool Type::isChar32Type ( ) const

Definition at line 665 of file Type.cpp.

bool Type::isCharType ( ) const

Definition at line 643 of file Type.cpp.

Referenced by handleFormatArgAttr(), and handleFormatAttr().

bool Type::isClassType ( ) const

Definition at line 335 of file Type.cpp.

bool Type::isComplexIntegerType ( ) const

Definition at line 368 of file Type.cpp.

References getAsComplexIntegerType().

bool Type::isComplexType ( ) const

isComplexType() does *not* include complex integers (a GCC extension). isComplexIntegerType() can be used to test for complex integers.

Definition at line 362 of file Type.cpp.

bool clang::Type::isCompoundType ( ) const [inline]

Tests whether the type is categorized as a compound type.

Returns:
True for types specified in C++0x [basic.compound].

Definition at line 4642 of file Type.h.

References isRecordType().

bool clang::Type::isConstantArrayType ( ) const [inline]

Definition at line 4709 of file Type.h.

Referenced by hasCompatibleArrayTypes().

bool Type::isConstantSizeType ( ) const

isConstantSizeType - Return true if this is not a variable sized type, according to the rules of C99 6.7.5p3. It is not legal to call this on incomplete types.

isConstantSizeType - Return true if this is not a variable sized type, according to the rules of C99 6.7.5p3. It is not legal to call this on incomplete types or dependent types.

Definition at line 891 of file Type.cpp.

References isDependentType(), and isIncompleteType().

bool clang::Type::isDependentSizedArrayType ( ) const [inline]

Definition at line 4718 of file Type.h.

bool clang::Type::isDependentType ( ) const [inline]

isDependentType - Whether this type is a dependent type, meaning that its definition somehow depends on a template parameter (C++ [temp.dep.type]).

Definition at line 1540 of file Type.h.

Referenced by clang::Sema::ActOnFields(), clang::Sema::BuildQualifiedType(), clang::ASTContext::getCanonicalTemplateSpecializationType(), clang::QualType::getNonLValueExprType(), isConstantSizeType(), clang::QualType::isCXX11PODType(), clang::NestedNameSpecifier::isDependent(), isLiteralType(), isPromotableIntegerType(), and isStandardLayoutType().

bool Type::isDerivedType ( ) const

Definition at line 319 of file Type.cpp.

bool Type::isElaboratedTypeSpecifier ( ) const

Determine wither this type is a C++ elaborated-type-specifier.

Definition at line 1458 of file Type.cpp.

References clang::TypeWithKeyword::KeywordIsTagTypeKind().

bool clang::Type::isEnumeralType ( ) const [inline]

Definition at line 4727 of file Type.h.

Referenced by clang::QualType::getBaseTypeIdentifier().

bool clang::Type::isExtVectorType ( ) const [inline]

Definition at line 4736 of file Type.h.

bool Type::isFloatingType ( ) const

Definition at line 777 of file Type.cpp.

Referenced by hasFloatingRepresentation().

bool clang::Type::isFromAST ( ) const [inline]

Whether this type comes from an AST file.

Definition at line 1339 of file Type.h.

bool clang::Type::isFunctionNoProtoType ( ) const [inline]

Definition at line 1467 of file Type.h.

bool clang::Type::isFunctionPointerType ( ) const [inline]

Definition at line 4685 of file Type.h.

bool clang::Type::isFunctionProtoType ( ) const [inline]

Definition at line 1468 of file Type.h.

bool clang::Type::isFunctionType ( ) const [inline]
bool clang::Type::isFundamentalType ( ) const [inline]

Tests whether the type is categorized as a fundamental type.

Returns:
True for types specified in C++0x [basic.fundamental].

Definition at line 4632 of file Type.h.

bool Type::isHalfType ( ) const

Definition at line 770 of file Type.cpp.

bool clang::Type::isIncompleteArrayType ( ) const [inline]

Definition at line 4712 of file Type.h.

Referenced by clang::Sema::ActOnFields(), and hasCompatibleArrayTypes().

bool clang::Type::isIncompleteOrObjectType ( ) const [inline]

isIncompleteOrObjectType - Return true if this is an incomplete or object type, in other words, not a function type.

Definition at line 1386 of file Type.h.

bool Type::isIncompleteType ( NamedDecl **  Def = 0) const

Def If non-NULL, and the type refers to some kind of declaration that can be completed (such as a C struct, C++ class, or Objective-C class), will be set to the declaration.

Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types, and incomplete types. isIncompleteType - Return true if this is an incomplete type. A type that can describe objects, but which lacks information needed to determine its size (e.g. void, or a fwd declared struct). Clients of this routine will need to determine if the size is actually required.

isIncompleteType - Return true if this is an incomplete type (C99 6.2.5p1)

  • a type that can describe objects, but which lacks information needed to determine its size.

Definition at line 901 of file Type.cpp.

References getElementType(), clang::ObjCInterfaceDecl::hasDefinition(), clang::TagDecl::isCompleteDefinition(), clang::EnumDecl::isFixed(), isIncompleteType(), and isVoidType().

Referenced by isConstantSizeType(), clang::QualType::isCXX11PODType(), isIncompleteType(), isLiteralType(), isStandardLayoutType(), matchTypes(), and clang::Sema::RequireCompleteType().

bool clang::Type::isInstantiationDependentType ( ) const [inline]

Determine whether this type is an instantiation-dependent type, meaning that the type involves a template parameter (even if the definition does not actually depend on the type substituted for that template parameter).

Definition at line 1546 of file Type.h.

Referenced by computeCachedProperties(), and clang::NestedNameSpecifier::isInstantiationDependent().

bool Type::isIntegerType ( ) const

isIntegerType() does *not* include complex integers (a GCC extension). isComplexIntegerType() can be used to test for complex integers.

Definition at line 559 of file Type.cpp.

Referenced by hasIntegerRepresentation().

bool Type::isIntegralOrEnumerationType ( ) const

Determine whether this type is an integral or enumeration type.

Definition at line 608 of file Type.cpp.

bool Type::isIntegralOrUnscopedEnumerationType ( ) const

Determine whether this type is an integral or unscoped enumeration type.

Definition at line 621 of file Type.cpp.

bool Type::isIntegralType ( ASTContext Ctx) const

Determine whether this type is an integral type.

This routine determines whether the given type is an integral type per C++ [basic.fundamental]p7. Although the C standard does not define the term "integral type", it has a similar term "integer type", and in C++ the two terms are equivalent. However, C's "integer type" includes enumeration types, while C++'s "integer type" does not. The ASTContext parameter is used to determine whether we should be following the C or C++ rules when determining whether this type is an integral/integer type.

For cases where C permits "an integer type" and C++ permits "an integral type", use this routine.

For cases where C permits "an integer type" and C++ permits "an integral or enumeration type", use isIntegralOrEnumerationType() instead.

Parameters:
CtxThe context in which this type occurs.
Returns:
true if the type is considered an integral type, false otherwise.

Definition at line 596 of file Type.cpp.

References clang::ASTContext::getLangOptions().

bool Type::isLiteralType ( ) const

isLiteralType - Return true if this is a literal type (C++0x [basic.types]p10)

Definition at line 1129 of file Type.cpp.

References getAs(), getBaseElementTypeUnsafe(), isAnyComplexType(), isDependentType(), isIncompleteType(), isReferenceType(), isScalarType(), isVariableArrayType(), and isVectorType().

bool clang::Type::isLValueReferenceType ( ) const [inline]

Definition at line 4679 of file Type.h.

Referenced by clang::FindConversionForRefInit().

bool clang::Type::isMemberDataPointerType ( ) const [inline]

Definition at line 4700 of file Type.h.

bool clang::Type::isMemberFunctionPointerType ( ) const [inline]

Definition at line 4694 of file Type.h.

bool clang::Type::isMemberPointerType ( ) const [inline]

Definition at line 4691 of file Type.h.

bool clang::Type::isNonOverloadPlaceholderType ( ) const [inline]

isNonOverloadPlaceholderType - Test for a placeholder type other than Overload; see BuiltinType::isNonOverloadPlaceholderType.

Reimplemented in clang::BuiltinType.

Definition at line 4812 of file Type.h.

bool Type::isNullPtrType ( ) const

Definition at line 1315 of file Type.cpp.

bool Type::isObjCARCBridgableType ( ) const

Determine whether the given type T is a "bridgable" Objective-C type, which is either an Objective-C object pointer type or an.

Definition at line 2237 of file Type.cpp.

References isBlockPointerType(), and isObjCObjectPointerType().

bool Type::isObjCARCImplicitlyUnretainedType ( ) const

Determines if this type, which must satisfy isObjCLifetimeType(), is implicitly __unsafe_unretained rather than implicitly __strong.

Definition at line 2184 of file Type.cpp.

References getCanonicalTypeInternal(), clang::QualType::getTypePtr(), and isObjCLifetimeType().

Referenced by getObjCARCImplicitLifetime().

bool clang::Type::isObjCBuiltinType ( ) const [inline]
bool clang::Type::isObjCClassType ( ) const [inline]

Reimplemented in clang::ObjCObjectPointerType.

Definition at line 4768 of file Type.h.

bool clang::Type::isObjCIdType ( ) const [inline]

Reimplemented in clang::ObjCObjectPointerType.

Definition at line 4763 of file Type.h.

bool Type::isObjCIndirectLifetimeType ( ) const

Definition at line 2214 of file Type.cpp.

References isObjCLifetimeType().

bool Type::isObjCLifetimeType ( ) const

Returns true if objects of this type have lifetime semantics under ARC.

Definition at line 2228 of file Type.cpp.

References getAsArrayTypeUnsafe(), and isObjCRetainableType().

Referenced by clang::QualType::isCXX11PODType(), isObjCARCImplicitlyUnretainedType(), and isObjCIndirectLifetimeType().

bool Type::isObjCNSObjectType ( ) const

Definition at line 2204 of file Type.cpp.

Referenced by isObjCRetainableType().

bool clang::Type::isObjCObjectOrInterfaceType ( ) const [inline]

Definition at line 4745 of file Type.h.

bool clang::Type::isObjCObjectPointerType ( ) const [inline]

Definition at line 4739 of file Type.h.

Referenced by isObjCARCBridgableType(), and isObjCRetainableType().

bool clang::Type::isObjCObjectType ( ) const [inline]

Definition at line 4742 of file Type.h.

Referenced by clang::Sema::ActOnFields().

bool clang::Type::isObjCQualifiedClassType ( ) const [inline]

Reimplemented in clang::ObjCObjectPointerType.

Definition at line 4758 of file Type.h.

bool clang::Type::isObjCQualifiedIdType ( ) const [inline]

Reimplemented in clang::ObjCObjectPointerType.

Definition at line 4753 of file Type.h.

bool Type::isObjCQualifiedInterfaceType ( ) const

Definition at line 455 of file Type.cpp.

References getAsObjCQualifiedInterfaceType().

bool Type::isObjCRetainableType ( ) const

Definition at line 2209 of file Type.cpp.

References isBlockPointerType(), isObjCNSObjectType(), and isObjCObjectPointerType().

Referenced by isObjCLifetimeType().

bool clang::Type::isObjCSelType ( ) const [inline]

Definition at line 4773 of file Type.h.

bool clang::Type::isObjectType ( ) const [inline]

Determine whether this type is an object type.

Definition at line 1391 of file Type.h.

bool clang::Type::isOverloadableType ( ) const [inline]

Determines whether this is a type for which one can define an overloaded operator.

Definition at line 4820 of file Type.h.

References isRecordType().

bool clang::Type::isPlaceholderType ( ) const [inline]

isPlaceholderType - Test for a type which does not represent an actual type-system type but is instead used as a placeholder for various convenient purposes within Clang. All such types are BuiltinTypes.

Reimplemented in clang::BuiltinType.

Definition at line 4792 of file Type.h.

bool clang::Type::isPointerType ( ) const [inline]

Definition at line 4667 of file Type.h.

Referenced by clang::QualType::getBaseTypeIdentifier().

bool Type::isPromotableIntegerType ( ) const

More type predicates useful for type checking/promotion.

Definition at line 1283 of file Type.cpp.

References isDependentType().

bool Type::isRealFloatingType ( ) const

Floating point categories.

Definition at line 793 of file Type.cpp.

bool Type::isRealType ( ) const

Definition at line 799 of file Type.cpp.

bool clang::Type::isRecordType ( ) const [inline]
bool clang::Type::isReferenceType ( ) const [inline]

Definition at line 4676 of file Type.h.

Referenced by clang::QualType::getBaseTypeIdentifier(), and isLiteralType().

bool clang::Type::isRValueReferenceType ( ) const [inline]
bool Type::isScalarType ( ) const
bool Type::isSignedIntegerOrEnumerationType ( ) const

Determines whether this is an integer type that is signed or an enumeration types whose underlying type is a signed integer type.

Definition at line 709 of file Type.cpp.

bool Type::isSignedIntegerType ( ) const

isSignedIntegerType - Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char, signed char, short, int, long..], or an enum decl which has a signed representation.

isSignedIntegerType - Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char, signed char, short, int, long..], an enum decl which has a signed representation

Definition at line 693 of file Type.cpp.

Referenced by hasSignedIntegerRepresentation().

bool clang::Type::isSpecificBuiltinType ( unsigned  K) const [inline]

isSpecificBuiltinType - Test for a particular builtin type.

Definition at line 4785 of file Type.h.

Referenced by clang::ASTContext::getPreferredTypeAlign().

bool clang::Type::isSpecificPlaceholderType ( unsigned  K) const [inline]

isSpecificPlaceholderType - Test for a specific placeholder type.

Definition at line 4805 of file Type.h.

References clang::BuiltinType::isPlaceholderTypeKind().

bool Type::isSpecifierType ( ) const

isSpecifierType - Returns true if this type can be represented by some set of type specifiers.

Definition at line 1321 of file Type.cpp.

References getTypeClass().

bool Type::isStandardLayoutType ( ) const

Test if this type is a standard-layout type. (C++0x [basic.type]p9)

Definition at line 1182 of file Type.cpp.

References getAs(), getBaseElementTypeUnsafe(), isDependentType(), isIncompleteType(), isScalarType(), and isVectorType().

bool Type::isStructureOrClassType ( ) const

Definition at line 345 of file Type.cpp.

bool Type::isStructureType ( ) const

Definition at line 340 of file Type.cpp.

bool clang::Type::isTemplateTypeParmType ( ) const [inline]

Definition at line 4781 of file Type.h.

Referenced by clang::TemplateDeclInstantiator::VisitTemplateTypeParmDecl().

bool Type::isUnionType ( ) const

Definition at line 356 of file Type.cpp.

bool Type::isUnsignedIntegerOrEnumerationType ( ) const

Determines whether this is an integer type that is unsigned or an enumeration types whose underlying type is a unsigned integer type.

Definition at line 749 of file Type.cpp.

bool Type::isUnsignedIntegerType ( ) const

isUnsignedIntegerType - Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true for _Bool], or an enum decl which has an unsigned representation.

isUnsignedIntegerType - Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true for _Bool], an enum decl which has an unsigned representation

Definition at line 733 of file Type.cpp.

Referenced by clang::ASTContext::getIntegerTypeOrder(), and hasUnsignedIntegerRepresentation().

bool clang::Type::isVariableArrayType ( ) const [inline]

Definition at line 4715 of file Type.h.

Referenced by isLiteralType().

bool clang::Type::isVariablyModifiedType ( ) const [inline]

Whether this type is a variably-modified type (C99 6.7.5).

Definition at line 1551 of file Type.h.

Referenced by hasSizedVLAType(), and clang::QualType::isCanonicalAsParam().

bool clang::Type::isVectorType ( ) const [inline]
bool Type::isVisibilityExplicit ( ) const

Return true if the visibility was explicitly set is the code.

Definition at line 2157 of file Type.cpp.

References clang::TypePropertyCache< Private >::ensure(), and TypeBits.

bool Type::isVoidPointerType ( ) const

Definition at line 350 of file Type.cpp.

bool Type::isVoidType ( ) const

isVoidType - Helper method to determine if this is the 'void' type.

Definition at line 313 of file Type.cpp.

Referenced by clang::Sema::CheckCompareOperands(), isIncompleteType(), and clang::Sema::IsPointerConversion().

bool Type::isWideCharType ( ) const

Definition at line 652 of file Type.cpp.

void clang::Type::setContainsUnexpandedParameterPack ( bool  PP = true) [inline, protected]

Definition at line 1331 of file Type.h.

void clang::Type::setDependent ( bool  D = true) [inline, protected]

Definition at line 1322 of file Type.h.

void clang::Type::setInstantiationDependent ( bool  D = true) [inline, protected]

Definition at line 1327 of file Type.h.

void clang::Type::setVariablyModified ( bool  VM = true) [inline, protected]

Definition at line 1329 of file Type.h.

Type* clang::Type::this_ ( ) [inline, protected]

Definition at line 1303 of file Type.h.


Friends And Related Function Documentation

friend class ASTContext [friend]
friend class ASTReader [friend]

Reimplemented in clang::ObjCInterfaceType, clang::InjectedClassNameType, and clang::TagType.

Definition at line 1716 of file Type.h.

friend class ASTWriter [friend]

Definition at line 1717 of file Type.h.

friend class TypePropertyCache [friend]

Definition at line 1299 of file Type.h.


Member Data Documentation

union { ... } [protected]

Definition at line 1283 of file Type.h.

Definition at line 1284 of file Type.h.

Definition at line 1285 of file Type.h.

Definition at line 1286 of file Type.h.

Definition at line 1287 of file Type.h.

Referenced by clang::ObjCObjectType::ObjCObjectType().

Definition at line 1288 of file Type.h.

TypeBitfields clang::Type::TypeBits

Definition at line 1289 of file Type.h.

Definition at line 1290 of file Type.h.

Referenced by clang::VectorType::VectorType().


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