14#ifndef LLVM_CLANG_AST_CANONICALTYPE_H
15#define LLVM_CLANG_AST_CANONICALTYPE_H
20#include "llvm/ADT/ArrayRef.h"
21#include "llvm/ADT/FoldingSet.h"
22#include "llvm/ADT/iterator.h"
23#include "llvm/Support/Casting.h"
24#include "llvm/Support/PointerLikeTypeTraits.h"
31template<
typename T>
class CanProxy;
32template<
typename T>
struct CanProxyAdaptor;
37class ObjCInterfaceDecl;
40class TemplateTypeParmDecl;
64template<
typename T = Type>
77 std::enable_if_t<std::is_base_of<T, U>::value,
int> = 0);
201template<
typename T,
typename U>
206template<
typename T,
typename U>
220 DB << static_cast<QualType>(
T);
228#define LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(Accessor) \
229CanQualType Accessor() const { \
230return CanQualType::CreateUnsafe(this->getTypePtr()->Accessor()); \
233#define LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Type, Accessor) \
234Type Accessor() const { return this->getTypePtr()->Accessor(); }
259 return this->Stored.template getAs<U>();
380 return P.getAsOpaquePtr();
388 static constexpr int NumLowBitsAvailable = 0;
401template <
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!");
642 assert((
Other.isNull() ||
Other.isCanonical()) &&
"Type is not canonical!");
643 assert((
Other.isNull() || isa<T>(
Other.getTypePtr())) &&
644 "Dynamic type does not meet the static type's requires");
654 "ArrayType cannot be used with getAs!");
669 "ArrayType cannot be used with castAs!");
680template <
typename InputIterator>
Defines the Diagnostic-related interfaces.
static bool isBooleanType(QualType Ty)
static std::optional< NonLoc > getIndex(ProgramStateRef State, const ElementRegion *ER, CharKind CK)
#define LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(Accessor)
#define LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Type, Accessor)
static StringRef getIdentifier(const Token &Tok)
static QualType getUnderlyingType(const SubRegion *R)
static QualType getParamType(Sema &SemaRef, ArrayRef< ResultCandidate > Candidates, unsigned N)
Get the type of the Nth parameter from a given set of overload candidates.
static bool isParameterPack(Expr *PackExpression)
Defines the clang::SourceLocation class and associated facilities.
static QualType getPointeeType(const MemRegion *R)
C Language Family Type Representation.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Represents a C++ struct/union/class.
Base class of all canonical proxy types, which is responsible for storing the underlying canonical ty...
CanProxy< U > getAs() const
Try to convert the given canonical type to a specific structural type.
const T * getTypePtr() const
Retrieve the pointer to the underlying Type.
Canonical proxy type returned when retrieving the members of a canonical type or as the result of the...
CanProxy(CanQual< T > Stored)
Build a proxy to the given canonical type.
CanProxy()=default
Build a NULL proxy.
Represents a canonical, potentially-qualified type.
bool isMoreQualifiedThan(CanQual< T > Other) const
Determines whether this canonical type is more qualified than the Other canonical type.
void * getAsOpaquePtr() const
Retrieve the internal representation of this canonical type.
CanQual< Type > getNonReferenceType() const
If the canonical type is a reference type, returns the type that it refers to; otherwise,...
CanQual()=default
Constructs a NULL canonical type.
const T * getTypePtrOrNull() const
Retrieve the underlying type pointer, which refers to a canonical type, or nullptr.
bool isRestrictQualified() const
unsigned getCVRQualifiers() const
Retrieve the const/volatile/restrict qualifiers.
CanProxy< T > operator->() const
Overloaded arrow operator that produces a canonical type proxy.
SplitQualType split() const
bool hasQualifiers() const
Determines whether this type has any qualifiers.
static CanQual< T > CreateUnsafe(QualType Other)
Builds a canonical type from a QualType.
QualType withConst() const
Retrieves a version of this type with const applied.
CanQual(const CanQual< U > &Other, std::enable_if_t< std::is_base_of< T, U >::value, int >=0)
Converting constructor that permits implicit upcasting of canonical type pointers.
CanProxy< U > castAs() const
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
bool isConstQualified() const
bool isCanonicalAsParam() const
Determines if this canonical type is furthermore canonical as a parameter.
Qualifiers getQualifiers() const
Retrieve all qualifiers.
void Profile(llvm::FoldingSetNodeID &ID) const
CanProxy< U > getAs() const
Retrieve a canonical type pointer with a different static type, upcasting or downcasting as needed.
static CanQual< T > getFromOpaquePtr(void *Ptr)
Construct a canonical type from its internal representation.
bool isAtLeastAsQualifiedAs(CanQual< T > Other) const
Determines whether this canonical type is at least as qualified as the Other canonical type.
bool isVolatileQualified() const
const T * getTypePtr() const
Retrieve the underlying type pointer, which refers to a canonical type.
Complex values, per C99 6.2.5p11.
Represents the canonical version of C arrays with a specified constant size.
Represents the type decltype(expr) (C++11).
Represents an array type in C++ whose size is a value-dependent expression.
Represents an extended vector type where either the type or size is dependent.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
This represents one expression.
ExtVectorType - Extended vector type.
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a prototype with parameter type info, e.g.
A class which abstracts out some details necessary for making a call.
FunctionType - C99 6.7.5.3 - Function Declarators.
One of these records is kept for each identifier that is lexed.
Represents a C array with an unspecified size.
An lvalue reference type, per C++11 [dcl.ref].
A pointer to member type per C++ 8.3.3 - Pointers to members.
Represents an ObjC class declaration.
Interfaces are the core concept in Objective-C for object oriented design.
Represents a pointer to an Objective C object.
Represents a class type in Objective C.
PointerType - C99 6.7.5.1 - Pointer Declarators.
A (possibly-)qualified type.
bool isLocalConstQualified() const
Determine whether this particular QualType instance has the "const" qualifier set,...
bool isLocalRestrictQualified() const
Determine whether this particular QualType instance has the "restrict" qualifier set,...
QualType withConst() const
bool isAtLeastAsQualifiedAs(QualType Other) const
Determine whether this type is at least as qualified as the other given type, requiring exact equalit...
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
static QualType getFromOpaquePtr(const void *Ptr)
void dump(const char *s) const
unsigned getLocalCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers local to this particular QualType instan...
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
void * getAsOpaquePtr() const
bool isCanonicalAsParam() const
bool isMoreQualifiedThan(QualType Other) const
Determine whether this type is more qualified than the other given type, requiring exact equality for...
bool isLocalVolatileQualified() const
Determine whether this particular QualType instance has the "volatile" qualifier set,...
const Type * getTypePtrOrNull() const
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
The collection of all-type qualifiers we support.
An rvalue reference type, per C++11 [dcl.ref].
Represents a struct/union/class.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Base for LValueReferenceType and RValueReferenceType.
Encodes a location in the source.
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
Represents the declaration of a struct/union/class/enum.
Declaration of a template type parameter.
Represents typeof(type), a C23 feature and GCC extension, or `typeof_unqual(type),...
The base class of the type hierarchy.
CanQualType getCanonicalTypeUnqualified() const
QualType getCanonicalTypeInternal() const
Represents a C array with a specified size that is not an integer-constant-expression.
Represents a GCC generic vector type.
The JSON file list parser is used to communicate input to InstallAPI.
bool operator==(const CallGraphNode::CallRecord &LHS, const CallGraphNode::CallRecord &RHS)
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
@ Result
The result type of a method or function.
bool operator!=(CanQual< T > x, CanQual< U > y)
std::integral_constant< bool, std::is_same< T, ArrayType >::value||std::is_base_of< ArrayType, T >::value > TypeIsArrayType
const FunctionProtoType * T
@ Other
Other implicit parameter.
Diagnostic wrappers for TextAPI types for error reporting.
param_type_iterator param_type_end() const
Replaceable canonical proxy adaptor class that provides the link between a canonical type and the acc...
Iterator adaptor that turns an iterator over canonical QualTypes into an iterator over CanQualTypes.
CanQualType operator*() const
CanProxy< Type > operator->() const
CanTypeIterator()=default
CanTypeIterator(InputIterator Iter)
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
static clang::CanQual< T > getFromVoidPointer(void *P)
static void * getAsVoidPointer(clang::CanQual< T > P)
static SimpleType getSimplifiedValue(::clang::CanQual< T > Val)