clang API Documentation
Represents a canonical, potentially-qualified type. More...
#include <CanonicalType.h>

Public Member Functions | |
| CanQual () | |
| Constructs a NULL canonical type. | |
| template<typename U > | |
| CanQual (const CanQual< U > &Other, typename llvm::enable_if< llvm::is_base_of< T, U >, int >::type=0) | |
| Converting constructor that permits implicit upcasting of canonical type pointers. | |
| const T * | getTypePtr () const |
| Retrieve the underlying type pointer, which refers to a canonical type. | |
| const T * | getTypePtrOrNull () const |
| Retrieve the underlying type pointer, which refers to a canonical type, or NULL. | |
| operator QualType () const | |
| Implicit conversion to a qualified type. | |
| operator bool () const | |
| Implicit conversion to bool. | |
| 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. | |
| CanProxy< T > | operator-> () const |
| Overloaded arrow operator that produces a canonical type proxy. | |
| Qualifiers | getQualifiers () const |
| Retrieve all qualifiers. | |
| unsigned | getCVRQualifiers () const |
| Retrieve the const/volatile/restrict qualifiers. | |
| bool | hasQualifiers () const |
| Determines whether this type has any qualifiers. | |
| bool | isConstQualified () const |
| bool | isVolatileQualified () const |
| bool | isRestrictQualified () const |
| bool | isCanonicalAsParam () const |
| Determines if this canonical type is furthermore canonical as a parameter. The parameter-canonicalization process decays arrays to pointers and drops top-level qualifiers. | |
| CanQual< T > | getUnqualifiedType () const |
| Retrieve the unqualified form of this type. | |
| QualType | withConst () const |
| Retrieves a version of this type with const applied. Note that this does not always yield a canonical type. | |
| bool | isMoreQualifiedThan (CanQual< T > Other) const |
Determines whether this canonical type is more qualified than the Other canonical type. | |
| bool | isAtLeastAsQualifiedAs (CanQual< T > Other) const |
Determines whether this canonical type is at least as qualified as the Other canonical type. | |
| CanQual< Type > | getNonReferenceType () const |
| If the canonical type is a reference type, returns the type that it refers to; otherwise, returns the type itself. | |
| void * | getAsOpaquePtr () const |
| Retrieve the internal representation of this canonical type. | |
| 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. | |
| static CanQual< T > | CreateUnsafe (QualType Other) |
| Builds a canonical type from a QualType. | |
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 53 of file CanonicalType.h.
| clang::CanQual< T >::CanQual | ( | ) | [inline] |
Constructs a NULL canonical type.
Definition at line 59 of file CanonicalType.h.
| clang::CanQual< T >::CanQual | ( | const CanQual< U > & | Other, |
| typename llvm::enable_if< llvm::is_base_of< T, U >, int >::type | = 0 |
||
| ) |
Converting constructor that permits implicit upcasting of canonical type pointers.
| CanQual< T > clang::CanQual< T >::CreateUnsafe | ( | QualType | Other | ) | [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 734 of file CanonicalType.h.
References clang::QualType::getTypePtr(), clang::QualType::isCanonical(), and clang::QualType::isNull().
Referenced by clang::CanQual< T >::getAs(), and clang::CanQual< T >::getUnqualifiedType().
| void clang::CanQual< T >::dump | ( | ) | const [inline] |
Definition at line 179 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:
void f(CanQual<Type> T) { if (CanQual<PointerType> Ptr = T->getAs<PointerType>()) { // look at Ptr's pointee type } }
U). If the dynamic type is not the specified static type or a derived class thereof, a NULL canonical type. Definition at line 745 of file CanonicalType.h.
References clang::CanQual< T >::CreateUnsafe().
Referenced by clang::CodeGen::CodeGenTypes::getFunctionInfo(), clang::getSimplifiedTypeClass(), IsModifiable(), clang::Sema::IsNoReturnConversion(), IsProvablyNotDerivedFrom(), MatchesFriend(), and TryStaticDowncast().
| void* clang::CanQual< T >::getAsOpaquePtr | ( | ) | const [inline] |
Retrieve the internal representation of this canonical type.
Definition at line 167 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().
| unsigned clang::CanQual< T >::getCVRQualifiers | ( | ) | const [inline] |
Retrieve the const/volatile/restrict qualifiers.
Definition at line 119 of file CanonicalType.h.
Referenced by clang::CXXConstructorDecl::isCopyOrMoveConstructor().
| CanQual< T > clang::CanQual< T >::getFromOpaquePtr | ( | void * | Ptr | ) | [static] |
Construct a canonical type from its internal representation.
Definition at line 725 of file CanonicalType.h.
References clang::QualType::getAsOpaquePtr(), clang::QualType::getFromOpaquePtr(), and clang::QualType::isCanonical().
| CanQual< Type > clang::CanQual< T >::getNonReferenceType | ( | ) | const [inline] |
If the canonical type is a reference type, returns the type that it refers to; otherwise, returns the type itself.
Definition at line 717 of file CanonicalType.h.
Referenced by clang::ConversionFixItGenerator::compareTypesSimple().
| Qualifiers clang::CanQual< T >::getQualifiers | ( | ) | const [inline] |
Retrieve all qualifiers.
Definition at line 116 of file CanonicalType.h.
Referenced by BuildFieldReferenceExpr(), InitCatchParam(), and MightInstantiateTo().
| const T* clang::CanQual< T >::getTypePtr | ( | ) | const [inline] |
Retrieve the underlying type pointer, which refers to a canonical type.
The underlying pointer must not be NULL.
Definition at line 71 of file CanonicalType.h.
Referenced by clang::ASTContext::getIntegerTypeOrder(), GetKeyForBase(), clang::CodeGen::CodeGenTBAA::getTBAAInfo(), clang::ASTContext::hasSameUnqualifiedType(), and matchTypes().
| const T* clang::CanQual< T >::getTypePtrOrNull | ( | ) | const [inline] |
Retrieve the underlying type pointer, which refers to a canonical type, or NULL.
Definition at line 76 of file CanonicalType.h.
| CanQual< T > clang::CanQual< T >::getUnqualifiedType | ( | ) | const [inline] |
Retrieve the unqualified form of this type.
Definition at line 712 of file CanonicalType.h.
References clang::CanQual< T >::CreateUnsafe().
Referenced by clang::Sema::ActOnConversionDeclarator(), clang::Sema::ActOnPropertyImplDecl(), clang::Sema::CheckConstructor(), clang::Sema::CheckDerivedToBaseConversion(), clang::Sema::CheckEquivalentExceptionSpec(), clang::Sema::CheckObjCARCUnavailableWeakConversion(), CheckOperatorNewDeleteTypes(), clang::ConversionFixItGenerator::compareTypesSimple(), clang::DeclarationNameTable::getCXXConstructorName(), clang::DeclarationNameTable::getCXXDestructorName(), clang::ento::MemRegionManager::getElementRegion(), getFunctionInfo(), clang::CodeGen::CodeGenTypes::getFunctionInfo(), clang::CXXBasePaths::isAmbiguous(), clang::CXXConstructorDecl::isCopyOrMoveConstructor(), clang::CXXConstructorDecl::isSpecializationCopyingObject(), clang::analyze_format_string::ArgTypeResult::matchesType(), matchTypes(), clang::ASTContext::mergeFunctionTypes(), TryStaticDowncast(), and clang::TryUserDefinedConversion().
| bool clang::CanQual< T >::hasQualifiers | ( | ) | const [inline] |
Determines whether this type has any qualifiers.
Definition at line 122 of file CanonicalType.h.
Referenced by clang::DeclarationNameTable::getCXXSpecialName().
| bool clang::CanQual< T >::isAtLeastAsQualifiedAs | ( | CanQual< T > | Other | ) | const [inline] |
Determines whether this canonical type is at least as qualified as the Other canonical type.
Definition at line 158 of file CanonicalType.h.
Referenced by clang::ConversionFixItGenerator::compareTypesSimple(), and TryStaticDowncast().
| bool clang::CanQual< T >::isCanonicalAsParam | ( | ) | const [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 137 of file CanonicalType.h.
| bool clang::CanQual< T >::isConstQualified | ( | ) | const [inline] |
Definition at line 124 of file CanonicalType.h.
Referenced by IsModifiable().
| bool clang::CanQual< T >::isMoreQualifiedThan | ( | CanQual< T > | Other | ) | const [inline] |
Determines whether this canonical type is more qualified than the Other canonical type.
Definition at line 152 of file CanonicalType.h.
| bool clang::CanQual< T >::isNull | ( | ) | const [inline] |
Definition at line 86 of file CanonicalType.h.
Referenced by clang::ASTContext::InitBuiltinTypes(), and clang::CanQual< ObjCObjectType >::operator bool().
| bool clang::CanQual< T >::isRestrictQualified | ( | ) | const [inline] |
Definition at line 130 of file CanonicalType.h.
| bool clang::CanQual< T >::isVolatileQualified | ( | ) | const [inline] |
Definition at line 127 of file CanonicalType.h.
Referenced by clang::AddBuiltinAssignmentOperatorCandidates(), and clang::Expr::isUnusedResultAWarning().
| clang::CanQual< T >::operator bool | ( | ) | const [inline] |
Implicit conversion to bool.
Definition at line 84 of file CanonicalType.h.
| clang::CanQual< T >::operator QualType | ( | ) | const [inline] |
Implicit conversion to a qualified type.
Definition at line 81 of file CanonicalType.h.
| CanProxy< T > clang::CanQual< T >::operator-> | ( | ) | const |
Overloaded arrow operator that produces a canonical type proxy.
Definition at line 756 of file CanonicalType.h.
| void clang::CanQual< T >::Profile | ( | llvm::FoldingSetNodeID & | ID | ) | const [inline] |
Definition at line 181 of file CanonicalType.h.
Referenced by clang::CodeGen::CGFunctionInfo::Profile().
| SplitQualType clang::CanQual< T >::split | ( | ) | const [inline] |
Definition at line 90 of file CanonicalType.h.
Referenced by clang::ASTContext::getConstantArrayType(), clang::ASTContext::getDependentSizedArrayType(), clang::ASTContext::getIncompleteArrayType(), and clang::ASTContext::getVariableArrayType().
| QualType clang::CanQual< T >::withConst | ( | ) | const [inline] |
Retrieves a version of this type with const applied. Note that this does not always yield a canonical type.
Definition at line 146 of file CanonicalType.h.
Referenced by clang::CodeGen::CodeGenModule::GetAddrOfConstantString(), clang::analyze_printf::PrintfSpecifier::getArgType(), and clang::ASTContext::getCFConstantStringType().