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> {
603 return RefType->getPointeeType();
613 Result.Stored.
isCanonical()) &&
"Type is not canonical!");
621 "Dynamic type does not meet the static type's requires");
623 Result.Stored = Other;
636 if (isa<U>(Stored.getTypePtr()))
648 assert(!Stored.isNull() && isa<U>(Stored.getTypePtr()));
657 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...
bool isAtLeastAsQualifiedAs(QualType Other) const
Determine whether this type is at least as qualified as the other given type, requiring exact equalit...
bool isCanonicalAsParam() const
Determines if this canonical type is furthermore canonical as a parameter. The parameter-canonicaliza...
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.
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.
CanTypeIterator(InputIterator Iter)
unsigned getCVRQualifiers() const
Retrieve the const/volatile/restrict qualifiers.
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
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
QualType withConst() const
Retrieves a version of this type with const applied. Note that this does not always yield a canonical...
static void * getAsVoidPointer(clang::CanQual< T > P)
ObjCObjectType::qual_iterator qual_iterator
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.
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.
QualType getCanonicalTypeInternal() const
const T * getTypePtrOrNull() const
Retrieve the underlying type pointer, which refers to a canonical type, or NULL.
A little helper class used to produce diagnostics.
CanQualType getCanonicalTypeUnqualified() const
ID
Defines the set of possible language-specific address spaces.
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...
SplitQualType split() const
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
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.
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)
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. The SourceManager can decode this to get at the full include stack...
const Type * getTypePtr() const
TypeOfType (GCC extension).
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)
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.
static const Type * getElementType(const Expr *BaseExpr)
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...
bool isCanonicalAsParam() const
CanProxy< T > operator->() const
Overloaded arrow operator that produces a canonical type proxy.
bool hasQualifiers() const
Determines whether this type has any qualifiers.
static CanQual< T > getFromOpaquePtr(void *Ptr)
Construct a canonical type from its internal representation.
bool isRestrictQualified() const
static __inline__ uint32_t uint32_t y
CanProxy< Type > operator->() const
Represents a C++ struct/union/class.
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.
bool isNull() const
isNull - Return true if this QualType doesn't point to a type yet.
static QualType getParamType(Sema &SemaRef, ArrayRef< ResultCandidate > Candidates, unsigned N)
Get the type of the Nth parameter from a given set of overload candidates.