|
clang
5.0.0
|
Represents a canonical, potentially-qualified type. More...
#include "clang/AST/CanonicalType.h"
Public Member Functions | |
| CanQual () | |
| Constructs a NULL canonical type. More... | |
| template<typename U > | |
| CanQual (const CanQual< U > &Other, typename std::enable_if< std::is_base_of< T, U >::value, int >::type=0) | |
| Converting constructor that permits implicit upcasting of canonical type pointers. More... | |
| const T * | getTypePtr () const |
| Retrieve the underlying type pointer, which refers to a canonical type. More... | |
| const T * | getTypePtrOrNull () const |
| Retrieve the underlying type pointer, which refers to a canonical type, or NULL. More... | |
| operator QualType () const | |
| Implicit conversion to a qualified type. More... | |
| operator bool () const | |
| Implicit conversion to bool. More... | |
| bool | isNull () const |
| SplitQualType | split () const |
| template<typename U > | |
| CanProxy< U > | getAs () const |
| Retrieve a canonical type pointer with a different static type, upcasting or downcasting as needed. More... | |
| template<typename U > | |
| CanProxy< U > | castAs () const |
| CanProxy< T > | operator-> () const |
| Overloaded arrow operator that produces a canonical type proxy. More... | |
| Qualifiers | getQualifiers () const |
| Retrieve all qualifiers. More... | |
| unsigned | getCVRQualifiers () const |
| Retrieve the const/volatile/restrict qualifiers. More... | |
| bool | hasQualifiers () const |
| Determines whether this type has any qualifiers. More... | |
| bool | isConstQualified () const |
| bool | isVolatileQualified () const |
| bool | isRestrictQualified () const |
| bool | isCanonicalAsParam () const |
| Determines if this canonical type is furthermore canonical as a parameter. More... | |
| CanQual< T > | getUnqualifiedType () const |
| Retrieve the unqualified form of this type. More... | |
| QualType | withConst () const |
| Retrieves a version of this type with const applied. More... | |
| bool | isMoreQualifiedThan (CanQual< T > Other) const |
Determines whether this canonical type is more qualified than the Other canonical type. More... | |
| bool | isAtLeastAsQualifiedAs (CanQual< T > Other) const |
Determines whether this canonical type is at least as qualified as the Other canonical type. More... | |
| CanQual< Type > | getNonReferenceType () const |
| If the canonical type is a reference type, returns the type that it refers to; otherwise, returns the type itself. More... | |
| void * | getAsOpaquePtr () const |
| Retrieve the internal representation of this canonical type. More... | |
| void | dump () const |
| void | Profile (llvm::FoldingSetNodeID &ID) const |
Static Public Member Functions | |
| static CanQual< T > | getFromOpaquePtr (void *Ptr) |
| Construct a canonical type from its internal representation. More... | |
| static CanQual< T > | CreateUnsafe (QualType Other) |
| Builds a canonical type from a QualType. More... | |
Represents a canonical, potentially-qualified type.
The CanQual template is a lightweight smart pointer that provides access to the canonical representation of a type, where all typedefs and other syntactic sugar has been eliminated. A CanQualType may also have various qualifiers (const, volatile, restrict) attached to it.
The template type parameter T is one of the Type classes (PointerType, BuiltinType, etc.). The type stored within CanQual<T> will be of that type (or some subclass of that type). The typedef CanQualType is just a shorthand for CanQual<Type>.
An instance of CanQual<T> can be implicitly converted to a CanQual<U> when T is derived from U, which essentially provides an implicit upcast. For example, CanQual<LValueReferenceType> can be converted to CanQual<ReferenceType>. Note that any CanQual type can be implicitly converted to a QualType, but the reverse operation requires a call to ASTContext::getCanonicalType().
Definition at line 52 of file CanonicalType.h.
|
inline |
Constructs a NULL canonical type.
Definition at line 58 of file CanonicalType.h.
| clang::CanQual< T >::CanQual | ( | const CanQual< U > & | Other, |
| typename std::enable_if< std::is_base_of< T, U >::value, int >::type | = 0 |
||
| ) |
Converting constructor that permits implicit upcasting of canonical type pointers.
Definition at line 647 of file CanonicalType.h.
References clang::CanQual< T >::CreateUnsafe().
Referenced by clang::CodeGen::CodeGenTypes::arrangeFunctionDeclaration().
|
static |
Builds a canonical type from a QualType.
This routine is inherently unsafe, because it requires the user to ensure that the given type is a canonical type with the correct
Definition at line 621 of file CanonicalType.h.
References clang::QualType::getTypePtr(), clang::QualType::isCanonical(), clang::QualType::isNull(), and Result.
Referenced by clang::CanQual< T >::castAs(), clang::CanQual< T >::getAs(), and clang::CanQual< T >::getUnqualifiedType().
|
inline |
Definition at line 180 of file CanonicalType.h.
Retrieve a canonical type pointer with a different static type, upcasting or downcasting as needed.
The getAs() function is typically used to try to downcast to a more specific (canonical) type in the type system. For example:
U). If the dynamic type is not the specified static type or a derived class thereof, a NULL canonical type. Definition at line 632 of file CanonicalType.h.
References clang::CanQual< T >::CreateUnsafe().
Referenced by clang::CodeGen::CodeGenTypes::arrangeCXXMethodType(), clang::CodeGen::CodeGenTypes::arrangeFunctionDeclaration(), DiagnoseBadConversion(), GetFormalType(), clang::getSimplifiedTypeClass(), clang::Sema::IsFunctionConversion(), IsModifiable(), clang::Sema::isSameOrCompatibleFunctionType(), MatchesFriend(), and TryStaticDowncast().
|
inline |
Retrieve the internal representation of this canonical type.
Definition at line 168 of file CanonicalType.h.
Referenced by llvm::PointerLikeTypeTraits< clang::CanQual< T > >::getAsVoidPointer(), clang::DeclarationNameTable::getCXXSpecialName(), llvm::DenseMapInfo< clang::CanQualType >::getHashValue(), clang::operator!=(), clang::operator==(), and clang::CanQual< ObjCObjectType >::Profile().
|
inline |
Retrieve the const/volatile/restrict qualifiers.
Definition at line 120 of file CanonicalType.h.
Referenced by clang::CXXConstructorDecl::isCopyOrMoveConstructor().
|
static |
Construct a canonical type from its internal representation.
Definition at line 612 of file CanonicalType.h.
References clang::QualType::getAsOpaquePtr(), clang::QualType::getFromOpaquePtr(), clang::QualType::isCanonical(), and Result.
Referenced by llvm::PointerLikeTypeTraits< clang::CanQual< T > >::getFromVoidPointer().
|
inline |
If the canonical type is a reference type, returns the type that it refers to; otherwise, returns the type itself.
Definition at line 604 of file CanonicalType.h.
Referenced by clang::ConversionFixItGenerator::compareTypesSimple().
|
inline |
Retrieve all qualifiers.
Definition at line 117 of file CanonicalType.h.
Referenced by clang::Sema::BuildFieldReferenceExpr(), DiagnoseBadConversion(), clang::ASTContext::getCanonicalFunctionResultType(), InitCatchParam(), IsModifiable(), and MightInstantiateTo().
|
inline |
Retrieve the underlying type pointer, which refers to a canonical type.
The underlying pointer must not be NULL.
Definition at line 70 of file CanonicalType.h.
Referenced by clang::Sema::ActOnTag(), appendParameterTypes(), clang::CodeGen::CodeGenTypes::arrangeCXXConstructorCall(), clang::CodeGen::CodeGenTypes::arrangeCXXMethodDeclaration(), clang::CodeGen::RequiredArgs::forPrototype(), clang::CodeGen::RequiredArgs::forPrototypePlus(), clang::ASTContext::getIntegerTypeOrder(), GetKeyForBase(), llvm::simplify_type< ::clang::CanQual< T > >::getSimplifiedValue(), clang::CodeGen::CodeGenTBAA::getTBAAInfo(), clang::CodeGen::CodeGenTBAA::getTBAAStructInfo(), clang::CodeGen::CodeGenTBAA::getTBAAStructTagInfo(), clang::CodeGen::CodeGenTBAA::getTBAAStructTypeInfo(), clang::ASTContext::hasSameUnqualifiedType(), and matchTypes().
|
inline |
Retrieve the underlying type pointer, which refers to a canonical type, or NULL.
Definition at line 75 of file CanonicalType.h.
|
inline |
Retrieve the unqualified form of this type.
Definition at line 599 of file CanonicalType.h.
References clang::CanQual< T >::CreateUnsafe().
Referenced by clang::Sema::ActOnConversionDeclarator(), clang::Sema::ActOnPropertyImplDecl(), clang::Sema::AddConversionCandidate(), clang::CodeGen::CodeGenTypes::arrangeFreeFunctionType(), arrangeLLVMFunctionInfo(), clang::Sema::AttachBaseSpecifiers(), clang::Sema::CheckAssignmentConstraints(), clang::Sema::CheckConstructor(), clang::Sema::CheckDerivedToBaseConversion(), clang::CheckEquivalentExceptionSpecImpl(), clang::Sema::CheckObjCARCUnavailableWeakConversion(), CheckOperatorNewDeleteTypes(), clang::Sema::CheckSubtractionOperands(), clang::ConversionFixItGenerator::compareTypesSimple(), DeduceTemplateArgumentsByTypeMatch(), DiagnoseBadConversion(), clang::Sema::DiagnosePropertyAccessorMismatch(), clang::Sema::ExtractUnqualifiedFunctionType(), clang::ASTContext::getCanonicalFunctionResultType(), clang::DeclarationNameTable::getCXXConstructorName(), clang::DeclarationNameTable::getCXXDestructorName(), clang::ento::MemRegionManager::getElementRegion(), GetReturnType(), clang::CXXBasePaths::isAmbiguous(), clang::CXXConstructorDecl::isCopyOrMoveConstructor(), clang::CXXConstructorDecl::isSpecializationCopyingObject(), clang::analyze_format_string::ArgType::matchesType(), matchTypes(), clang::ASTContext::mergeFunctionTypes(), and TryUserDefinedConversion().
|
inline |
Determines whether this type has any qualifiers.
Definition at line 123 of file CanonicalType.h.
Referenced by clang::DeclarationNameTable::getCXXSpecialName().
|
inline |
Determines whether this canonical type is at least as qualified as the Other canonical type.
Definition at line 159 of file CanonicalType.h.
Referenced by clang::ConversionFixItGenerator::compareTypesSimple(), DiagnoseBadConversion(), and TryStaticDowncast().
|
inline |
Determines if this canonical type is furthermore canonical as a parameter.
The parameter-canonicalization process decays arrays to pointers and drops top-level qualifiers.
Definition at line 138 of file CanonicalType.h.
|
inline |
Definition at line 125 of file CanonicalType.h.
Referenced by IsModifiable().
|
inline |
Determines whether this canonical type is more qualified than the Other canonical type.
Definition at line 153 of file CanonicalType.h.
|
inline |
Definition at line 85 of file CanonicalType.h.
Referenced by clang::ASTContext::InitBuiltinTypes(), and clang::CanQual< ObjCObjectType >::operator bool().
|
inline |
Definition at line 131 of file CanonicalType.h.
|
inline |
Definition at line 128 of file CanonicalType.h.
Referenced by AddBuiltinAssignmentOperatorCandidates().
|
inlineexplicit |
Implicit conversion to bool.
Definition at line 83 of file CanonicalType.h.
|
inline |
Implicit conversion to a qualified type.
Definition at line 80 of file CanonicalType.h.
| CanProxy< T > clang::CanQual< T >::operator-> | ( | ) | const |
Overloaded arrow operator that produces a canonical type proxy.
Definition at line 656 of file CanonicalType.h.
|
inline |
Definition at line 182 of file CanonicalType.h.
Referenced by clang::CodeGen::CGFunctionInfo::Profile().
|
inline |
Definition at line 89 of file CanonicalType.h.
Referenced by clang::ASTContext::getConstantArrayType(), clang::ASTContext::getDependentSizedArrayType(), clang::ASTContext::getIncompleteArrayType(), and clang::ASTContext::getVariableArrayType().
|
inline |
Retrieves a version of this type with const applied.
Note that this does not always yield a canonical type.
Definition at line 147 of file CanonicalType.h.
Referenced by clang::Sema::ActOnIndirectGotoStmt(), clang::Sema::ActOnNumericConstant(), clang::Sema::ActOnOpenMPRegionStart(), clang::Sema::BuildObjCBoxedExpr(), clang::Sema::BuildPredefinedExpr(), clang::analyze_printf::PrintfSpecifier::getArgType(), and clang::ASTContext::getCFConstantStringDecl().
1.8.6