/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/include/clang/AST/CanonicalType.h
Line | Count | Source (jump to first uncovered line) |
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" |
18 | | #include "clang/Basic/Diagnostic.h" |
19 | | #include "clang/Basic/SourceLocation.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 | | |
29 | | namespace clang { |
30 | | |
31 | | template<typename T> class CanProxy; |
32 | | template<typename T> struct CanProxyAdaptor; |
33 | | class CXXRecordDecl; |
34 | | class EnumDecl; |
35 | | class Expr; |
36 | | class IdentifierInfo; |
37 | | class ObjCInterfaceDecl; |
38 | | class RecordDecl; |
39 | | class TagDecl; |
40 | | class TemplateTypeParmDecl; |
41 | | |
42 | | //----------------------------------------------------------------------------// |
43 | | // Canonical, qualified type template |
44 | | //----------------------------------------------------------------------------// |
45 | | |
46 | | /// Represents a canonical, potentially-qualified type. |
47 | | /// |
48 | | /// The CanQual template is a lightweight smart pointer that provides access |
49 | | /// to the canonical representation of a type, where all typedefs and other |
50 | | /// syntactic sugar has been eliminated. A CanQualType may also have various |
51 | | /// qualifiers (const, volatile, restrict) attached to it. |
52 | | /// |
53 | | /// The template type parameter @p T is one of the Type classes (PointerType, |
54 | | /// BuiltinType, etc.). The type stored within @c CanQual<T> will be of that |
55 | | /// type (or some subclass of that type). The typedef @c CanQualType is just |
56 | | /// a shorthand for @c CanQual<Type>. |
57 | | /// |
58 | | /// An instance of @c CanQual<T> can be implicitly converted to a |
59 | | /// @c CanQual<U> when T is derived from U, which essentially provides an |
60 | | /// implicit upcast. For example, @c CanQual<LValueReferenceType> can be |
61 | | /// converted to @c CanQual<ReferenceType>. Note that any @c CanQual type can |
62 | | /// be implicitly converted to a QualType, but the reverse operation requires |
63 | | /// a call to ASTContext::getCanonicalType(). |
64 | | template<typename T = Type> |
65 | | class CanQual { |
66 | | /// The actual, canonical type. |
67 | | QualType Stored; |
68 | | |
69 | | public: |
70 | | /// Constructs a NULL canonical type. |
71 | 1.14G | CanQual() = default; clang::CanQual<clang::Type>::CanQual() Line | Count | Source | 71 | 1.13G | CanQual() = default; |
clang::CanQual<clang::RecordType>::CanQual() Line | Count | Source | 71 | 2.44M | CanQual() = default; |
clang::CanQual<clang::ReferenceType>::CanQual() Line | Count | Source | 71 | 21.6k | CanQual() = default; |
clang::CanQual<clang::PointerType>::CanQual() Line | Count | Source | 71 | 1.92M | CanQual() = default; |
clang::CanQual<clang::FunctionProtoType>::CanQual() Line | Count | Source | 71 | 7.75M | CanQual() = default; |
clang::CanQual<clang::BlockPointerType>::CanQual() Line | Count | Source | 71 | 48 | CanQual() = default; |
clang::CanQual<clang::MemberPointerType>::CanQual() Line | Count | Source | 71 | 2.78k | CanQual() = default; |
clang::CanQual<clang::FunctionType>::CanQual() Line | Count | Source | 71 | 1.03k | CanQual() = default; |
clang::CanQual<clang::FunctionNoProtoType>::CanQual() Line | Count | Source | 71 | 422k | CanQual() = default; |
clang::CanQual<clang::ComplexType>::CanQual() Line | Count | Source | 71 | 30 | CanQual() = default; |
|
72 | | |
73 | | /// Converting constructor that permits implicit upcasting of |
74 | | /// canonical type pointers. |
75 | | template <typename U> |
76 | | CanQual(const CanQual<U> &Other, |
77 | | std::enable_if_t<std::is_base_of<T, U>::value, int> = 0); |
78 | | |
79 | | /// Retrieve the underlying type pointer, which refers to a |
80 | | /// canonical type. |
81 | | /// |
82 | | /// The underlying pointer must not be nullptr. |
83 | 213M | const T *getTypePtr() const { return cast<T>(Stored.getTypePtr()); } clang::CanQual<clang::PointerType>::getTypePtr() const Line | Count | Source | 83 | 957k | const T *getTypePtr() const { return cast<T>(Stored.getTypePtr()); } |
clang::CanQual<clang::BlockPointerType>::getTypePtr() const Line | Count | Source | 83 | 24 | const T *getTypePtr() const { return cast<T>(Stored.getTypePtr()); } |
clang::CanQual<clang::ReferenceType>::getTypePtr() const Line | Count | Source | 83 | 4.34k | const T *getTypePtr() const { return cast<T>(Stored.getTypePtr()); } |
Unexecuted instantiation: clang::CanQual<clang::LValueReferenceType>::getTypePtr() const Unexecuted instantiation: clang::CanQual<clang::RValueReferenceType>::getTypePtr() const clang::CanQual<clang::MemberPointerType>::getTypePtr() const Line | Count | Source | 83 | 2.46k | const T *getTypePtr() const { return cast<T>(Stored.getTypePtr()); } |
Unexecuted instantiation: clang::CanQual<clang::DependentSizedExtVectorType>::getTypePtr() const Unexecuted instantiation: clang::CanQual<clang::VectorType>::getTypePtr() const Unexecuted instantiation: clang::CanQual<clang::ExtVectorType>::getTypePtr() const Unexecuted instantiation: clang::CanQual<clang::FunctionType>::getTypePtr() const clang::CanQual<clang::FunctionProtoType>::getTypePtr() const Line | Count | Source | 83 | 5.77M | const T *getTypePtr() const { return cast<T>(Stored.getTypePtr()); } |
Unexecuted instantiation: clang::CanQual<clang::TypeOfType>::getTypePtr() const Unexecuted instantiation: clang::CanQual<clang::DecltypeType>::getTypePtr() const Unexecuted instantiation: clang::CanQual<clang::UnaryTransformType>::getTypePtr() const Unexecuted instantiation: clang::CanQual<clang::TagType>::getTypePtr() const Unexecuted instantiation: clang::CanQual<clang::RecordType>::getTypePtr() const Unexecuted instantiation: clang::CanQual<clang::EnumType>::getTypePtr() const Unexecuted instantiation: clang::CanQual<clang::TemplateTypeParmType>::getTypePtr() const Unexecuted instantiation: clang::CanQual<clang::ObjCObjectType>::getTypePtr() const Unexecuted instantiation: clang::CanQual<clang::ObjCObjectPointerType>::getTypePtr() const clang::CanQual<clang::Type>::getTypePtr() const Line | Count | Source | 83 | 207M | const T *getTypePtr() const { return cast<T>(Stored.getTypePtr()); } |
clang::CanQual<clang::ComplexType>::getTypePtr() const Line | Count | Source | 83 | 2 | const T *getTypePtr() const { return cast<T>(Stored.getTypePtr()); } |
clang::CanQual<clang::FunctionNoProtoType>::getTypePtr() const Line | Count | Source | 83 | 9.57k | const T *getTypePtr() const { return cast<T>(Stored.getTypePtr()); } |
|
84 | | |
85 | | /// Retrieve the underlying type pointer, which refers to a |
86 | | /// canonical type, or nullptr. |
87 | 2.34M | const T *getTypePtrOrNull() const { |
88 | 2.34M | return cast_or_null<T>(Stored.getTypePtrOrNull()); |
89 | 2.34M | } clang::CanQual<clang::RecordType>::getTypePtrOrNull() const Line | Count | Source | 87 | 2.34M | const T *getTypePtrOrNull() const { | 88 | 2.34M | return cast_or_null<T>(Stored.getTypePtrOrNull()); | 89 | 2.34M | } |
clang::CanQual<clang::PointerType>::getTypePtrOrNull() const Line | Count | Source | 87 | 69 | const T *getTypePtrOrNull() const { | 88 | 69 | return cast_or_null<T>(Stored.getTypePtrOrNull()); | 89 | 69 | } |
clang::CanQual<clang::FunctionType>::getTypePtrOrNull() const Line | Count | Source | 87 | 519 | const T *getTypePtrOrNull() const { | 88 | 519 | return cast_or_null<T>(Stored.getTypePtrOrNull()); | 89 | 519 | } |
clang::CanQual<clang::ComplexType>::getTypePtrOrNull() const Line | Count | Source | 87 | 24 | const T *getTypePtrOrNull() const { | 88 | 24 | return cast_or_null<T>(Stored.getTypePtrOrNull()); | 89 | 24 | } |
|
90 | | |
91 | | /// Implicit conversion to a qualified type. |
92 | 930M | operator QualType() const { return Stored; } |
93 | | |
94 | | /// Implicit conversion to bool. |
95 | 1.42M | explicit operator bool() const { return !isNull(); } clang::CanQual<clang::Type>::operator bool() const Line | Count | Source | 95 | 998k | explicit operator bool() const { return !isNull(); } |
clang::CanQual<clang::ReferenceType>::operator bool() const Line | Count | Source | 95 | 12.9k | explicit operator bool() const { return !isNull(); } |
clang::CanQual<clang::PointerType>::operator bool() const Line | Count | Source | 95 | 7.23k | explicit operator bool() const { return !isNull(); } |
clang::CanQual<clang::FunctionNoProtoType>::operator bool() const Line | Count | Source | 95 | 408k | explicit operator bool() const { return !isNull(); } |
|
96 | | |
97 | 1.53M | bool isNull() const { |
98 | 1.53M | return Stored.isNull(); |
99 | 1.53M | } clang::CanQual<clang::Type>::isNull() const Line | Count | Source | 97 | 1.10M | bool isNull() const { | 98 | 1.10M | return Stored.isNull(); | 99 | 1.10M | } |
clang::CanQual<clang::ReferenceType>::isNull() const Line | Count | Source | 97 | 12.9k | bool isNull() const { | 98 | 12.9k | return Stored.isNull(); | 99 | 12.9k | } |
clang::CanQual<clang::PointerType>::isNull() const Line | Count | Source | 97 | 7.23k | bool isNull() const { | 98 | 7.23k | return Stored.isNull(); | 99 | 7.23k | } |
clang::CanQual<clang::FunctionNoProtoType>::isNull() const Line | Count | Source | 97 | 408k | bool isNull() const { | 98 | 408k | return Stored.isNull(); | 99 | 408k | } |
|
100 | | |
101 | 265k | SplitQualType split() const { return Stored.split(); } |
102 | | |
103 | | /// Retrieve a canonical type pointer with a different static type, |
104 | | /// upcasting or downcasting as needed. |
105 | | /// |
106 | | /// The getAs() function is typically used to try to downcast to a |
107 | | /// more specific (canonical) type in the type system. For example: |
108 | | /// |
109 | | /// @code |
110 | | /// void f(CanQual<Type> T) { |
111 | | /// if (CanQual<PointerType> Ptr = T->getAs<PointerType>()) { |
112 | | /// // look at Ptr's pointee type |
113 | | /// } |
114 | | /// } |
115 | | /// @endcode |
116 | | /// |
117 | | /// \returns A proxy pointer to the same type, but with the specified |
118 | | /// static type (@p U). If the dynamic type is not the specified static type |
119 | | /// or a derived class thereof, a NULL canonical type. |
120 | | template<typename U> CanProxy<U> getAs() const; |
121 | | |
122 | | template<typename U> CanProxy<U> castAs() const; |
123 | | |
124 | | /// Overloaded arrow operator that produces a canonical type |
125 | | /// proxy. |
126 | | CanProxy<T> operator->() const; |
127 | | |
128 | | /// Retrieve all qualifiers. |
129 | 10.2M | Qualifiers getQualifiers() const { return Stored.getLocalQualifiers(); } clang::CanQual<clang::Type>::getQualifiers() const Line | Count | Source | 129 | 10.2M | Qualifiers getQualifiers() const { return Stored.getLocalQualifiers(); } |
clang::CanQual<clang::FunctionProtoType>::getQualifiers() const Line | Count | Source | 129 | 70 | Qualifiers getQualifiers() const { return Stored.getLocalQualifiers(); } |
|
130 | | |
131 | | /// Retrieve the const/volatile/restrict qualifiers. |
132 | 1.92M | unsigned getCVRQualifiers() const { return Stored.getLocalCVRQualifiers(); } |
133 | | |
134 | | /// Determines whether this type has any qualifiers |
135 | | bool hasQualifiers() const { return Stored.hasLocalQualifiers(); } |
136 | | |
137 | 2.21M | bool isConstQualified() const { |
138 | 2.21M | return Stored.isLocalConstQualified(); |
139 | 2.21M | } |
140 | | |
141 | 2.38k | bool isVolatileQualified() const { |
142 | 2.38k | return Stored.isLocalVolatileQualified(); |
143 | 2.38k | } |
144 | | |
145 | | bool isRestrictQualified() const { |
146 | | return Stored.isLocalRestrictQualified(); |
147 | | } |
148 | | |
149 | | /// Determines if this canonical type is furthermore |
150 | | /// canonical as a parameter. The parameter-canonicalization |
151 | | /// process decays arrays to pointers and drops top-level qualifiers. |
152 | 2.23M | bool isCanonicalAsParam() const { |
153 | 2.23M | return Stored.isCanonicalAsParam(); |
154 | 2.23M | } |
155 | | |
156 | | /// Retrieve the unqualified form of this type. |
157 | | CanQual<T> getUnqualifiedType() const; |
158 | | |
159 | | /// Retrieves a version of this type with const applied. |
160 | | /// Note that this does not always yield a canonical type. |
161 | 662k | QualType withConst() const { |
162 | 662k | return Stored.withConst(); |
163 | 662k | } |
164 | | |
165 | | /// Determines whether this canonical type is more qualified than |
166 | | /// the @p Other canonical type. |
167 | | bool isMoreQualifiedThan(CanQual<T> Other) const { |
168 | | return Stored.isMoreQualifiedThan(Other.Stored); |
169 | | } |
170 | | |
171 | | /// Determines whether this canonical type is at least as qualified as |
172 | | /// the @p Other canonical type. |
173 | 3.01k | bool isAtLeastAsQualifiedAs(CanQual<T> Other) const { |
174 | 3.01k | return Stored.isAtLeastAsQualifiedAs(Other.Stored); |
175 | 3.01k | } |
176 | | |
177 | | /// If the canonical type is a reference type, returns the type that |
178 | | /// it refers to; otherwise, returns the type itself. |
179 | | CanQual<Type> getNonReferenceType() const; |
180 | | |
181 | | /// Retrieve the internal representation of this canonical type. |
182 | 324M | void *getAsOpaquePtr() const { return Stored.getAsOpaquePtr(); } |
183 | | |
184 | | /// Construct a canonical type from its internal representation. |
185 | | static CanQual<T> getFromOpaquePtr(void *Ptr); |
186 | | |
187 | | /// Builds a canonical type from a QualType. |
188 | | /// |
189 | | /// This routine is inherently unsafe, because it requires the user to |
190 | | /// ensure that the given type is a canonical type with the correct |
191 | | // (dynamic) type. |
192 | | static CanQual<T> CreateUnsafe(QualType Other); |
193 | | |
194 | | void dump() const { Stored.dump(); } |
195 | | |
196 | 6.72M | void Profile(llvm::FoldingSetNodeID &ID) const { |
197 | 6.72M | ID.AddPointer(getAsOpaquePtr()); |
198 | 6.72M | } |
199 | | }; |
200 | | |
201 | | template<typename T, typename U> |
202 | 138M | inline bool operator==(CanQual<T> x, CanQual<U> y) { |
203 | 138M | return x.getAsOpaquePtr() == y.getAsOpaquePtr(); |
204 | 138M | } |
205 | | |
206 | | template<typename T, typename U> |
207 | 13.9M | inline bool operator!=(CanQual<T> x, CanQual<U> y) { |
208 | 13.9M | return x.getAsOpaquePtr() != y.getAsOpaquePtr(); |
209 | 13.9M | } |
210 | | |
211 | | /// Represents a canonical, potentially-qualified type. |
212 | | using CanQualType = CanQual<Type>; |
213 | | |
214 | 1.56M | inline CanQualType Type::getCanonicalTypeUnqualified() const { |
215 | 1.56M | return CanQualType::CreateUnsafe(getCanonicalTypeInternal()); |
216 | 1.56M | } |
217 | | |
218 | | inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, |
219 | 117 | CanQualType T) { |
220 | 117 | DB << static_cast<QualType>(T); |
221 | 117 | return DB; |
222 | 117 | } |
223 | | |
224 | | //----------------------------------------------------------------------------// |
225 | | // Internal proxy classes used by canonical types |
226 | | //----------------------------------------------------------------------------// |
227 | | |
228 | | #define LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(Accessor) \ |
229 | 1.66M | CanQualType Accessor() const { \ |
230 | 1.66M | return CanQualType::CreateUnsafe(this->getTypePtr()->Accessor()); \ |
231 | 1.66M | } clang::CanProxyAdaptor<clang::PointerType>::getPointeeType() const Line | Count | Source | 229 | 957k | CanQualType Accessor() const { \ | 230 | 957k | return CanQualType::CreateUnsafe(this->getTypePtr()->Accessor()); \ | 231 | 957k | } |
clang::CanProxyAdaptor<clang::BlockPointerType>::getPointeeType() const Line | Count | Source | 229 | 24 | CanQualType Accessor() const { \ | 230 | 24 | return CanQualType::CreateUnsafe(this->getTypePtr()->Accessor()); \ | 231 | 24 | } |
clang::CanProxyAdaptor<clang::ReferenceType>::getPointeeType() const Line | Count | Source | 229 | 4.34k | CanQualType Accessor() const { \ | 230 | 4.34k | return CanQualType::CreateUnsafe(this->getTypePtr()->Accessor()); \ | 231 | 4.34k | } |
Unexecuted instantiation: clang::CanProxyAdaptor<clang::LValueReferenceType>::getPointeeType() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::RValueReferenceType>::getPointeeType() const clang::CanProxyAdaptor<clang::MemberPointerType>::getPointeeType() const Line | Count | Source | 229 | 1.07k | CanQualType Accessor() const { \ | 230 | 1.07k | return CanQualType::CreateUnsafe(this->getTypePtr()->Accessor()); \ | 231 | 1.07k | } |
Unexecuted instantiation: clang::CanProxyAdaptor<clang::DependentSizedExtVectorType>::getElementType() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::VectorType>::getElementType() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::ExtVectorType>::getElementType() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::FunctionType>::getReturnType() const clang::CanProxyAdaptor<clang::FunctionProtoType>::getReturnType() const Line | Count | Source | 229 | 698k | CanQualType Accessor() const { \ | 230 | 698k | return CanQualType::CreateUnsafe(this->getTypePtr()->Accessor()); \ | 231 | 698k | } |
Unexecuted instantiation: clang::CanProxyAdaptor<clang::TypeOfType>::getUnderlyingType() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::DecltypeType>::getUnderlyingType() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::UnaryTransformType>::getBaseType() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::UnaryTransformType>::getUnderlyingType() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::ObjCObjectType>::getBaseType() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::ObjCObjectPointerType>::getPointeeType() const clang::CanProxyAdaptor<clang::ComplexType>::getElementType() const Line | Count | Source | 229 | 2 | CanQualType Accessor() const { \ | 230 | 2 | return CanQualType::CreateUnsafe(this->getTypePtr()->Accessor()); \ | 231 | 2 | } |
clang::CanProxyAdaptor<clang::FunctionNoProtoType>::getReturnType() const Line | Count | Source | 229 | 4.78k | CanQualType Accessor() const { \ | 230 | 4.78k | return CanQualType::CreateUnsafe(this->getTypePtr()->Accessor()); \ | 231 | 4.78k | } |
|
232 | | |
233 | | #define LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Type, Accessor) \ |
234 | 10.3M | Type Accessor() const { return this->getTypePtr()->Accessor(); } clang::CanProxyAdaptor<clang::MemberPointerType>::getClass() const Line | Count | Source | 234 | 1.39k | Type Accessor() const { return this->getTypePtr()->Accessor(); } |
Unexecuted instantiation: clang::CanProxyAdaptor<clang::DependentSizedExtVectorType>::getSizeExpr() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::DependentSizedExtVectorType>::getAttributeLoc() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::VectorType>::getNumElements() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::ExtVectorType>::getNumElements() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::FunctionType>::getExtInfo() const clang::CanProxyAdaptor<clang::FunctionProtoType>::getNumParams() const Line | Count | Source | 234 | 2.58k | Type Accessor() const { return this->getTypePtr()->Accessor(); } |
Unexecuted instantiation: clang::CanProxyAdaptor<clang::FunctionProtoType>::isVariadic() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::FunctionProtoType>::getMethodQuals() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::DecltypeType>::getUnderlyingExpr() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::UnaryTransformType>::getUTTKind() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::TagType>::getDecl() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::TagType>::isBeingDefined() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::RecordType>::getDecl() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::RecordType>::isBeingDefined() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::RecordType>::hasConstFields() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::EnumType>::getDecl() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::EnumType>::isBeingDefined() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::TemplateTypeParmType>::getDepth() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::TemplateTypeParmType>::getIndex() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::TemplateTypeParmType>::isParameterPack() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::TemplateTypeParmType>::getDecl() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::TemplateTypeParmType>::getIdentifier() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::ObjCObjectType>::getInterface() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::ObjCObjectType>::isObjCUnqualifiedId() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::ObjCObjectType>::isObjCUnqualifiedClass() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::ObjCObjectType>::isObjCQualifiedId() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::ObjCObjectType>::isObjCQualifiedClass() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::ObjCObjectType>::qual_begin() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::ObjCObjectType>::qual_end() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::ObjCObjectType>::qual_empty() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::ObjCObjectType>::getNumProtocols() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::ObjCObjectPointerType>::getInterfaceType() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::ObjCObjectPointerType>::isObjCIdType() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::ObjCObjectPointerType>::isObjCClassType() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::ObjCObjectPointerType>::isObjCQualifiedIdType() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::ObjCObjectPointerType>::isObjCQualifiedClassType() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::ObjCObjectPointerType>::qual_begin() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::ObjCObjectPointerType>::qual_end() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::ObjCObjectPointerType>::qual_empty() const Unexecuted instantiation: clang::CanProxyAdaptor<clang::ObjCObjectPointerType>::getNumProtocols() const clang::CanProxyBase<clang::Type>::getTypeClass() const Line | Count | Source | 234 | 3.32M | Type Accessor() const { return this->getTypePtr()->Accessor(); } |
clang::CanProxyBase<clang::Type>::isArrayType() const Line | Count | Source | 234 | 2.21M | Type Accessor() const { return this->getTypePtr()->Accessor(); } |
clang::CanProxyBase<clang::Type>::isIncompleteType() const Line | Count | Source | 234 | 2.21M | Type Accessor() const { return this->getTypePtr()->Accessor(); } |
clang::CanProxyBase<clang::Type>::isEnumeralType() const Line | Count | Source | 234 | 256 | Type Accessor() const { return this->getTypePtr()->Accessor(); } |
clang::CanProxyBase<clang::Type>::isDependentType() const Line | Count | Source | 234 | 136 | Type Accessor() const { return this->getTypePtr()->Accessor(); } |
clang::CanProxyBase<clang::Type>::getAsCXXRecordDecl() const Line | Count | Source | 234 | 236k | Type Accessor() const { return this->getTypePtr()->Accessor(); } |
clang::CanProxyBase<clang::Type>::isUnsignedIntegerType() const Line | Count | Source | 234 | 29 | Type Accessor() const { return this->getTypePtr()->Accessor(); } |
clang::CanProxyAdaptor<clang::FunctionNoProtoType>::getExtInfo() const Line | Count | Source | 234 | 4.78k | Type Accessor() const { return this->getTypePtr()->Accessor(); } |
clang::CanProxyAdaptor<clang::FunctionProtoType>::getExtInfo() const Line | Count | Source | 234 | 1.05M | Type Accessor() const { return this->getTypePtr()->Accessor(); } |
clang::CanProxyAdaptor<clang::FunctionProtoType>::hasExtParameterInfos() const Line | Count | Source | 234 | 1.05M | Type Accessor() const { return this->getTypePtr()->Accessor(); } |
clang::CanProxyAdaptor<clang::FunctionProtoType>::getExtParameterInfos() const Line | Count | Source | 234 | 825 | Type Accessor() const { return this->getTypePtr()->Accessor(); } |
clang::CanProxyBase<clang::Type>::isVoidPointerType() const Line | Count | Source | 234 | 276k | Type Accessor() const { return this->getTypePtr()->Accessor(); } |
clang::CanProxyBase<clang::Type>::hasPointerRepresentation() const Line | Count | Source | 234 | 39 | Type Accessor() const { return this->getTypePtr()->Accessor(); } |
clang::CanProxyBase<clang::Type>::isVoidType() const Line | Count | Source | 234 | 928 | Type Accessor() const { return this->getTypePtr()->Accessor(); } |
clang::CanProxyBase<clang::Type>::isStructureOrClassType() const Line | Count | Source | 234 | 160 | Type Accessor() const { return this->getTypePtr()->Accessor(); } |
|
235 | | |
236 | | /// Base class of all canonical proxy types, which is responsible for |
237 | | /// storing the underlying canonical type and providing basic conversions. |
238 | | template<typename T> |
239 | | class CanProxyBase { |
240 | | protected: |
241 | | CanQual<T> Stored; |
242 | | |
243 | | public: |
244 | | /// Retrieve the pointer to the underlying Type |
245 | 14.2M | const T *getTypePtr() const { return Stored.getTypePtr(); } clang::CanProxyBase<clang::PointerType>::getTypePtr() const Line | Count | Source | 245 | 957k | const T *getTypePtr() const { return Stored.getTypePtr(); } |
clang::CanProxyBase<clang::BlockPointerType>::getTypePtr() const Line | Count | Source | 245 | 24 | const T *getTypePtr() const { return Stored.getTypePtr(); } |
clang::CanProxyBase<clang::ReferenceType>::getTypePtr() const Line | Count | Source | 245 | 4.34k | const T *getTypePtr() const { return Stored.getTypePtr(); } |
Unexecuted instantiation: clang::CanProxyBase<clang::LValueReferenceType>::getTypePtr() const Unexecuted instantiation: clang::CanProxyBase<clang::RValueReferenceType>::getTypePtr() const clang::CanProxyBase<clang::MemberPointerType>::getTypePtr() const Line | Count | Source | 245 | 2.46k | const T *getTypePtr() const { return Stored.getTypePtr(); } |
Unexecuted instantiation: clang::CanProxyBase<clang::DependentSizedExtVectorType>::getTypePtr() const Unexecuted instantiation: clang::CanProxyBase<clang::VectorType>::getTypePtr() const Unexecuted instantiation: clang::CanProxyBase<clang::ExtVectorType>::getTypePtr() const Unexecuted instantiation: clang::CanProxyBase<clang::FunctionType>::getTypePtr() const clang::CanProxyBase<clang::FunctionProtoType>::getTypePtr() const Line | Count | Source | 245 | 5.02M | const T *getTypePtr() const { return Stored.getTypePtr(); } |
Unexecuted instantiation: clang::CanProxyBase<clang::TypeOfType>::getTypePtr() const Unexecuted instantiation: clang::CanProxyBase<clang::DecltypeType>::getTypePtr() const Unexecuted instantiation: clang::CanProxyBase<clang::UnaryTransformType>::getTypePtr() const Unexecuted instantiation: clang::CanProxyBase<clang::TagType>::getTypePtr() const Unexecuted instantiation: clang::CanProxyBase<clang::RecordType>::getTypePtr() const Unexecuted instantiation: clang::CanProxyBase<clang::EnumType>::getTypePtr() const Unexecuted instantiation: clang::CanProxyBase<clang::TemplateTypeParmType>::getTypePtr() const Unexecuted instantiation: clang::CanProxyBase<clang::ObjCObjectType>::getTypePtr() const Unexecuted instantiation: clang::CanProxyBase<clang::ObjCObjectPointerType>::getTypePtr() const clang::CanProxyBase<clang::Type>::getTypePtr() const Line | Count | Source | 245 | 8.27M | const T *getTypePtr() const { return Stored.getTypePtr(); } |
clang::CanProxyBase<clang::ComplexType>::getTypePtr() const Line | Count | Source | 245 | 2 | const T *getTypePtr() const { return Stored.getTypePtr(); } |
clang::CanProxyBase<clang::FunctionNoProtoType>::getTypePtr() const Line | Count | Source | 245 | 9.57k | const T *getTypePtr() const { return Stored.getTypePtr(); } |
|
246 | | |
247 | | /// Implicit conversion to the underlying pointer. |
248 | | /// |
249 | | /// Also provides the ability to use canonical type proxies in a Boolean |
250 | | // context,e.g., |
251 | | /// @code |
252 | | /// if (CanQual<PointerType> Ptr = T->getAs<PointerType>()) { ... } |
253 | | /// @endcode |
254 | 2.34M | operator const T*() const { return this->Stored.getTypePtrOrNull(); } clang::CanProxyBase<clang::RecordType>::operator clang::RecordType const*() const Line | Count | Source | 254 | 2.34M | operator const T*() const { return this->Stored.getTypePtrOrNull(); } |
clang::CanProxyBase<clang::PointerType>::operator clang::PointerType const*() const Line | Count | Source | 254 | 69 | operator const T*() const { return this->Stored.getTypePtrOrNull(); } |
clang::CanProxyBase<clang::FunctionType>::operator clang::FunctionType const*() const Line | Count | Source | 254 | 519 | operator const T*() const { return this->Stored.getTypePtrOrNull(); } |
clang::CanProxyBase<clang::ComplexType>::operator clang::ComplexType const*() const Line | Count | Source | 254 | 24 | operator const T*() const { return this->Stored.getTypePtrOrNull(); } |
|
255 | | |
256 | | /// Try to convert the given canonical type to a specific structural |
257 | | /// type. |
258 | 2.36M | template<typename U> CanProxy<U> getAs() const { |
259 | 2.36M | return this->Stored.template getAs<U>(); |
260 | 2.36M | } clang::CanProxy<clang::RecordType> clang::CanProxyBase<clang::Type>::getAs<clang::RecordType>() const Line | Count | Source | 258 | 2.34M | template<typename U> CanProxy<U> getAs() const { | 259 | 2.34M | return this->Stored.template getAs<U>(); | 260 | 2.34M | } |
clang::CanProxy<clang::ReferenceType> clang::CanProxyBase<clang::Type>::getAs<clang::ReferenceType>() const Line | Count | Source | 258 | 11.4k | template<typename U> CanProxy<U> getAs() const { | 259 | 11.4k | return this->Stored.template getAs<U>(); | 260 | 11.4k | } |
clang::CanProxy<clang::PointerType> clang::CanProxyBase<clang::Type>::getAs<clang::PointerType>() const Line | Count | Source | 258 | 7.78k | template<typename U> CanProxy<U> getAs() const { | 259 | 7.78k | return this->Stored.template getAs<U>(); | 260 | 7.78k | } |
clang::CanProxy<clang::FunctionProtoType> clang::CanProxyBase<clang::Type>::getAs<clang::FunctionProtoType>() const Line | Count | Source | 258 | 70 | template<typename U> CanProxy<U> getAs() const { | 259 | 70 | return this->Stored.template getAs<U>(); | 260 | 70 | } |
clang::CanProxy<clang::FunctionType> clang::CanProxyBase<clang::Type>::getAs<clang::FunctionType>() const Line | Count | Source | 258 | 519 | template<typename U> CanProxy<U> getAs() const { | 259 | 519 | return this->Stored.template getAs<U>(); | 260 | 519 | } |
clang::CanProxy<clang::ComplexType> clang::CanProxyBase<clang::Type>::getAs<clang::ComplexType>() const Line | Count | Source | 258 | 26 | template<typename U> CanProxy<U> getAs() const { | 259 | 26 | return this->Stored.template getAs<U>(); | 260 | 26 | } |
|
261 | | |
262 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Type::TypeClass, getTypeClass) |
263 | | |
264 | | // Type predicates |
265 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjectType) |
266 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isIncompleteType) |
267 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isSizelessType) |
268 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isSizelessBuiltinType) |
269 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isIncompleteOrObjectType) |
270 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isVariablyModifiedType) |
271 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isIntegerType) |
272 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isEnumeralType) |
273 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isBooleanType) |
274 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isCharType) |
275 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isWideCharType) |
276 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isIntegralType) |
277 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isIntegralOrEnumerationType) |
278 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isRealFloatingType) |
279 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isComplexType) |
280 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isAnyComplexType) |
281 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isFloatingType) |
282 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isRealType) |
283 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isArithmeticType) |
284 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isVoidType) |
285 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isDerivedType) |
286 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isScalarType) |
287 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isAggregateType) |
288 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isAnyPointerType) |
289 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isVoidPointerType) |
290 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isFunctionPointerType) |
291 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isMemberFunctionPointerType) |
292 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isClassType) |
293 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isStructureType) |
294 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isInterfaceType) |
295 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isStructureOrClassType) |
296 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isUnionType) |
297 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isComplexIntegerType) |
298 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isNullPtrType) |
299 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isDependentType) |
300 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isOverloadableType) |
301 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isArrayType) |
302 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasPointerRepresentation) |
303 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasObjCPointerRepresentation) |
304 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasIntegerRepresentation) |
305 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasSignedIntegerRepresentation) |
306 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasUnsignedIntegerRepresentation) |
307 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasFloatingRepresentation) |
308 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isPromotableIntegerType) |
309 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isSignedIntegerType) |
310 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isUnsignedIntegerType) |
311 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isSignedIntegerOrEnumerationType) |
312 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isUnsignedIntegerOrEnumerationType) |
313 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isConstantSizeType) |
314 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isSpecifierType) |
315 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(CXXRecordDecl*, getAsCXXRecordDecl) |
316 | | |
317 | | /// Retrieve the proxy-adaptor type. |
318 | | /// |
319 | | /// This arrow operator is used when CanProxyAdaptor has been specialized |
320 | | /// for the given type T. In that case, we reference members of the |
321 | | /// CanProxyAdaptor specialization. Otherwise, this operator will be hidden |
322 | | /// by the arrow operator in the primary CanProxyAdaptor template. |
323 | 16.4M | const CanProxyAdaptor<T> *operator->() const { |
324 | 16.4M | return static_cast<const CanProxyAdaptor<T> *>(this); |
325 | 16.4M | } clang::CanProxyBase<clang::Type>::operator->() const Line | Count | Source | 323 | 10.6M | const CanProxyAdaptor<T> *operator->() const { | 324 | 10.6M | return static_cast<const CanProxyAdaptor<T> *>(this); | 325 | 10.6M | } |
clang::CanProxyBase<clang::ReferenceType>::operator->() const Line | Count | Source | 323 | 4.34k | const CanProxyAdaptor<T> *operator->() const { | 324 | 4.34k | return static_cast<const CanProxyAdaptor<T> *>(this); | 325 | 4.34k | } |
clang::CanProxyBase<clang::PointerType>::operator->() const Line | Count | Source | 323 | 957k | const CanProxyAdaptor<T> *operator->() const { | 324 | 957k | return static_cast<const CanProxyAdaptor<T> *>(this); | 325 | 957k | } |
clang::CanProxyBase<clang::FunctionProtoType>::operator->() const Line | Count | Source | 323 | 4.79M | const CanProxyAdaptor<T> *operator->() const { | 324 | 4.79M | return static_cast<const CanProxyAdaptor<T> *>(this); | 325 | 4.79M | } |
clang::CanProxyBase<clang::BlockPointerType>::operator->() const Line | Count | Source | 323 | 24 | const CanProxyAdaptor<T> *operator->() const { | 324 | 24 | return static_cast<const CanProxyAdaptor<T> *>(this); | 325 | 24 | } |
clang::CanProxyBase<clang::MemberPointerType>::operator->() const Line | Count | Source | 323 | 2.46k | const CanProxyAdaptor<T> *operator->() const { | 324 | 2.46k | return static_cast<const CanProxyAdaptor<T> *>(this); | 325 | 2.46k | } |
clang::CanProxyBase<clang::FunctionNoProtoType>::operator->() const Line | Count | Source | 323 | 9.57k | const CanProxyAdaptor<T> *operator->() const { | 324 | 9.57k | return static_cast<const CanProxyAdaptor<T> *>(this); | 325 | 9.57k | } |
clang::CanProxyBase<clang::ComplexType>::operator->() const Line | Count | Source | 323 | 2 | const CanProxyAdaptor<T> *operator->() const { | 324 | 2 | return static_cast<const CanProxyAdaptor<T> *>(this); | 325 | 2 | } |
|
326 | | }; |
327 | | |
328 | | /// Replaceable canonical proxy adaptor class that provides the link |
329 | | /// between a canonical type and the accessors of the type. |
330 | | /// |
331 | | /// The CanProxyAdaptor is a replaceable class template that is instantiated |
332 | | /// as part of each canonical proxy type. The primary template merely provides |
333 | | /// redirection to the underlying type (T), e.g., @c PointerType. One can |
334 | | /// provide specializations of this class template for each underlying type |
335 | | /// that provide accessors returning canonical types (@c CanQualType) rather |
336 | | /// than the more typical @c QualType, to propagate the notion of "canonical" |
337 | | /// through the system. |
338 | | template<typename T> |
339 | | struct CanProxyAdaptor : CanProxyBase<T> {}; |
340 | | |
341 | | /// Canonical proxy type returned when retrieving the members of a |
342 | | /// canonical type or as the result of the @c CanQual<T>::getAs member |
343 | | /// function. |
344 | | /// |
345 | | /// The CanProxy type mainly exists as a proxy through which operator-> will |
346 | | /// look to either map down to a raw T* (e.g., PointerType*) or to a proxy |
347 | | /// type that provides canonical-type access to the fields of the type. |
348 | | template<typename T> |
349 | | class CanProxy : public CanProxyAdaptor<T> { |
350 | | public: |
351 | | /// Build a NULL proxy. |
352 | 2.65M | CanProxy() = default; clang::CanProxy<clang::RecordType>::CanProxy() Line | Count | Source | 352 | 2.24M | CanProxy() = default; |
clang::CanProxy<clang::ReferenceType>::CanProxy() Line | Count | Source | 352 | 8.72k | CanProxy() = default; |
clang::CanProxy<clang::PointerType>::CanProxy() Line | Count | Source | 352 | 6.96k | CanProxy() = default; |
Unexecuted instantiation: clang::CanProxy<clang::FunctionProtoType>::CanProxy() Unexecuted instantiation: clang::CanProxy<clang::FunctionType>::CanProxy() Unexecuted instantiation: clang::CanProxy<clang::Type>::CanProxy() clang::CanProxy<clang::FunctionNoProtoType>::CanProxy() Line | Count | Source | 352 | 403k | CanProxy() = default; |
clang::CanProxy<clang::ComplexType>::CanProxy() Line | Count | Source | 352 | 22 | CanProxy() = default; |
|
353 | | |
354 | | /// Build a proxy to the given canonical type. |
355 | 18.1M | CanProxy(CanQual<T> Stored) { this->Stored = Stored; } clang::CanProxy<clang::Type>::CanProxy(clang::CanQual<clang::Type>) Line | Count | Source | 355 | 10.8M | CanProxy(CanQual<T> Stored) { this->Stored = Stored; } |
clang::CanProxy<clang::RecordType>::CanProxy(clang::CanQual<clang::RecordType>) Line | Count | Source | 355 | 102k | CanProxy(CanQual<T> Stored) { this->Stored = Stored; } |
clang::CanProxy<clang::ReferenceType>::CanProxy(clang::CanQual<clang::ReferenceType>) Line | Count | Source | 355 | 8.60k | CanProxy(CanQual<T> Stored) { this->Stored = Stored; } |
clang::CanProxy<clang::PointerType>::CanProxy(clang::CanQual<clang::PointerType>) Line | Count | Source | 355 | 957k | CanProxy(CanQual<T> Stored) { this->Stored = Stored; } |
clang::CanProxy<clang::FunctionProtoType>::CanProxy(clang::CanQual<clang::FunctionProtoType>) Line | Count | Source | 355 | 6.24M | CanProxy(CanQual<T> Stored) { this->Stored = Stored; } |
clang::CanProxy<clang::BlockPointerType>::CanProxy(clang::CanQual<clang::BlockPointerType>) Line | Count | Source | 355 | 24 | CanProxy(CanQual<T> Stored) { this->Stored = Stored; } |
clang::CanProxy<clang::MemberPointerType>::CanProxy(clang::CanQual<clang::MemberPointerType>) Line | Count | Source | 355 | 1.39k | CanProxy(CanQual<T> Stored) { this->Stored = Stored; } |
clang::CanProxy<clang::FunctionType>::CanProxy(clang::CanQual<clang::FunctionType>) Line | Count | Source | 355 | 519 | CanProxy(CanQual<T> Stored) { this->Stored = Stored; } |
clang::CanProxy<clang::FunctionNoProtoType>::CanProxy(clang::CanQual<clang::FunctionNoProtoType>) Line | Count | Source | 355 | 13.9k | CanProxy(CanQual<T> Stored) { this->Stored = Stored; } |
clang::CanProxy<clang::ComplexType>::CanProxy(clang::CanQual<clang::ComplexType>) Line | Count | Source | 355 | 4 | CanProxy(CanQual<T> Stored) { this->Stored = Stored; } |
|
356 | | |
357 | | /// Implicit conversion to the stored canonical type. |
358 | 1.88M | operator CanQual<T>() const { return this->Stored; } clang::CanProxy<clang::FunctionProtoType>::operator clang::CanQual<clang::FunctionProtoType>() const Line | Count | Source | 358 | 1.22M | operator CanQual<T>() const { return this->Stored; } |
clang::CanProxy<clang::ReferenceType>::operator clang::CanQual<clang::ReferenceType>() const Line | Count | Source | 358 | 12.9k | operator CanQual<T>() const { return this->Stored; } |
clang::CanProxy<clang::PointerType>::operator clang::CanQual<clang::PointerType>() const Line | Count | Source | 358 | 7.23k | operator CanQual<T>() const { return this->Stored; } |
clang::CanProxy<clang::Type>::operator clang::CanQual<clang::Type>() const Line | Count | Source | 358 | 231k | operator CanQual<T>() const { return this->Stored; } |
clang::CanProxy<clang::FunctionNoProtoType>::operator clang::CanQual<clang::FunctionNoProtoType>() const Line | Count | Source | 358 | 408k | operator CanQual<T>() const { return this->Stored; } |
|
359 | | }; |
360 | | |
361 | | } // namespace clang |
362 | | |
363 | | namespace llvm { |
364 | | |
365 | | /// Implement simplify_type for CanQual<T>, so that we can dyn_cast from |
366 | | /// CanQual<T> to a specific Type class. We're prefer isa/dyn_cast/cast/etc. |
367 | | /// to return smart pointer (proxies?). |
368 | | template<typename T> |
369 | | struct simplify_type< ::clang::CanQual<T>> { |
370 | | using SimpleType = const T *; |
371 | | |
372 | 553k | static SimpleType getSimplifiedValue(::clang::CanQual<T> Val) { |
373 | 553k | return Val.getTypePtr(); |
374 | 553k | } |
375 | | }; |
376 | | |
377 | | // Teach SmallPtrSet that CanQual<T> is "basically a pointer". |
378 | | template<typename T> |
379 | | struct PointerLikeTypeTraits<clang::CanQual<T>> { |
380 | 144k | static void *getAsVoidPointer(clang::CanQual<T> P) { |
381 | 144k | return P.getAsOpaquePtr(); |
382 | 144k | } |
383 | | |
384 | | static clang::CanQual<T> getFromVoidPointer(void *P) { |
385 | | return clang::CanQual<T>::getFromOpaquePtr(P); |
386 | | } |
387 | | |
388 | | // qualifier information is encoded in the low bits. |
389 | | static constexpr int NumLowBitsAvailable = 0; |
390 | | }; |
391 | | |
392 | | } // namespace llvm |
393 | | |
394 | | namespace clang { |
395 | | |
396 | | //----------------------------------------------------------------------------// |
397 | | // Canonical proxy adaptors for canonical type nodes. |
398 | | //----------------------------------------------------------------------------// |
399 | | |
400 | | /// Iterator adaptor that turns an iterator over canonical QualTypes |
401 | | /// into an iterator over CanQualTypes. |
402 | | template <typename InputIterator> |
403 | | struct CanTypeIterator |
404 | | : llvm::iterator_adaptor_base< |
405 | | CanTypeIterator<InputIterator>, InputIterator, |
406 | | typename std::iterator_traits<InputIterator>::iterator_category, |
407 | | CanQualType, |
408 | | typename std::iterator_traits<InputIterator>::difference_type, |
409 | | CanProxy<Type>, CanQualType> { |
410 | | CanTypeIterator() = default; |
411 | | explicit CanTypeIterator(InputIterator Iter) |
412 | 1.99M | : CanTypeIterator::iterator_adaptor_base(std::move(Iter)) {} |
413 | | |
414 | 1.02M | CanQualType operator*() const { return CanQualType::CreateUnsafe(*this->I); } |
415 | | CanProxy<Type> operator->() const; |
416 | | }; |
417 | | |
418 | | template<> |
419 | | struct CanProxyAdaptor<ComplexType> : public CanProxyBase<ComplexType> { |
420 | | LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getElementType) |
421 | | }; |
422 | | |
423 | | template<> |
424 | | struct CanProxyAdaptor<PointerType> : public CanProxyBase<PointerType> { |
425 | | LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getPointeeType) |
426 | | }; |
427 | | |
428 | | template<> |
429 | | struct CanProxyAdaptor<BlockPointerType> |
430 | | : public CanProxyBase<BlockPointerType> { |
431 | | LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getPointeeType) |
432 | | }; |
433 | | |
434 | | template<> |
435 | | struct CanProxyAdaptor<ReferenceType> : public CanProxyBase<ReferenceType> { |
436 | | LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getPointeeType) |
437 | | }; |
438 | | |
439 | | template<> |
440 | | struct CanProxyAdaptor<LValueReferenceType> |
441 | | : public CanProxyBase<LValueReferenceType> { |
442 | | LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getPointeeType) |
443 | | }; |
444 | | |
445 | | template<> |
446 | | struct CanProxyAdaptor<RValueReferenceType> |
447 | | : public CanProxyBase<RValueReferenceType> { |
448 | | LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getPointeeType) |
449 | | }; |
450 | | |
451 | | template<> |
452 | | struct CanProxyAdaptor<MemberPointerType> |
453 | | : public CanProxyBase<MemberPointerType> { |
454 | | LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getPointeeType) |
455 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const Type *, getClass) |
456 | | }; |
457 | | |
458 | | // CanProxyAdaptors for arrays are intentionally unimplemented because |
459 | | // they are not safe. |
460 | | template<> struct CanProxyAdaptor<ArrayType>; |
461 | | template<> struct CanProxyAdaptor<ConstantArrayType>; |
462 | | template<> struct CanProxyAdaptor<IncompleteArrayType>; |
463 | | template<> struct CanProxyAdaptor<VariableArrayType>; |
464 | | template<> struct CanProxyAdaptor<DependentSizedArrayType>; |
465 | | |
466 | | template<> |
467 | | struct CanProxyAdaptor<DependentSizedExtVectorType> |
468 | | : public CanProxyBase<DependentSizedExtVectorType> { |
469 | | LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getElementType) |
470 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const Expr *, getSizeExpr) |
471 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(SourceLocation, getAttributeLoc) |
472 | | }; |
473 | | |
474 | | template<> |
475 | | struct CanProxyAdaptor<VectorType> : public CanProxyBase<VectorType> { |
476 | | LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getElementType) |
477 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getNumElements) |
478 | | }; |
479 | | |
480 | | template<> |
481 | | struct CanProxyAdaptor<ExtVectorType> : public CanProxyBase<ExtVectorType> { |
482 | | LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getElementType) |
483 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getNumElements) |
484 | | }; |
485 | | |
486 | | template<> |
487 | | struct CanProxyAdaptor<FunctionType> : public CanProxyBase<FunctionType> { |
488 | | LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getReturnType) |
489 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(FunctionType::ExtInfo, getExtInfo) |
490 | | }; |
491 | | |
492 | | template<> |
493 | | struct CanProxyAdaptor<FunctionNoProtoType> |
494 | | : public CanProxyBase<FunctionNoProtoType> { |
495 | | LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getReturnType) |
496 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(FunctionType::ExtInfo, getExtInfo) |
497 | | }; |
498 | | |
499 | | template<> |
500 | | struct CanProxyAdaptor<FunctionProtoType> |
501 | | : public CanProxyBase<FunctionProtoType> { |
502 | | LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getReturnType) |
503 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(FunctionType::ExtInfo, getExtInfo) |
504 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getNumParams) |
505 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasExtParameterInfos) |
506 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR( |
507 | | ArrayRef<FunctionProtoType::ExtParameterInfo>, getExtParameterInfos) |
508 | | |
509 | 1.49k | CanQualType getParamType(unsigned i) const { |
510 | 1.49k | return CanQualType::CreateUnsafe(this->getTypePtr()->getParamType(i)); |
511 | 1.49k | } |
512 | | |
513 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isVariadic) |
514 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Qualifiers, getMethodQuals) |
515 | | |
516 | | using param_type_iterator = |
517 | | CanTypeIterator<FunctionProtoType::param_type_iterator>; |
518 | | |
519 | 996k | param_type_iterator param_type_begin() const { |
520 | 996k | return param_type_iterator(this->getTypePtr()->param_type_begin()); |
521 | 996k | } |
522 | | |
523 | 996k | param_type_iterator param_type_end() const { |
524 | 996k | return param_type_iterator(this->getTypePtr()->param_type_end()); |
525 | 996k | } |
526 | | |
527 | | // Note: canonical function types never have exception specifications |
528 | | }; |
529 | | |
530 | | template<> |
531 | | struct CanProxyAdaptor<TypeOfType> : public CanProxyBase<TypeOfType> { |
532 | | LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getUnderlyingType) |
533 | | }; |
534 | | |
535 | | template<> |
536 | | struct CanProxyAdaptor<DecltypeType> : public CanProxyBase<DecltypeType> { |
537 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Expr *, getUnderlyingExpr) |
538 | | LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getUnderlyingType) |
539 | | }; |
540 | | |
541 | | template <> |
542 | | struct CanProxyAdaptor<UnaryTransformType> |
543 | | : public CanProxyBase<UnaryTransformType> { |
544 | | LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getBaseType) |
545 | | LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getUnderlyingType) |
546 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(UnaryTransformType::UTTKind, getUTTKind) |
547 | | }; |
548 | | |
549 | | template<> |
550 | | struct CanProxyAdaptor<TagType> : public CanProxyBase<TagType> { |
551 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(TagDecl *, getDecl) |
552 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isBeingDefined) |
553 | | }; |
554 | | |
555 | | template<> |
556 | | struct CanProxyAdaptor<RecordType> : public CanProxyBase<RecordType> { |
557 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(RecordDecl *, getDecl) |
558 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isBeingDefined) |
559 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasConstFields) |
560 | | }; |
561 | | |
562 | | template<> |
563 | | struct CanProxyAdaptor<EnumType> : public CanProxyBase<EnumType> { |
564 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(EnumDecl *, getDecl) |
565 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isBeingDefined) |
566 | | }; |
567 | | |
568 | | template<> |
569 | | struct CanProxyAdaptor<TemplateTypeParmType> |
570 | | : public CanProxyBase<TemplateTypeParmType> { |
571 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getDepth) |
572 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getIndex) |
573 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isParameterPack) |
574 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(TemplateTypeParmDecl *, getDecl) |
575 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(IdentifierInfo *, getIdentifier) |
576 | | }; |
577 | | |
578 | | template<> |
579 | | struct CanProxyAdaptor<ObjCObjectType> |
580 | | : public CanProxyBase<ObjCObjectType> { |
581 | | LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getBaseType) |
582 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const ObjCInterfaceDecl *, |
583 | | getInterface) |
584 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCUnqualifiedId) |
585 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCUnqualifiedClass) |
586 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCQualifiedId) |
587 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCQualifiedClass) |
588 | | |
589 | | using qual_iterator = ObjCObjectPointerType::qual_iterator; |
590 | | |
591 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(qual_iterator, qual_begin) |
592 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(qual_iterator, qual_end) |
593 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, qual_empty) |
594 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getNumProtocols) |
595 | | }; |
596 | | |
597 | | template<> |
598 | | struct CanProxyAdaptor<ObjCObjectPointerType> |
599 | | : public CanProxyBase<ObjCObjectPointerType> { |
600 | | LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getPointeeType) |
601 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const ObjCInterfaceType *, |
602 | | getInterfaceType) |
603 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCIdType) |
604 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCClassType) |
605 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCQualifiedIdType) |
606 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCQualifiedClassType) |
607 | | |
608 | | using qual_iterator = ObjCObjectPointerType::qual_iterator; |
609 | | |
610 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(qual_iterator, qual_begin) |
611 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(qual_iterator, qual_end) |
612 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, qual_empty) |
613 | | LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getNumProtocols) |
614 | | }; |
615 | | |
616 | | //----------------------------------------------------------------------------// |
617 | | // Method and function definitions |
618 | | //----------------------------------------------------------------------------// |
619 | | template<typename T> |
620 | 49.4M | inline CanQual<T> CanQual<T>::getUnqualifiedType() const { |
621 | 49.4M | return CanQual<T>::CreateUnsafe(Stored.getLocalUnqualifiedType()); |
622 | 49.4M | } |
623 | | |
624 | | template<typename T> |
625 | 1.66k | inline CanQual<Type> CanQual<T>::getNonReferenceType() const { |
626 | 1.66k | if (CanQual<ReferenceType> RefType = getAs<ReferenceType>()) |
627 | 0 | return RefType->getPointeeType(); |
628 | 1.66k | else |
629 | 1.66k | return *this; |
630 | 1.66k | } |
631 | | |
632 | | template<typename T> |
633 | 672 | CanQual<T> CanQual<T>::getFromOpaquePtr(void *Ptr) { |
634 | 672 | CanQual<T> Result; |
635 | 672 | Result.Stored = QualType::getFromOpaquePtr(Ptr); |
636 | 672 | assert((!Result || Result.Stored.getAsOpaquePtr() == (void*)-1 || |
637 | 672 | Result.Stored.isCanonical()) && "Type is not canonical!"); |
638 | 0 | return Result; |
639 | 672 | } |
640 | | |
641 | | template<typename T> |
642 | 1.10G | CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) { |
643 | 1.10G | assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!"); |
644 | 0 | assert((Other.isNull() || isa<T>(Other.getTypePtr())) && |
645 | 1.10G | "Dynamic type does not meet the static type's requires"); |
646 | 0 | CanQual<T> Result; |
647 | 1.10G | Result.Stored = Other; |
648 | 1.10G | return Result; |
649 | 1.10G | } clang::CanQual<clang::Type>::CreateUnsafe(clang::QualType) Line | Count | Source | 642 | 1.10G | CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) { | 643 | 1.10G | assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!"); | 644 | 0 | assert((Other.isNull() || isa<T>(Other.getTypePtr())) && | 645 | 1.10G | "Dynamic type does not meet the static type's requires"); | 646 | 0 | CanQual<T> Result; | 647 | 1.10G | Result.Stored = Other; | 648 | 1.10G | return Result; | 649 | 1.10G | } |
clang::CanQual<clang::RecordType>::CreateUnsafe(clang::QualType) Line | Count | Source | 642 | 102k | CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) { | 643 | 102k | assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!"); | 644 | 0 | assert((Other.isNull() || isa<T>(Other.getTypePtr())) && | 645 | 102k | "Dynamic type does not meet the static type's requires"); | 646 | 0 | CanQual<T> Result; | 647 | 102k | Result.Stored = Other; | 648 | 102k | return Result; | 649 | 102k | } |
clang::CanQual<clang::ReferenceType>::CreateUnsafe(clang::QualType) Line | Count | Source | 642 | 4.34k | CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) { | 643 | 4.34k | assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!"); | 644 | 0 | assert((Other.isNull() || isa<T>(Other.getTypePtr())) && | 645 | 4.34k | "Dynamic type does not meet the static type's requires"); | 646 | 0 | CanQual<T> Result; | 647 | 4.34k | Result.Stored = Other; | 648 | 4.34k | return Result; | 649 | 4.34k | } |
clang::CanQual<clang::PointerType>::CreateUnsafe(clang::QualType) Line | Count | Source | 642 | 957k | CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) { | 643 | 957k | assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!"); | 644 | 0 | assert((Other.isNull() || isa<T>(Other.getTypePtr())) && | 645 | 957k | "Dynamic type does not meet the static type's requires"); | 646 | 0 | CanQual<T> Result; | 647 | 957k | Result.Stored = Other; | 648 | 957k | return Result; | 649 | 957k | } |
clang::CanQual<clang::FunctionProtoType>::CreateUnsafe(clang::QualType) Line | Count | Source | 642 | 1.50M | CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) { | 643 | 1.50M | assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!"); | 644 | 0 | assert((Other.isNull() || isa<T>(Other.getTypePtr())) && | 645 | 1.50M | "Dynamic type does not meet the static type's requires"); | 646 | 0 | CanQual<T> Result; | 647 | 1.50M | Result.Stored = Other; | 648 | 1.50M | return Result; | 649 | 1.50M | } |
clang::CanQual<clang::BlockPointerType>::CreateUnsafe(clang::QualType) Line | Count | Source | 642 | 24 | CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) { | 643 | 24 | assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!"); | 644 | 0 | assert((Other.isNull() || isa<T>(Other.getTypePtr())) && | 645 | 24 | "Dynamic type does not meet the static type's requires"); | 646 | 0 | CanQual<T> Result; | 647 | 24 | Result.Stored = Other; | 648 | 24 | return Result; | 649 | 24 | } |
clang::CanQual<clang::MemberPointerType>::CreateUnsafe(clang::QualType) Line | Count | Source | 642 | 1.39k | CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) { | 643 | 1.39k | assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!"); | 644 | 0 | assert((Other.isNull() || isa<T>(Other.getTypePtr())) && | 645 | 1.39k | "Dynamic type does not meet the static type's requires"); | 646 | 0 | CanQual<T> Result; | 647 | 1.39k | Result.Stored = Other; | 648 | 1.39k | return Result; | 649 | 1.39k | } |
clang::CanQual<clang::FunctionType>::CreateUnsafe(clang::QualType) Line | Count | Source | 642 | 519 | CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) { | 643 | 519 | assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!"); | 644 | 0 | assert((Other.isNull() || isa<T>(Other.getTypePtr())) && | 645 | 519 | "Dynamic type does not meet the static type's requires"); | 646 | 0 | CanQual<T> Result; | 647 | 519 | Result.Stored = Other; | 648 | 519 | return Result; | 649 | 519 | } |
clang::CanQual<clang::FunctionNoProtoType>::CreateUnsafe(clang::QualType) Line | Count | Source | 642 | 4.78k | CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) { | 643 | 4.78k | assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!"); | 644 | 0 | assert((Other.isNull() || isa<T>(Other.getTypePtr())) && | 645 | 4.78k | "Dynamic type does not meet the static type's requires"); | 646 | 0 | CanQual<T> Result; | 647 | 4.78k | Result.Stored = Other; | 648 | 4.78k | return Result; | 649 | 4.78k | } |
clang::CanQual<clang::ComplexType>::CreateUnsafe(clang::QualType) Line | Count | Source | 642 | 4 | CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) { | 643 | 4 | assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!"); | 644 | 0 | assert((Other.isNull() || isa<T>(Other.getTypePtr())) && | 645 | 4 | "Dynamic type does not meet the static type's requires"); | 646 | 0 | CanQual<T> Result; | 647 | 4 | Result.Stored = Other; | 648 | 4 | return Result; | 649 | 4 | } |
|
650 | | |
651 | | template<typename T> |
652 | | template<typename U> |
653 | 4.04M | CanProxy<U> CanQual<T>::getAs() const { |
654 | 4.04M | static_assert(!TypeIsArrayType<T>::value, |
655 | 4.04M | "ArrayType cannot be used with getAs!"); |
656 | | |
657 | 4.04M | if (Stored.isNull()) |
658 | 0 | return CanProxy<U>(); |
659 | | |
660 | 4.04M | if (isa<U>(Stored.getTypePtr())) |
661 | 1.38M | return CanQual<U>::CreateUnsafe(Stored); |
662 | | |
663 | 2.65M | return CanProxy<U>(); |
664 | 4.04M | } clang::CanProxy<clang::RecordType> clang::CanQual<clang::Type>::getAs<clang::RecordType>() const Line | Count | Source | 653 | 2.34M | CanProxy<U> CanQual<T>::getAs() const { | 654 | 2.34M | static_assert(!TypeIsArrayType<T>::value, | 655 | 2.34M | "ArrayType cannot be used with getAs!"); | 656 | | | 657 | 2.34M | if (Stored.isNull()) | 658 | 0 | return CanProxy<U>(); | 659 | | | 660 | 2.34M | if (isa<U>(Stored.getTypePtr())) | 661 | 102k | return CanQual<U>::CreateUnsafe(Stored); | 662 | | | 663 | 2.24M | return CanProxy<U>(); | 664 | 2.34M | } |
clang::CanProxy<clang::ReferenceType> clang::CanQual<clang::Type>::getAs<clang::ReferenceType>() const Line | Count | Source | 653 | 13.0k | CanProxy<U> CanQual<T>::getAs() const { | 654 | 13.0k | static_assert(!TypeIsArrayType<T>::value, | 655 | 13.0k | "ArrayType cannot be used with getAs!"); | 656 | | | 657 | 13.0k | if (Stored.isNull()) | 658 | 0 | return CanProxy<U>(); | 659 | | | 660 | 13.0k | if (isa<U>(Stored.getTypePtr())) | 661 | 4.34k | return CanQual<U>::CreateUnsafe(Stored); | 662 | | | 663 | 8.72k | return CanProxy<U>(); | 664 | 13.0k | } |
clang::CanProxy<clang::PointerType> clang::CanQual<clang::Type>::getAs<clang::PointerType>() const Line | Count | Source | 653 | 7.78k | CanProxy<U> CanQual<T>::getAs() const { | 654 | 7.78k | static_assert(!TypeIsArrayType<T>::value, | 655 | 7.78k | "ArrayType cannot be used with getAs!"); | 656 | | | 657 | 7.78k | if (Stored.isNull()) | 658 | 0 | return CanProxy<U>(); | 659 | | | 660 | 7.78k | if (isa<U>(Stored.getTypePtr())) | 661 | 827 | return CanQual<U>::CreateUnsafe(Stored); | 662 | | | 663 | 6.96k | return CanProxy<U>(); | 664 | 7.78k | } |
clang::CanProxy<clang::FunctionProtoType> clang::CanQual<clang::Type>::getAs<clang::FunctionProtoType>() const Line | Count | Source | 653 | 1.04M | CanProxy<U> CanQual<T>::getAs() const { | 654 | 1.04M | static_assert(!TypeIsArrayType<T>::value, | 655 | 1.04M | "ArrayType cannot be used with getAs!"); | 656 | | | 657 | 1.04M | if (Stored.isNull()) | 658 | 0 | return CanProxy<U>(); | 659 | | | 660 | 1.04M | if (isa<U>(Stored.getTypePtr())) | 661 | 1.04M | return CanQual<U>::CreateUnsafe(Stored); | 662 | | | 663 | 0 | return CanProxy<U>(); | 664 | 1.04M | } |
clang::CanProxy<clang::FunctionType> clang::CanQual<clang::Type>::getAs<clang::FunctionType>() const Line | Count | Source | 653 | 519 | CanProxy<U> CanQual<T>::getAs() const { | 654 | 519 | static_assert(!TypeIsArrayType<T>::value, | 655 | 519 | "ArrayType cannot be used with getAs!"); | 656 | | | 657 | 519 | if (Stored.isNull()) | 658 | 0 | return CanProxy<U>(); | 659 | | | 660 | 519 | if (isa<U>(Stored.getTypePtr())) | 661 | 519 | return CanQual<U>::CreateUnsafe(Stored); | 662 | | | 663 | 0 | return CanProxy<U>(); | 664 | 519 | } |
clang::CanProxy<clang::Type> clang::CanQual<clang::FunctionProtoType>::getAs<clang::Type>() const Line | Count | Source | 653 | 231k | CanProxy<U> CanQual<T>::getAs() const { | 654 | 231k | static_assert(!TypeIsArrayType<T>::value, | 655 | 231k | "ArrayType cannot be used with getAs!"); | 656 | | | 657 | 231k | if (Stored.isNull()) | 658 | 0 | return CanProxy<U>(); | 659 | | | 660 | 231k | if (isa<U>(Stored.getTypePtr())) | 661 | 231k | return CanQual<U>::CreateUnsafe(Stored); | 662 | | | 663 | 0 | return CanProxy<U>(); | 664 | 231k | } |
clang::CanProxy<clang::FunctionNoProtoType> clang::CanQual<clang::Type>::getAs<clang::FunctionNoProtoType>() const Line | Count | Source | 653 | 408k | CanProxy<U> CanQual<T>::getAs() const { | 654 | 408k | static_assert(!TypeIsArrayType<T>::value, | 655 | 408k | "ArrayType cannot be used with getAs!"); | 656 | | | 657 | 408k | if (Stored.isNull()) | 658 | 0 | return CanProxy<U>(); | 659 | | | 660 | 408k | if (isa<U>(Stored.getTypePtr())) | 661 | 4.39k | return CanQual<U>::CreateUnsafe(Stored); | 662 | | | 663 | 403k | return CanProxy<U>(); | 664 | 408k | } |
clang::CanProxy<clang::ComplexType> clang::CanQual<clang::Type>::getAs<clang::ComplexType>() const Line | Count | Source | 653 | 26 | CanProxy<U> CanQual<T>::getAs() const { | 654 | 26 | static_assert(!TypeIsArrayType<T>::value, | 655 | 26 | "ArrayType cannot be used with getAs!"); | 656 | | | 657 | 26 | if (Stored.isNull()) | 658 | 0 | return CanProxy<U>(); | 659 | | | 660 | 26 | if (isa<U>(Stored.getTypePtr())) | 661 | 4 | return CanQual<U>::CreateUnsafe(Stored); | 662 | | | 663 | 22 | return CanProxy<U>(); | 664 | 26 | } |
|
665 | | |
666 | | template<typename T> |
667 | | template<typename U> |
668 | 1.36M | CanProxy<U> CanQual<T>::castAs() const { |
669 | 1.36M | static_assert(!TypeIsArrayType<U>::value, |
670 | 1.36M | "ArrayType cannot be used with castAs!"); |
671 | | |
672 | 1.36M | assert(!Stored.isNull() && isa<U>(Stored.getTypePtr())); |
673 | 0 | return CanQual<U>::CreateUnsafe(Stored); |
674 | 1.36M | } clang::CanProxy<clang::PointerType> clang::CanQual<clang::Type>::castAs<clang::PointerType>() const Line | Count | Source | 668 | 956k | CanProxy<U> CanQual<T>::castAs() const { | 669 | 956k | static_assert(!TypeIsArrayType<U>::value, | 670 | 956k | "ArrayType cannot be used with castAs!"); | 671 | | | 672 | 956k | assert(!Stored.isNull() && isa<U>(Stored.getTypePtr())); | 673 | 0 | return CanQual<U>::CreateUnsafe(Stored); | 674 | 956k | } |
clang::CanProxy<clang::BlockPointerType> clang::CanQual<clang::Type>::castAs<clang::BlockPointerType>() const Line | Count | Source | 668 | 24 | CanProxy<U> CanQual<T>::castAs() const { | 669 | 24 | static_assert(!TypeIsArrayType<U>::value, | 670 | 24 | "ArrayType cannot be used with castAs!"); | 671 | | | 672 | 24 | assert(!Stored.isNull() && isa<U>(Stored.getTypePtr())); | 673 | 0 | return CanQual<U>::CreateUnsafe(Stored); | 674 | 24 | } |
clang::CanProxy<clang::MemberPointerType> clang::CanQual<clang::Type>::castAs<clang::MemberPointerType>() const Line | Count | Source | 668 | 1.39k | CanProxy<U> CanQual<T>::castAs() const { | 669 | 1.39k | static_assert(!TypeIsArrayType<U>::value, | 670 | 1.39k | "ArrayType cannot be used with castAs!"); | 671 | | | 672 | 1.39k | assert(!Stored.isNull() && isa<U>(Stored.getTypePtr())); | 673 | 0 | return CanQual<U>::CreateUnsafe(Stored); | 674 | 1.39k | } |
clang::CanProxy<clang::FunctionProtoType> clang::CanQual<clang::Type>::castAs<clang::FunctionProtoType>() const Line | Count | Source | 668 | 403k | CanProxy<U> CanQual<T>::castAs() const { | 669 | 403k | static_assert(!TypeIsArrayType<U>::value, | 670 | 403k | "ArrayType cannot be used with castAs!"); | 671 | | | 672 | 403k | assert(!Stored.isNull() && isa<U>(Stored.getTypePtr())); | 673 | 0 | return CanQual<U>::CreateUnsafe(Stored); | 674 | 403k | } |
|
675 | | |
676 | | template<typename T> |
677 | 15.4M | CanProxy<T> CanQual<T>::operator->() const { |
678 | 15.4M | return CanProxy<T>(*this); |
679 | 15.4M | } clang::CanQual<clang::Type>::operator->() const Line | Count | Source | 677 | 10.6M | CanProxy<T> CanQual<T>::operator->() const { | 678 | 10.6M | return CanProxy<T>(*this); | 679 | 10.6M | } |
clang::CanQual<clang::FunctionProtoType>::operator->() const Line | Count | Source | 677 | 4.79M | CanProxy<T> CanQual<T>::operator->() const { | 678 | 4.79M | return CanProxy<T>(*this); | 679 | 4.79M | } |
clang::CanQual<clang::ReferenceType>::operator->() const Line | Count | Source | 677 | 4.26k | CanProxy<T> CanQual<T>::operator->() const { | 678 | 4.26k | return CanProxy<T>(*this); | 679 | 4.26k | } |
clang::CanQual<clang::PointerType>::operator->() const Line | Count | Source | 677 | 212 | CanProxy<T> CanQual<T>::operator->() const { | 678 | 212 | return CanProxy<T>(*this); | 679 | 212 | } |
clang::CanQual<clang::FunctionNoProtoType>::operator->() const Line | Count | Source | 677 | 9.57k | CanProxy<T> CanQual<T>::operator->() const { | 678 | 9.57k | return CanProxy<T>(*this); | 679 | 9.57k | } |
|
680 | | |
681 | | template <typename InputIterator> |
682 | | CanProxy<Type> CanTypeIterator<InputIterator>::operator->() const { |
683 | | return CanProxy<Type>(*this); |
684 | | } |
685 | | |
686 | | } // namespace clang |
687 | | |
688 | | #endif // LLVM_CLANG_AST_CANONICALTYPE_H |