15 #ifndef LLVM_CLANG_AST_CANONICALTYPE_H
16 #define LLVM_CLANG_AST_CANONICALTYPE_H
19 #include "llvm/ADT/iterator.h"
20 #include "llvm/Support/Casting.h"
51 template<
typename T = Type>
64 typename std::enable_if<std::is_base_of<T, U>::value,
int>::
type = 0);
187 template<
typename T,
typename U>
192 template<
typename T,
typename U>
206 DB << static_cast<QualType>(T);
214 #define LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(Accessor) \
215 CanQualType Accessor() const { \
216 return CanQualType::CreateUnsafe(this->getTypePtr()->Accessor()); \
219 #define LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Type, Accessor) \
220 Type Accessor() const { return this->getTypePtr()->Accessor(); }
240 operator const T*()
const {
return this->
Stored.getTypePtrOrNull(); }
245 return this->
Stored.template getAs<U>();
323 struct CanProxyAdaptor : CanProxyBase<T> { };
333 class CanProxy :
public CanProxyAdaptor<T> {
371 enum { NumLowBitsAvailable = 0 };
384 template <
typename InputIterator>
386 : llvm::iterator_adaptor_base<
387 CanTypeIterator<InputIterator>, InputIterator,
388 typename std::iterator_traits<InputIterator>::iterator_category,
390 typename std::iterator_traits<InputIterator>::difference_type,
391 CanProxy<Type>, CanQualType> {
606 return RefType->getPointeeType();
616 Result.Stored.
isCanonical()) &&
"Type is not canonical!");
624 "Dynamic type does not meet the static type's requires");
626 Result.Stored = Other;
639 if (isa<U>(Stored.getTypePtr()))
651 assert(!Stored.isNull() && isa<U>(Stored.getTypePtr()));
660 template <
typename InputIterator>
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...
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
PointerType - C99 6.7.5.1 - Pointer Declarators.
bool isAtLeastAsQualifiedAs(QualType Other) const
Determine whether this type is at least as qualified as the other given type, requiring exact equalit...
A (possibly-)qualified type.
bool isCanonicalAsParam() const
Determines if this canonical type is furthermore canonical as a parameter.
bool operator==(CanQual< T > x, CanQual< U > y)
#define LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(Accessor)
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
FunctionType - C99 6.7.5.3 - Function Declarators.
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.
static clang::CanQual< T > getFromVoidPointer(void *P)
CanProxy(CanQual< T > Stored)
Build a proxy to the given canonical type.
C Language Family Type Representation.
CanTypeIterator(InputIterator Iter)
unsigned getCVRQualifiers() const
Retrieve the const/volatile/restrict qualifiers.
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
The base class of the type hierarchy.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Canonical proxy type returned when retrieving the members of a canonical type or as the result of the...
bool isConstQualified() const
CanProxy< U > castAs() const
void * getAsOpaquePtr() const
CanProxy< U > getAs() const
Try to convert the given canonical type to a specific structural type.
CanProxy()
Build a NULL proxy.
void dump(const char *s) const
The collection of all-type qualifiers we support.
QualType withConst() const
Retrieves a version of this type with const applied.
RecordDecl - Represents a struct/union/class.
One of these records is kept for each identifier that is lexed.
struct ExtInfo & getExtInfo()
Represents a class type in Objective C.
static void * getAsVoidPointer(clang::CanQual< T > P)
ObjCObjectType::qual_iterator qual_iterator
An iterator over the qualifiers on the object type.
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.
An rvalue reference type, per C++11 [dcl.ref].
CanProxy< U > getAs() const
Retrieve a canonical type pointer with a different static type, upcasting or downcasting as needed...
static bool isBooleanType(QualType Ty)
SplitQualType split() const
Represents an ObjC class declaration.
detail::InMemoryDirectory::const_iterator I
QualType getCanonicalTypeInternal() const
Represents an extended vector type where either the type or size is dependent.
const T * getTypePtrOrNull() const
Retrieve the underlying type pointer, which refers to a canonical type, or NULL.
Represents a K&R-style 'int foo()' function, which has no information available about its arguments...
A little helper class used to produce diagnostics.
CanQualType getCanonicalTypeUnqualified() const
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...
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
Represents an array type in C++ whose size is a value-dependent expression.
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
const T * getTypePtr() const
Retrieve the pointer to the underlying Type.
void * getAsOpaquePtr() const
Retrieve the internal representation of this canonical type.
param_type_iterator param_type_end() const
const Type * getTypePtrOrNull() const
Expr - This represents one expression.
Qualifiers getQualifiers() const
Retrieve all qualifiers.
Declaration of a template type parameter.
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.
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...
bool isAtLeastAsQualifiedAs(CanQual< T > Other) const
Determines whether this canonical type is at least as qualified as the Other canonical type...
static SimpleType getSimplifiedValue(::clang::CanQual< T > Val)
Represents a GCC generic vector type.
An lvalue reference type, per C++11 [dcl.ref].
The result type of a method or function.
void Profile(llvm::FoldingSetNodeID &ID) const
unsigned getLocalCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers local to this particular QualType instan...
bool isVolatileQualified() const
Encodes a location in the source.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
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)
QualType withConst() const
Represents a canonical, potentially-qualified type.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
#define LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Type, Accessor)
const IdentifierInfo * getIdentifier() const
static QualType getFromOpaquePtr(const void *Ptr)
CanQual< Type > getNonReferenceType() const
If the canonical type is a reference type, returns the type that it refers to; otherwise, returns the type itself.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
Iterator adaptor that turns an iterator over canonical QualTypes into an iterator over CanQualTypes...
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.
bool isCanonicalAsParam() const
CanProxy< T > operator->() const
Overloaded arrow operator that produces a canonical type proxy.
Represents a pointer to an Objective C object.
bool hasQualifiers() const
Determines whether this type has any qualifiers.
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.
bool isRestrictQualified() const
ExtVectorType - Extended vector type.
Base for LValueReferenceType and RValueReferenceType.
CanProxy< Type > operator->() const
Represents a C++ struct/union/class.
Represents a C array with an unspecified size.
bool operator!=(CanQual< T > x, CanQual< U > y)
const T * getTypePtr() const
Retrieve the underlying type pointer, which refers to a canonical type.
static bool isCharType(QualType T)
bool isMoreQualifiedThan(CanQual< T > Other) const
Determines whether this canonical type is more qualified than the Other canonical type...
CanQualType operator*() const
CanQual()
Constructs a NULL canonical type.
Represents a C array with a specified size that is not an integer-constant-expression.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Represents the canonical version of C arrays with a specified constant size.
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.