clang 22.0.0git
CanonicalType.h
Go to the documentation of this file.
1/===- CanonicalType.h - C Language Family Type Representation --*- C++ -*-===/
2/
3/ Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4/ See https://llvm.org/LICENSE.txt for license information.
5/ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6/
7/===----------------------------------------------------------------------===/
8/
9/ This file defines the CanQual class template, which provides access to
10/ canonical types.
11/
12/===----------------------------------------------------------------------===/
13
14#ifndef LLVM_CLANG_AST_CANONICALTYPE_H
15#define LLVM_CLANG_AST_CANONICALTYPE_H
16
17#include "clang/AST/Type.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"
25#include <cassert>
26#include <iterator>
27#include <type_traits>
28
29namespace clang {
30
31template<typename T> class CanProxy;
32template<typename T> struct CanProxyAdaptor;
33class ASTContext;
34class CXXRecordDecl;
35class EnumDecl;
36class Expr;
37class IdentifierInfo;
39class RecordDecl;
40class TagDecl;
42
43/----------------------------------------------------------------------------/
44/ Canonical, qualified type template
45/----------------------------------------------------------------------------/
46
47/ Represents a canonical, potentially-qualified type.
48/
49/ The CanQual template is a lightweight smart pointer that provides access
50/ to the canonical representation of a type, where all typedefs and other
51/ syntactic sugar has been eliminated. A CanQualType may also have various
52/ qualifiers (const, volatile, restrict) attached to it.
53/
54/ The template type parameter @p T is one of the Type classes (PointerType,
55/ BuiltinType, etc.). The type stored within @c CanQual<T> will be of that
56/ type (or some subclass of that type). The typedef @c CanQualType is just
57/ a shorthand for @c CanQual<Type>.
58/
59/ An instance of @c CanQual<T> can be implicitly converted to a
60/ @c CanQual<U> when T is derived from U, which essentially provides an
61/ implicit upcast. For example, @c CanQual<LValueReferenceType> can be
62/ converted to @c CanQual<ReferenceType>. Note that any @c CanQual type can
63/ be implicitly converted to a QualType, but the reverse operation requires
64/ a call to ASTContext::getCanonicalType().
65template<typename T = Type>
66class CanQual {
67 / The actual, canonical type.
68 QualType Stored;
69
70public:
71 / Constructs a NULL canonical type.
72 CanQual() = default;
73
74 / Converting constructor that permits implicit upcasting of
75 / canonical type pointers.
76 template <typename U>
78 std::enable_if_t<std::is_base_of<T, U>::value, int> = 0);
79
80 / Retrieve the underlying type pointer, which refers to a
81 / canonical type.
82 /
83 / The underlying pointer must not be nullptr.
84 const T *getTypePtr() const { return cast<T>(Stored.getTypePtr()); }
85
86 / Retrieve the underlying type pointer, which refers to a
87 / canonical type, or nullptr.
88 const T *getTypePtrOrNull() const {
89 return cast_or_null<T>(Stored.getTypePtrOrNull());
90 }
91
92 / Implicit conversion to a qualified type.
93 operator QualType() const { return Stored; }
94
95 / Implicit conversion to bool.
96 explicit operator bool() const { return !isNull(); }
97
98 bool isNull() const {
99 return Stored.isNull();
100 }
101
102 SplitQualType split() const { return Stored.split(); }
103
104 / Retrieve a canonical type pointer with a different static type,
105 / upcasting or downcasting as needed.
106 /
107 / The getAs() function is typically used to try to downcast to a
108 / more specific (canonical) type in the type system. For example:
109 /
110 / @code
111 / void f(CanQual<Type> T) {
112 / if (CanQual<PointerType> Ptr = T->getAs<PointerType>()) {
113 / / look at Ptr's pointee type
114 / }
115 / }
116 / @endcode
117 /
118 / \returns A proxy pointer to the same type, but with the specified
119 / static type (@p U). If the dynamic type is not the specified static type
120 / or a derived class thereof, a NULL canonical type.
121 template<typename U> CanProxy<U> getAs() const;
122
123 template<typename U> CanProxy<U> castAs() const;
124
125 / Overloaded arrow operator that produces a canonical type
126 / proxy.
128
129 / Retrieve all qualifiers.
130 Qualifiers getQualifiers() const { return Stored.getLocalQualifiers(); }
131
132 / Retrieve the const/volatile/restrict qualifiers.
133 unsigned getCVRQualifiers() const { return Stored.getLocalCVRQualifiers(); }
134
135 / Determines whether this type has any qualifiers
136 bool hasQualifiers() const { return Stored.hasLocalQualifiers(); }
137
138 bool isConstQualified() const {
139 return Stored.isLocalConstQualified();
140 }
141
142 bool isVolatileQualified() const {
143 return Stored.isLocalVolatileQualified();
144 }
145
146 bool isRestrictQualified() const {
147 return Stored.isLocalRestrictQualified();
148 }
149
150 / Determines if this canonical type is furthermore
151 / canonical as a parameter. The parameter-canonicalization
152 / process decays arrays to pointers and drops top-level qualifiers.
153 bool isCanonicalAsParam() const {
154 return Stored.isCanonicalAsParam();
155 }
156
157 / Retrieve the unqualified form of this type.
159
160 / Retrieves a version of this type with const applied.
161 / Note that this does not always yield a canonical type.
163 return Stored.withConst();
164 }
165
166 / Determines whether this canonical type is more qualified than
167 / the @p Other canonical type.
169 return Stored.isMoreQualifiedThan(Other.Stored, Ctx);
170 }
171
172 / Determines whether this canonical type is at least as qualified as
173 / the @p Other canonical type.
175 return Stored.isAtLeastAsQualifiedAs(Other.Stored, Ctx);
176 }
177
178 / If the canonical type is a reference type, returns the type that
179 / it refers to; otherwise, returns the type itself.
181
182 / Retrieve the internal representation of this canonical type.
183 void *getAsOpaquePtr() const { return Stored.getAsOpaquePtr(); }
184
185 / Construct a canonical type from its internal representation.
186 static CanQual<T> getFromOpaquePtr(void *Ptr);
187
188 / Builds a canonical type from a QualType.
189 /
190 / This routine is inherently unsafe, because it requires the user to
191 / ensure that the given type is a canonical type with the correct
192 / (dynamic) type.
194
195 void dump() const { Stored.dump(); }
196
197 void Profile(llvm::FoldingSetNodeID &ID) const {
198 ID.AddPointer(getAsOpaquePtr());
199 }
200};
201
202template<typename T, typename U>
204 return x.getAsOpaquePtr() == y.getAsOpaquePtr();
205}
206
207template<typename T, typename U>
209 return x.getAsOpaquePtr() != y.getAsOpaquePtr();
210}
211
212/ Represents a canonical, potentially-qualified type.
214
217 getCanonicalTypeInternal().getUnqualifiedType());
218}
219
221 CanQualType T) {
222 DB << static_cast<QualType>(T);
223 return DB;
224}
225
226/----------------------------------------------------------------------------/
227/ Internal proxy classes used by canonical types
228/----------------------------------------------------------------------------/
229
230#define LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(Accessor) \
231CanQualType Accessor() const { \
232return CanQualType::CreateUnsafe(this->getTypePtr()->Accessor()); \
233}
234
235#define LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Type, Accessor) \
236Type Accessor() const { return this->getTypePtr()->Accessor(); }
237
238/ Base class of all canonical proxy types, which is responsible for
239/ storing the underlying canonical type and providing basic conversions.
240template<typename T>
242protected:
244
245public:
246 / Retrieve the pointer to the underlying Type
247 const T *getTypePtr() const { return Stored.getTypePtr(); }
248
249 / Implicit conversion to the underlying pointer.
250 /
251 / Also provides the ability to use canonical type proxies in a Boolean
252 / context,e.g.,
253 / @code
254 / if (CanQual<PointerType> Ptr = T->getAs<PointerType>()) { ... }
255 / @endcode
256 operator const T*() const { return this->Stored.getTypePtrOrNull(); }
257
258 / Try to convert the given canonical type to a specific structural
259 / type.
260 template<typename U> CanProxy<U> getAs() const {
261 return this->Stored.template getAs<U>();
262 }
263
265
266 / Type predicates
267 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjectType)
268 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isIncompleteType)
269 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isSizelessType)
270 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isSizelessBuiltinType)
271 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isIncompleteOrObjectType)
272 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isVariablyModifiedType)
273 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isIntegerType)
274 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isEnumeralType)
277 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isWideCharType)
278 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isIntegralType)
279 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isIntegralOrEnumerationType)
280 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isRealFloatingType)
281 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isComplexType)
282 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isAnyComplexType)
283 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isFloatingType)
285 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isArithmeticType)
287 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isDerivedType)
288 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isScalarType)
289 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isAggregateType)
290 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isAnyPointerType)
291 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isVoidPointerType)
292 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isFunctionPointerType)
293 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isMemberFunctionPointerType)
294 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isClassType)
295 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isStructureType)
296 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isInterfaceType)
297 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isStructureOrClassType)
298 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isUnionType)
299 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isComplexIntegerType)
300 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isNullPtrType)
301 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isDependentType)
302 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isOverloadableType)
303 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isArrayType)
304 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isConstantArrayType)
305 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasPointerRepresentation)
306 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasObjCPointerRepresentation)
307 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasIntegerRepresentation)
308 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasSignedIntegerRepresentation)
309 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasUnsignedIntegerRepresentation)
310 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasFloatingRepresentation)
311 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isSignedIntegerType)
312 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isUnsignedIntegerType)
313 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isSignedIntegerOrEnumerationType)
314 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isUnsignedIntegerOrEnumerationType)
315 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isConstantSizeType)
316 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isSpecifierType)
318
319 / Retrieve the proxy-adaptor type.
320 /
321 / This arrow operator is used when CanProxyAdaptor has been specialized
322 / for the given type T. In that case, we reference members of the
323 / CanProxyAdaptor specialization. Otherwise, this operator will be hidden
324 / by the arrow operator in the primary CanProxyAdaptor template.
325 const CanProxyAdaptor<T> *operator->() const {
326 return static_cast<const CanProxyAdaptor<T> *>(this);
327 }
328};
329
330/ Replaceable canonical proxy adaptor class that provides the link
331/ between a canonical type and the accessors of the type.
332/
333/ The CanProxyAdaptor is a replaceable class template that is instantiated
334/ as part of each canonical proxy type. The primary template merely provides
335/ redirection to the underlying type (T), e.g., @c PointerType. One can
336/ provide specializations of this class template for each underlying type
337/ that provide accessors returning canonical types (@c CanQualType) rather
338/ than the more typical @c QualType, to propagate the notion of "canonical"
339/ through the system.
340template<typename T>
342
343/ Canonical proxy type returned when retrieving the members of a
344/ canonical type or as the result of the @c CanQual<T>::getAs member
345/ function.
346/
347/ The CanProxy type mainly exists as a proxy through which operator-> will
348/ look to either map down to a raw T* (e.g., PointerType*) or to a proxy
349/ type that provides canonical-type access to the fields of the type.
350template<typename T>
351class CanProxy : public CanProxyAdaptor<T> {
352public:
353 / Build a NULL proxy.
354 CanProxy() = default;
355
356 / Build a proxy to the given canonical type.
357 CanProxy(CanQual<T> Stored) { this->Stored = Stored; }
358
359 / Implicit conversion to the stored canonical type.
360 operator CanQual<T>() const { return this->Stored; }
361};
362
363} / namespace clang
364
365namespace llvm {
366
367/ Implement simplify_type for CanQual<T>, so that we can dyn_cast from
368/ CanQual<T> to a specific Type class. We're prefer isa/dyn_cast/cast/etc.
369/ to return smart pointer (proxies?).
370template<typename T>
371struct simplify_type< ::clang::CanQual<T>> {
372 using SimpleType = const T *;
373
375 return Val.getTypePtr();
376 }
377};
378
379/ Teach SmallPtrSet that CanQual<T> is "basically a pointer".
380template<typename T>
381struct PointerLikeTypeTraits<clang::CanQual<T>> {
383 return P.getAsOpaquePtr();
384 }
385
389
390 / qualifier information is encoded in the low bits.
391 static constexpr int NumLowBitsAvailable = 0;
392};
393
394} / namespace llvm
395
396namespace clang {
397
398/----------------------------------------------------------------------------/
399/ Canonical proxy adaptors for canonical type nodes.
400/----------------------------------------------------------------------------/
401
402/ Iterator adaptor that turns an iterator over canonical QualTypes
403/ into an iterator over CanQualTypes.
404template <typename InputIterator>
406 : llvm::iterator_adaptor_base<
407 CanTypeIterator<InputIterator>, InputIterator,
408 typename std::iterator_traits<InputIterator>::iterator_category,
409 CanQualType,
410 typename std::iterator_traits<InputIterator>::difference_type,
411 CanProxy<Type>, CanQualType> {
412 CanTypeIterator() = default;
413 explicit CanTypeIterator(InputIterator Iter)
414 : CanTypeIterator::iterator_adaptor_base(std::move(Iter)) {}
415
416 CanQualType operator*() const { return CanQualType::CreateUnsafe(*this->I); }
418};
419
420template<>
421struct CanProxyAdaptor<ComplexType> : public CanProxyBase<ComplexType> {
423};
424
425template<>
429
430template<>
435
436template<>
440
441template<>
446
447template<>
452
453template<>
461
462/ CanProxyAdaptors for arrays are intentionally unimplemented because
463/ they are not safe.
464template<> struct CanProxyAdaptor<ArrayType>;
465template<> struct CanProxyAdaptor<ConstantArrayType>;
466template<> struct CanProxyAdaptor<IncompleteArrayType>;
467template<> struct CanProxyAdaptor<VariableArrayType>;
469
470template<>
472 : public CanProxyBase<DependentSizedExtVectorType> {
474 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const Expr *, getSizeExpr)
476};
477
478template<>
479struct CanProxyAdaptor<VectorType> : public CanProxyBase<VectorType> {
481 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getNumElements)
482};
483
484template<>
485struct CanProxyAdaptor<ExtVectorType> : public CanProxyBase<ExtVectorType> {
487 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getNumElements)
488};
489
490template<>
495
496template<>
502
503template<>
505 : public CanProxyBase<FunctionProtoType> {
508 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getNumParams)
509 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasExtParameterInfos)
511 ArrayRef<FunctionProtoType::ExtParameterInfo>, getExtParameterInfos)
512
513 CanQualType getParamType(unsigned i) const {
515 }
516
519
522
524 return param_type_iterator(this->getTypePtr()->param_type_begin());
525 }
526
530
531 / Note: canonical function types never have exception specifications
532};
533
534template<>
535struct CanProxyAdaptor<TypeOfType> : public CanProxyBase<TypeOfType> {
536 LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getUnmodifiedType)
537};
538
539template<>
540struct CanProxyAdaptor<DecltypeType> : public CanProxyBase<DecltypeType> {
541 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Expr *, getUnderlyingExpr)
543};
544
545template <>
546struct CanProxyAdaptor<UnaryTransformType>
547 : public CanProxyBase<UnaryTransformType> {
550 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(UnaryTransformType::UTTKind, getUTTKind)
551};
552
553template<>
554struct CanProxyAdaptor<TagType> : public CanProxyBase<TagType> {
556};
557
558template<>
559struct CanProxyAdaptor<RecordType> : public CanProxyBase<RecordType> {
561 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasConstFields)
562};
563
564template<>
565struct CanProxyAdaptor<EnumType> : public CanProxyBase<EnumType> {
567};
568
569template<>
578
579template<>
581 : public CanProxyBase<ObjCObjectType> {
584 getInterface)
585 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCUnqualifiedId)
586 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCUnqualifiedClass)
587 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCQualifiedId)
588 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCQualifiedClass)
589
590 using qual_iterator = ObjCObjectPointerType::qual_iterator;
591
592 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(qual_iterator, qual_begin)
593 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(qual_iterator, qual_end)
595 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getNumProtocols)
596};
597
598template<>
603 getInterfaceType)
604 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCIdType)
605 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCClassType)
606 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCQualifiedIdType)
607 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCQualifiedClassType)
608
609 using qual_iterator = ObjCObjectPointerType::qual_iterator;
610
611 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(qual_iterator, qual_begin)
612 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(qual_iterator, qual_end)
614 LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getNumProtocols)
615};
616
617/----------------------------------------------------------------------------/
618/ Method and function definitions
619/----------------------------------------------------------------------------/
620template<typename T>
622 return CanQual<T>::CreateUnsafe(Stored.getLocalUnqualifiedType());
623}
624
625template<typename T>
628 return RefType->getPointeeType();
629 else
630 return *this;
631}
632
633template<typename T>
637 assert((!Result || Result.Stored.getAsOpaquePtr() == (void*)-1 ||
638 Result.Stored.isCanonical()) && "Type is not canonical!");
639 return Result;
640}
641
642template<typename T>
644 assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!");
645 assert((Other.isNull() || isa<T>(Other.getTypePtr())) &&
646 "Dynamic type does not meet the static type's requires");
648 Result.Stored = Other;
649 return Result;
650}
651
652template<typename T>
653template<typename U>
655 static_assert(!TypeIsArrayType<T>::value,
656 "ArrayType cannot be used with getAs!");
657
658 if (Stored.isNull())
659 return CanProxy<U>();
660
661 if (isa<U>(Stored.getTypePtr()))
662 return CanQual<U>::CreateUnsafe(Stored);
663
664 return CanProxy<U>();
665}
666
667template<typename T>
668template<typename U>
670 static_assert(!TypeIsArrayType<U>::value,
671 "ArrayType cannot be used with castAs!");
672
673 assert(!Stored.isNull() && isa<U>(Stored.getTypePtr()));
674 return CanQual<U>::CreateUnsafe(Stored);
675}
676
677template<typename T>
679 return CanProxy<T>(*this);
680}
681
682template <typename InputIterator>
686
687} / namespace clang
688
689#endif / LLVM_CLANG_AST_CANONICALTYPE_H
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.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition ASTContext.h:220
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Definition TypeBase.h:3722
Pointer to a block type.
Definition TypeBase.h:3542
Represents a C++ struct/union/class.
Definition DeclCXX.h:258
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.
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 isMoreQualifiedThan(CanQual< T > Other, const ASTContext &Ctx) const
Determines whether this canonical type is more qualified than the Other canonical type.
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.
bool isAtLeastAsQualifiedAs(CanQual< T > Other, const ASTContext &Ctx) const
Determines whether this canonical type is at least as qualified as the Other canonical type.
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.
void dump() const
bool isConstQualified() const
bool isNull() 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 isVolatileQualified() const
const T * getTypePtr() const
Retrieve the underlying type pointer, which refers to a canonical type.
Complex values, per C99 6.2.5p11.
Definition TypeBase.h:3275
Represents the canonical version of C arrays with a specified constant size.
Definition TypeBase.h:3760
Represents an array type in C++ whose size is a value-dependent expression.
Definition TypeBase.h:4011
Represents an extended vector type where either the type or size is dependent.
Definition TypeBase.h:4101
Represents an enum.
Definition Decl.h:4007
This represents one expression.
Definition Expr.h:112
ExtVectorType - Extended vector type.
Definition TypeBase.h:4267
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Definition TypeBase.h:4832
Represents a prototype with parameter type info, e.g.
Definition TypeBase.h:5254
A class which abstracts out some details necessary for making a call.
Definition TypeBase.h:4561
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition TypeBase.h:4450
One of these records is kept for each identifier that is lexed.
Represents a C array with an unspecified size.
Definition TypeBase.h:3909
An lvalue reference type, per C++11 [dcl.ref].
Definition TypeBase.h:3617
A pointer to member type per C++ 8.3.3 - Pointers to members.
Definition TypeBase.h:3653
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
Represents an ObjC class declaration.
Definition DeclObjC.h:1154
Represents typeof(type), a C23 feature and GCC extension, or `typeof_unqual(type),...
Definition TypeBase.h:7840
Represents a pointer to an Objective C object.
Definition TypeBase.h:7896
PointerType - C99 6.7.5.1 - Pointer Declarators.
Definition TypeBase.h:3328
A (possibly-)qualified type.
Definition TypeBase.h:937
QualType withConst() const
Definition TypeBase.h:1159
static QualType getFromOpaquePtr(const void *Ptr)
Definition TypeBase.h:986
The collection of all-type qualifiers we support.
Definition TypeBase.h:331
An rvalue reference type, per C++11 [dcl.ref].
Definition TypeBase.h:3635
Represents a struct/union/class.
Definition Decl.h:4321
Base for LValueReferenceType and RValueReferenceType.
Definition TypeBase.h:3573
Encodes a location in the source.
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
Represents the declaration of a struct/union/class/enum.
Definition Decl.h:3717
Declaration of a template type parameter.
CanQualType getCanonicalTypeUnqualified() const
QualType getCanonicalTypeInternal() const
Definition TypeBase.h:3119
Represents a C array with a specified size that is not an integer-constant-expression.
Definition TypeBase.h:3966
Represents a GCC generic vector type.
Definition TypeBase.h:4175
#define bool
Definition gpuintrin.h:32
The JSON file list parser is used to communicate input to InstallAPI.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
bool isa(CodeGen::Address addr)
Definition Address.h:330
bool operator==(const CallGraphNode::CallRecord &LHS, const CallGraphNode::CallRecord &RHS)
Definition CallGraph.h:204
@ Result
The result type of a method or function.
Definition TypeBase.h:905
const FunctionProtoType * T
std::is_base_of< ArrayType, T > TypeIsArrayType
Definition TypeBase.h:9088
bool operator!=(CanQual< T > x, CanQual< U > y)
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ConceptReference *C)
Insertion operator for diagnostics.
U cast(CodeGen::Address addr)
Definition Address.h:327
@ Other
Other implicit parameter.
Definition Decl.h:1746
Diagnostic wrappers for TextAPI types for error reporting.
Definition Dominators.h:30
CanTypeIterator< FunctionProtoType::param_type_iterator > param_type_iterator
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(ArrayRef< FunctionProtoType::ExtParameterInfo >, getExtParameterInfos) CanQualType getParamType(unsigned i) const
param_type_iterator param_type_end() const
param_type_iterator param_type_begin() const
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const ObjCInterfaceType *, getInterfaceType) using qual_iterator
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const ObjCInterfaceDecl *, getInterface) using qual_iterator
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(InputIterator Iter)
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
Definition TypeBase.h:870
static clang::CanQual< T > getFromVoidPointer(void *P)
static void * getAsVoidPointer(clang::CanQual< T > P)
static SimpleType getSimplifiedValue(::clang::CanQual< T > Val)

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant