15 #ifndef LLVM_CLANG_AST_CANONICALTYPE_H 16 #define LLVM_CLANG_AST_CANONICALTYPE_H 21 #include "llvm/ADT/ArrayRef.h" 22 #include "llvm/ADT/FoldingSet.h" 23 #include "llvm/ADT/iterator.h" 24 #include "llvm/Support/Casting.h" 25 #include "llvm/Support/PointerLikeTypeTraits.h" 28 #include <type_traits> 65 template<
typename T = Type>
78 typename std::enable_if<std::is_base_of<T, U>::value,
int>::
type = 0);
202 template<
typename T,
typename U>
207 template<
typename T,
typename U>
221 DB << static_cast<QualType>(
T);
229 #define LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(Accessor) \ 230 CanQualType Accessor() const { \ 231 return CanQualType::CreateUnsafe(this->getTypePtr()->Accessor()); \ 234 #define LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Type, Accessor) \ 235 Type Accessor() const { return this->getTypePtr()->Accessor(); } 260 return this->Stored.template getAs<U>();
388 enum { NumLowBitsAvailable = 0 };
401 template <
typename InputIterator>
403 : llvm::iterator_adaptor_base<
404 CanTypeIterator<InputIterator>, InputIterator,
405 typename std::iterator_traits<InputIterator>::iterator_category,
407 typename std::iterator_traits<InputIterator>::difference_type,
408 CanProxy<Type>, CanQualType> {
626 return RefType->getPointeeType();
635 assert((!Result || Result.Stored.getAsOpaquePtr() == (
void*)-1 ||
636 Result.Stored.isCanonical()) &&
"Type is not canonical!");
644 "Dynamic type does not meet the static type's requires");
646 Result.Stored = Other;
654 "ArrayType cannot be used with getAs!");
659 if (isa<U>(Stored.getTypePtr()))
669 "ArrayType cannot be used with castAs!");
671 assert(!Stored.isNull() && isa<U>(Stored.getTypePtr()));
680 template <
typename InputIterator>
687 #endif // LLVM_CLANG_AST_CANONICALTYPE_H static CanQual< T > CreateUnsafe(QualType Other)
Builds a canonical type from a QualType.
Replacable canonical proxy adaptor class that provides the link between a canonical type and the acce...
QualType withConst() const
Retrieves a version of this type with const applied.
static clang::CanQual< T > getFromVoidPointer(void *P)
SplitQualType split() const
PointerType - C99 6.7.5.1 - Pointer Declarators.
A (possibly-)qualified type.
bool operator==(CanQual< T > x, CanQual< U > y)
#define LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(Accessor)
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
bool isConstQualified() const
FunctionType - C99 6.7.5.3 - Function Declarators.
CanProxy(CanQual< T > Stored)
Build a proxy to the given canonical type.
C Language Family Type Representation.
CanTypeIterator(InputIterator Iter)
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
The base class of the type hierarchy.
void Profile(llvm::FoldingSetNodeID &ID) const
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
Canonical proxy type returned when retrieving the members of a canonical type or as the result of the...
QualType withConst() const
const T * getTypePtr() const
Retrieve the pointer to the underlying Type.
The collection of all-type qualifiers we support.
Qualifiers getQualifiers() const
Retrieve all qualifiers.
const T * getTypePtrOrNull() const
Retrieve the underlying type pointer, which refers to a canonical type, or nullptr.
RecordDecl - Represents a struct/union/class.
One of these records is kept for each identifier that is lexed.
bool isLocalRestrictQualified() const
Determine whether this particular QualType instance has the "restrict" qualifier set, without looking through typedefs that may have added "restrict" at a different level.
Represents a class type in Objective C.
bool isAtLeastAsQualifiedAs(QualType Other) const
Determine whether this type is at least as qualified as the other given type, requiring exact equalit...
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
An rvalue reference type, per C++11 [dcl.ref].
bool isRestrictQualified() const
Defines the Diagnostic-related interfaces.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
static bool isBooleanType(QualType Ty)
void * getAsOpaquePtr() const
Represents an ObjC class declaration.
static void * getAsVoidPointer(clang::CanQual< T > P)
const T * getTypePtr() const
Retrieve the underlying type pointer, which refers to a canonical type.
Represents an extended vector type where either the type or size is dependent.
Represents a K&R-style 'int foo()' function, which has no information available about its arguments...
A little helper class used to produce diagnostics.
Represents a prototype with parameter type info, e.g.
bool isMoreQualifiedThan(QualType Other) const
Determine whether this type is more qualified than the other given type, requiring exact equality for...
Expr - This represents one expression.
CanProxy< Type > operator->() const
const FunctionProtoType * T
Declaration of a template type parameter.
bool hasQualifiers() const
Determines whether this type has any qualifiers.
Represents the type decltype(expr) (C++11).
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
unsigned getCVRQualifiers() const
Retrieve the const/volatile/restrict qualifiers.
CanProxy< U > getAs() const
Try to convert the given canonical type to a specific structural type.
bool isAtLeastAsQualifiedAs(CanQual< T > Other) const
Determines whether this canonical type is at least as qualified as the Other canonical type...
CanProxy< T > operator->() const
Overloaded arrow operator that produces a canonical type proxy.
static SimpleType getSimplifiedValue(::clang::CanQual< T > Val)
Represents a GCC generic vector type.
An lvalue reference type, per C++11 [dcl.ref].
ObjCObjectType::qual_iterator qual_iterator
An iterator over the qualifiers on the object type.
The result type of a method or function.
CanQualType operator*() const
bool isNull() const
Return true if this QualType doesn't point to a type yet.
bool isVolatileQualified() const
static StringRef getIdentifier(const Token &Tok)
CanQualType getCanonicalTypeUnqualified() const
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
CanProxy< U > castAs() const
Encodes a location in the source.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
Represents typeof(type), a GCC extension.
Interfaces are the core concept in Objective-C for object oriented design.
TagDecl - Represents the declaration of a struct/union/class/enum.
static QualType getUnderlyingType(const SubRegion *R)
unsigned getLocalCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers local to this particular QualType instan...
Represents a canonical, potentially-qualified type.
#define LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Type, Accessor)
static QualType getFromOpaquePtr(const void *Ptr)
bool isLocalVolatileQualified() const
Determine whether this particular QualType instance has the "volatile" qualifier set, without looking through typedefs that may have added "volatile" at a different level.
bool isMoreQualifiedThan(CanQual< T > Other) const
Determines whether this canonical type is more qualified than the Other canonical type...
CanProxy< U > getAs() const
Retrieve a canonical type pointer with a different static type, upcasting or downcasting as needed...
Dataflow Directional Tag Classes.
Iterator adaptor that turns an iterator over canonical QualTypes into an iterator over CanQualTypes...
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
Base class of all canonical proxy types, which is responsible for storing the underlying canonical ty...
EnumDecl - Represents an enum.
A pointer to member type per C++ 8.3.3 - Pointers to members.
CanQual()=default
Constructs a NULL canonical type.
Represents a pointer to an Objective C object.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Complex values, per C99 6.2.5p11.
static CanQual< T > getFromOpaquePtr(void *Ptr)
Construct a canonical type from its internal representation.
std::integral_constant< bool, std::is_same< T, ArrayType >::value||std::is_base_of< ArrayType, T >::value > TypeIsArrayType
CanQual< Type > getNonReferenceType() const
If the canonical type is a reference type, returns the type that it refers to; otherwise, returns the type itself.
ExtVectorType - Extended vector type.
Base for LValueReferenceType and RValueReferenceType.
void * getAsOpaquePtr() const
Retrieve the internal representation of this canonical type.
const Type * getTypePtrOrNull() const
bool isCanonicalAsParam() const
Defines the clang::SourceLocation class and associated facilities.
Represents a C++ struct/union/class.
bool isLocalConstQualified() const
Determine whether this particular QualType instance has the "const" qualifier set, without looking through typedefs that may have added "const" at a different level.
param_type_iterator param_type_begin() const
param_type_iterator param_type_end() const
bool operator!=(CanQual< T > x, CanQual< U > y)
static bool isCharType(QualType T)
bool isCanonicalAsParam() const
Determines if this canonical type is furthermore canonical as a parameter.
void dump(const char *s) const
A class which abstracts out some details necessary for making a call.
static QualType getParamType(Sema &SemaRef, ArrayRef< ResultCandidate > Candidates, unsigned N)
Get the type of the Nth parameter from a given set of overload candidates.