Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/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
845M
  CanQual() = default;
clang::CanQual<clang::Type>::CanQual()
Line
Count
Source
71
826M
  CanQual() = default;
clang::CanQual<clang::FunctionType>::CanQual()
Line
Count
Source
71
78.9k
  CanQual() = default;
clang::CanQual<clang::FunctionProtoType>::CanQual()
Line
Count
Source
71
13.2M
  CanQual() = default;
clang::CanQual<clang::FunctionNoProtoType>::CanQual()
Line
Count
Source
71
575k
  CanQual() = default;
clang::CanQual<clang::PointerType>::CanQual()
Line
Count
Source
71
2.39M
  CanQual() = default;
clang::CanQual<clang::ComplexType>::CanQual()
Line
Count
Source
71
23
  CanQual() = default;
clang::CanQual<clang::RecordType>::CanQual()
Line
Count
Source
71
2.26M
  CanQual() = default;
clang::CanQual<clang::ReferenceType>::CanQual()
Line
Count
Source
71
11.4k
  CanQual() = default;
clang::CanQual<clang::BlockPointerType>::CanQual()
Line
Count
Source
71
48
  CanQual() = default;
clang::CanQual<clang::MemberPointerType>::CanQual()
Line
Count
Source
71
3.11k
  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
          typename std::enable_if<std::is_base_of<T, U>::value, int>::type = 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
262M
  const T *getTypePtr() const { return cast<T>(Stored.getTypePtr()); }
Unexecuted instantiation: clang::CanQual<clang::ComplexType>::getTypePtr() const
clang::CanQual<clang::PointerType>::getTypePtr() const
Line
Count
Source
83
1.19M
  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
1.07k
  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.67k
  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::FunctionNoProtoType>::getTypePtr() const
Line
Count
Source
83
45.2k
  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
251M
  const T *getTypePtr() const { return cast<T>(Stored.getTypePtr()); }
clang::CanQual<clang::FunctionProtoType>::getTypePtr() const
Line
Count
Source
83
9.55M
  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.15M
  const T *getTypePtrOrNull() const {
88
2.15M
    return cast_or_null<T>(Stored.getTypePtrOrNull());
89
2.15M
  }
clang::CanQual<clang::FunctionType>::getTypePtrOrNull() const
Line
Count
Source
87
39.4k
  const T *getTypePtrOrNull() const {
88
39.4k
    return cast_or_null<T>(Stored.getTypePtrOrNull());
89
39.4k
  }
clang::CanQual<clang::PointerType>::getTypePtrOrNull() const
Line
Count
Source
87
245
  const T *getTypePtrOrNull() const {
88
245
    return cast_or_null<T>(Stored.getTypePtrOrNull());
89
245
  }
clang::CanQual<clang::ComplexType>::getTypePtrOrNull() const
Line
Count
Source
87
21
  const T *getTypePtrOrNull() const {
88
21
    return cast_or_null<T>(Stored.getTypePtrOrNull());
89
21
  }
clang::CanQual<clang::RecordType>::getTypePtrOrNull() const
Line
Count
Source
87
2.11M
  const T *getTypePtrOrNull() const {
88
2.11M
    return cast_or_null<T>(Stored.getTypePtrOrNull());
89
2.11M
  }
90
91
  /// Implicit conversion to a qualified type.
92
642M
  operator QualType() const { return Stored; }
93
94
  /// Implicit conversion to bool.
95
808k
  explicit operator bool() const { return !isNull(); }
clang::CanQual<clang::FunctionNoProtoType>::operator bool() const
Line
Count
Source
95
507k
  explicit operator bool() const { return !isNull(); }
clang::CanQual<clang::ReferenceType>::operator bool() const
Line
Count
Source
95
9.33k
  explicit operator bool() const { return !isNull(); }
clang::CanQual<clang::PointerType>::operator bool() const
Line
Count
Source
95
6.31k
  explicit operator bool() const { return !isNull(); }
clang::CanQual<clang::Type>::operator bool() const
Line
Count
Source
95
285k
  explicit operator bool() const { return !isNull(); }
96
97
813k
  bool isNull() const {
98
813k
    return Stored.isNull();
99
813k
  }
clang::CanQual<clang::FunctionNoProtoType>::isNull() const
Line
Count
Source
97
507k
  bool isNull() const {
98
507k
    return Stored.isNull();
99
507k
  }
clang::CanQual<clang::Type>::isNull() const
Line
Count
Source
97
290k
  bool isNull() const {
98
290k
    return Stored.isNull();
99
290k
  }
clang::CanQual<clang::ReferenceType>::isNull() const
Line
Count
Source
97
9.33k
  bool isNull() const {
98
9.33k
    return Stored.isNull();
99
9.33k
  }
clang::CanQual<clang::PointerType>::isNull() const
Line
Count
Source
97
6.31k
  bool isNull() const {
98
6.31k
    return Stored.isNull();
99
6.31k
  }
100
101
260k
  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
6.49M
  Qualifiers getQualifiers() const { return Stored.getLocalQualifiers(); }
clang::CanQual<clang::Type>::getQualifiers() const
Line
Count
Source
129
6.49M
  Qualifiers getQualifiers() const { return Stored.getLocalQualifiers(); }
clang::CanQual<clang::FunctionProtoType>::getQualifiers() const
Line
Count
Source
129
146
  Qualifiers getQualifiers() const { return Stored.getLocalQualifiers(); }
130
131
  /// Retrieve the const/volatile/restrict qualifiers.
132
1.62M
  unsigned getCVRQualifiers() const { return Stored.getLocalCVRQualifiers(); }
133
134
  /// Determines whether this type has any qualifiers
135
  bool hasQualifiers() const { return Stored.hasLocalQualifiers(); }
136
137
1.95M
  bool isConstQualified() const {
138
1.95M
    return Stored.isLocalConstQualified();
139
1.95M
  }
140
141
6.87k
  bool isVolatileQualified() const {
142
6.87k
    return Stored.isLocalVolatileQualified();
143
6.87k
  }
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
  bool isCanonicalAsParam() const {
153
    return Stored.isCanonicalAsParam();
154
  }
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
306k
  QualType withConst() const {
162
306k
    return Stored.withConst();
163
306k
  }
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
7.83k
  bool isAtLeastAsQualifiedAs(CanQual<T> Other) const {
174
7.83k
    return Stored.isAtLeastAsQualifiedAs(Other.Stored);
175
7.83k
  }
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
148M
  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
15.8M
  void Profile(llvm::FoldingSetNodeID &ID) const {
197
15.8M
    ID.AddPointer(getAsOpaquePtr());
198
15.8M
  }
199
};
200
201
template<typename T, typename U>
202
46.7M
inline bool operator==(CanQual<T> x, CanQual<U> y) {
203
46.7M
  return x.getAsOpaquePtr() == y.getAsOpaquePtr();
204
46.7M
}
205
206
template<typename T, typename U>
207
15.8M
inline bool operator!=(CanQual<T> x, CanQual<U> y) {
208
15.8M
  return x.getAsOpaquePtr() != y.getAsOpaquePtr();
209
15.8M
}
210
211
/// Represents a canonical, potentially-qualified type.
212
using CanQualType = CanQual<Type>;
213
214
2.99M
inline CanQualType Type::getCanonicalTypeUnqualified() const {
215
2.99M
  return CanQualType::CreateUnsafe(getCanonicalTypeInternal());
216
2.99M
}
217
218
inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
219
59
                                           CanQualType T) {
220
59
  DB << static_cast<QualType>(T);
221
59
  return DB;
222
59
}
223
224
//----------------------------------------------------------------------------//
225
// Internal proxy classes used by canonical types
226
//----------------------------------------------------------------------------//
227
228
#define LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(Accessor)                    \
229
2.37M
CanQualType Accessor() const {                                           \
230
2.37M
return CanQualType::CreateUnsafe(this->getTypePtr()->Accessor());      \
231
2.37M
}
Unexecuted instantiation: clang::CanProxyAdaptor<clang::ComplexType>::getElementType() const
clang::CanProxyAdaptor<clang::PointerType>::getPointeeType() const
Line
Count
Source
229
1.19M
CanQualType Accessor() const {                                           \
230
1.19M
return CanQualType::CreateUnsafe(this->getTypePtr()->Accessor());      \
231
1.19M
}
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
1.07k
CanQualType Accessor() const {                                           \
230
1.07k
return CanQualType::CreateUnsafe(this->getTypePtr()->Accessor());      \
231
1.07k
}
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.12k
CanQualType Accessor() const {                                           \
230
1.12k
return CanQualType::CreateUnsafe(this->getTypePtr()->Accessor());      \
231
1.12k
}
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::FunctionNoProtoType>::getReturnType() const
Line
Count
Source
229
22.6k
CanQualType Accessor() const {                                           \
230
22.6k
return CanQualType::CreateUnsafe(this->getTypePtr()->Accessor());      \
231
22.6k
}
clang::CanProxyAdaptor<clang::FunctionProtoType>::getReturnType() const
Line
Count
Source
229
1.15M
CanQualType Accessor() const {                                           \
230
1.15M
return CanQualType::CreateUnsafe(this->getTypePtr()->Accessor());      \
231
1.15M
}
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
232
233
#define LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Type, Accessor)             \
234
12.1M
Type Accessor() const { return this->getTypePtr()->Accessor(); }
clang::CanProxyAdaptor<clang::MemberPointerType>::getClass() const
Line
Count
Source
234
1.55k
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::FunctionNoProtoType>::getExtInfo() const
Line
Count
Source
234
22.6k
Type Accessor() const { return this->getTypePtr()->Accessor(); }
clang::CanProxyAdaptor<clang::FunctionProtoType>::getExtInfo() const
Line
Count
Source
234
1.69M
Type Accessor() const { return this->getTypePtr()->Accessor(); }
clang::CanProxyAdaptor<clang::FunctionProtoType>::getNumParams() const
Line
Count
Source
234
1.45k
Type Accessor() const { return this->getTypePtr()->Accessor(); }
clang::CanProxyAdaptor<clang::FunctionProtoType>::hasExtParameterInfos() const
Line
Count
Source
234
1.69M
Type Accessor() const { return this->getTypePtr()->Accessor(); }
clang::CanProxyAdaptor<clang::FunctionProtoType>::getExtParameterInfos() const
Line
Count
Source
234
617
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>::getAsCXXRecordDecl() const
Line
Count
Source
234
299k
Type Accessor() const { return this->getTypePtr()->Accessor(); }
clang::CanProxyBase<clang::Type>::hasPointerRepresentation() const
Line
Count
Source
234
153
Type Accessor() const { return this->getTypePtr()->Accessor(); }
clang::CanProxyBase<clang::Type>::isVoidType() const
Line
Count
Source
234
702
Type Accessor() const { return this->getTypePtr()->Accessor(); }
clang::CanProxyBase<clang::Type>::isStructureOrClassType() const
Line
Count
Source
234
148
Type Accessor() const { return this->getTypePtr()->Accessor(); }
clang::CanProxyBase<clang::Type>::isDependentType() const
Line
Count
Source
234
208
Type Accessor() const { return this->getTypePtr()->Accessor(); }
clang::CanProxyBase<clang::Type>::isEnumeralType() const
Line
Count
Source
234
132
Type Accessor() const { return this->getTypePtr()->Accessor(); }
clang::CanProxyBase<clang::Type>::getTypeClass() const
Line
Count
Source
234
4.55M
Type Accessor() const { return this->getTypePtr()->Accessor(); }
clang::CanProxyBase<clang::Type>::isUnsignedIntegerType() const
Line
Count
Source
234
10
Type Accessor() const { return this->getTypePtr()->Accessor(); }
clang::CanProxyBase<clang::Type>::isArrayType() const
Line
Count
Source
234
1.95M
Type Accessor() const { return this->getTypePtr()->Accessor(); }
clang::CanProxyBase<clang::Type>::isIncompleteType() const
Line
Count
Source
234
1.95M
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
18.3M
  const T *getTypePtr() const { return Stored.getTypePtr(); }
Unexecuted instantiation: clang::CanProxyBase<clang::ComplexType>::getTypePtr() const
clang::CanProxyBase<clang::PointerType>::getTypePtr() const
Line
Count
Source
245
1.19M
  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
1.07k
  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.67k
  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::FunctionNoProtoType>::getTypePtr() const
Line
Count
Source
245
45.2k
  const T *getTypePtr() const { return Stored.getTypePtr(); }
clang::CanProxyBase<clang::FunctionProtoType>::getTypePtr() const
Line
Count
Source
245
8.29M
  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.76M
  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.15M
  operator const T*() const { return this->Stored.getTypePtrOrNull(); }
clang::CanProxyBase<clang::FunctionType>::operator clang::FunctionType const*() const
Line
Count
Source
254
39.4k
  operator const T*() const { return this->Stored.getTypePtrOrNull(); }
clang::CanProxyBase<clang::PointerType>::operator clang::PointerType const*() const
Line
Count
Source
254
245
  operator const T*() const { return this->Stored.getTypePtrOrNull(); }
clang::CanProxyBase<clang::ComplexType>::operator clang::ComplexType const*() const
Line
Count
Source
254
21
  operator const T*() const { return this->Stored.getTypePtrOrNull(); }
clang::CanProxyBase<clang::RecordType>::operator clang::RecordType const*() const
Line
Count
Source
254
2.11M
  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.17M
  template<typename U> CanProxy<U> getAs() const {
259
2.17M
    return this->Stored.template getAs<U>();
260
2.17M
  }
clang::CanProxy<clang::FunctionType> clang::CanProxyBase<clang::Type>::getAs<clang::FunctionType>() const
Line
Count
Source
258
39.4k
  template<typename U> CanProxy<U> getAs() const {
259
39.4k
    return this->Stored.template getAs<U>();
260
39.4k
  }
clang::CanProxy<clang::ComplexType> clang::CanProxyBase<clang::Type>::getAs<clang::ComplexType>() const
Line
Count
Source
258
21
  template<typename U> CanProxy<U> getAs() const {
259
21
    return this->Stored.template getAs<U>();
260
21
  }
clang::CanProxy<clang::RecordType> clang::CanProxyBase<clang::Type>::getAs<clang::RecordType>() const
Line
Count
Source
258
2.11M
  template<typename U> CanProxy<U> getAs() const {
259
2.11M
    return this->Stored.template getAs<U>();
260
2.11M
  }
clang::CanProxy<clang::FunctionProtoType> clang::CanProxyBase<clang::Type>::getAs<clang::FunctionProtoType>() const
Line
Count
Source
258
146
  template<typename U> CanProxy<U> getAs() const {
259
146
    return this->Stored.template getAs<U>();
260
146
  }
clang::CanProxy<clang::ReferenceType> clang::CanProxyBase<clang::Type>::getAs<clang::ReferenceType>() const
Line
Count
Source
258
7.25k
  template<typename U> CanProxy<U> getAs() const {
259
7.25k
    return this->Stored.template getAs<U>();
260
7.25k
  }
clang::CanProxy<clang::PointerType> clang::CanProxyBase<clang::Type>::getAs<clang::PointerType>() const
Line
Count
Source
258
11.6k
  template<typename U> CanProxy<U> getAs() const {
259
11.6k
    return this->Stored.template getAs<U>();
260
11.6k
  }
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, isIncompleteOrObjectType)
268
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isVariablyModifiedType)
269
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isIntegerType)
270
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isEnumeralType)
271
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isBooleanType)
272
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isCharType)
273
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isWideCharType)
274
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isIntegralType)
275
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isIntegralOrEnumerationType)
276
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isRealFloatingType)
277
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isComplexType)
278
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isAnyComplexType)
279
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isFloatingType)
280
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isRealType)
281
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isArithmeticType)
282
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isVoidType)
283
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isDerivedType)
284
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isScalarType)
285
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isAggregateType)
286
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isAnyPointerType)
287
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isVoidPointerType)
288
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isFunctionPointerType)
289
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isMemberFunctionPointerType)
290
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isClassType)
291
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isStructureType)
292
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isInterfaceType)
293
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isStructureOrClassType)
294
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isUnionType)
295
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isComplexIntegerType)
296
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isNullPtrType)
297
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isDependentType)
298
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isOverloadableType)
299
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isArrayType)
300
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasPointerRepresentation)
301
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasObjCPointerRepresentation)
302
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasIntegerRepresentation)
303
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasSignedIntegerRepresentation)
304
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasUnsignedIntegerRepresentation)
305
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasFloatingRepresentation)
306
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isPromotableIntegerType)
307
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isSignedIntegerType)
308
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isUnsignedIntegerType)
309
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isSignedIntegerOrEnumerationType)
310
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isUnsignedIntegerOrEnumerationType)
311
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isConstantSizeType)
312
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isSpecifierType)
313
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(CXXRecordDecl*, getAsCXXRecordDecl)
314
315
  /// Retrieve the proxy-adaptor type.
316
  ///
317
  /// This arrow operator is used when CanProxyAdaptor has been specialized
318
  /// for the given type T. In that case, we reference members of the
319
  /// CanProxyAdaptor specialization. Otherwise, this operator will be hidden
320
  /// by the arrow operator in the primary CanProxyAdaptor template.
321
19.9M
  const CanProxyAdaptor<T> *operator->() const {
322
19.9M
    return static_cast<const CanProxyAdaptor<T> *>(this);
323
19.9M
  }
clang::CanProxyBase<clang::Type>::operator->() const
Line
Count
Source
321
10.9M
  const CanProxyAdaptor<T> *operator->() const {
322
10.9M
    return static_cast<const CanProxyAdaptor<T> *>(this);
323
10.9M
  }
clang::CanProxyBase<clang::FunctionNoProtoType>::operator->() const
Line
Count
Source
321
45.2k
  const CanProxyAdaptor<T> *operator->() const {
322
45.2k
    return static_cast<const CanProxyAdaptor<T> *>(this);
323
45.2k
  }
clang::CanProxyBase<clang::FunctionProtoType>::operator->() const
Line
Count
Source
321
7.76M
  const CanProxyAdaptor<T> *operator->() const {
322
7.76M
    return static_cast<const CanProxyAdaptor<T> *>(this);
323
7.76M
  }
clang::CanProxyBase<clang::PointerType>::operator->() const
Line
Count
Source
321
1.19M
  const CanProxyAdaptor<T> *operator->() const {
322
1.19M
    return static_cast<const CanProxyAdaptor<T> *>(this);
323
1.19M
  }
clang::CanProxyBase<clang::ReferenceType>::operator->() const
Line
Count
Source
321
1.07k
  const CanProxyAdaptor<T> *operator->() const {
322
1.07k
    return static_cast<const CanProxyAdaptor<T> *>(this);
323
1.07k
  }
clang::CanProxyBase<clang::BlockPointerType>::operator->() const
Line
Count
Source
321
24
  const CanProxyAdaptor<T> *operator->() const {
322
24
    return static_cast<const CanProxyAdaptor<T> *>(this);
323
24
  }
clang::CanProxyBase<clang::MemberPointerType>::operator->() const
Line
Count
Source
321
2.67k
  const CanProxyAdaptor<T> *operator->() const {
322
2.67k
    return static_cast<const CanProxyAdaptor<T> *>(this);
323
2.67k
  }
324
};
325
326
/// Replaceable canonical proxy adaptor class that provides the link
327
/// between a canonical type and the accessors of the type.
328
///
329
/// The CanProxyAdaptor is a replaceable class template that is instantiated
330
/// as part of each canonical proxy type. The primary template merely provides
331
/// redirection to the underlying type (T), e.g., @c PointerType. One can
332
/// provide specializations of this class template for each underlying type
333
/// that provide accessors returning canonical types (@c CanQualType) rather
334
/// than the more typical @c QualType, to propagate the notion of "canonical"
335
/// through the system.
336
template<typename T>
337
struct CanProxyAdaptor : CanProxyBase<T> {};
338
339
/// Canonical proxy type returned when retrieving the members of a
340
/// canonical type or as the result of the @c CanQual<T>::getAs member
341
/// function.
342
///
343
/// The CanProxy type mainly exists as a proxy through which operator-> will
344
/// look to either map down to a raw T* (e.g., PointerType*) or to a proxy
345
/// type that provides canonical-type access to the fields of the type.
346
template<typename T>
347
class CanProxy : public CanProxyAdaptor<T> {
348
public:
349
  /// Build a NULL proxy.
350
2.46M
  CanProxy() = default;
Unexecuted instantiation: clang::CanProxy<clang::FunctionType>::CanProxy()
Unexecuted instantiation: clang::CanProxy<clang::FunctionProtoType>::CanProxy()
Unexecuted instantiation: clang::CanProxy<clang::Type>::CanProxy()
clang::CanProxy<clang::FunctionNoProtoType>::CanProxy()
Line
Count
Source
350
486k
  CanProxy() = default;
clang::CanProxy<clang::ComplexType>::CanProxy()
Line
Count
Source
350
19
  CanProxy() = default;
clang::CanProxy<clang::RecordType>::CanProxy()
Line
Count
Source
350
1.96M
  CanProxy() = default;
clang::CanProxy<clang::ReferenceType>::CanProxy()
Line
Count
Source
350
8.27k
  CanProxy() = default;
clang::CanProxy<clang::PointerType>::CanProxy()
Line
Count
Source
350
6.10k
  CanProxy() = default;
Unexecuted instantiation: clang::CanProxy<clang::BlockPointerType>::CanProxy()
Unexecuted instantiation: clang::CanProxy<clang::MemberPointerType>::CanProxy()
351
352
  /// Build a proxy to the given canonical type.
353
23.3M
  CanProxy(CanQual<T> Stored) { this->Stored = Stored; }
clang::CanProxy<clang::Type>::CanProxy(clang::CanQual<clang::Type>)
Line
Count
Source
353
11.4M
  CanProxy(CanQual<T> Stored) { this->Stored = Stored; }
clang::CanProxy<clang::FunctionType>::CanProxy(clang::CanQual<clang::FunctionType>)
Line
Count
Source
353
39.4k
  CanProxy(CanQual<T> Stored) { this->Stored = Stored; }
clang::CanProxy<clang::FunctionProtoType>::CanProxy(clang::CanQual<clang::FunctionProtoType>)
Line
Count
Source
353
10.4M
  CanProxy(CanQual<T> Stored) { this->Stored = Stored; }
clang::CanProxy<clang::FunctionNoProtoType>::CanProxy(clang::CanQual<clang::FunctionNoProtoType>)
Line
Count
Source
353
66.4k
  CanProxy(CanQual<T> Stored) { this->Stored = Stored; }
clang::CanProxy<clang::PointerType>::CanProxy(clang::CanQual<clang::PointerType>)
Line
Count
Source
353
1.19M
  CanProxy(CanQual<T> Stored) { this->Stored = Stored; }
clang::CanProxy<clang::ComplexType>::CanProxy(clang::CanQual<clang::ComplexType>)
Line
Count
Source
353
2
  CanProxy(CanQual<T> Stored) { this->Stored = Stored; }
clang::CanProxy<clang::RecordType>::CanProxy(clang::CanQual<clang::RecordType>)
Line
Count
Source
353
149k
  CanProxy(CanQual<T> Stored) { this->Stored = Stored; }
clang::CanProxy<clang::ReferenceType>::CanProxy(clang::CanQual<clang::ReferenceType>)
Line
Count
Source
353
2.13k
  CanProxy(CanQual<T> Stored) { this->Stored = Stored; }
clang::CanProxy<clang::BlockPointerType>::CanProxy(clang::CanQual<clang::BlockPointerType>)
Line
Count
Source
353
24
  CanProxy(CanQual<T> Stored) { this->Stored = Stored; }
clang::CanProxy<clang::MemberPointerType>::CanProxy(clang::CanQual<clang::MemberPointerType>)
Line
Count
Source
353
1.55k
  CanProxy(CanQual<T> Stored) { this->Stored = Stored; }
354
355
  /// Implicit conversion to the stored canonical type.
356
3.19M
  operator CanQual<T>() const { return this->Stored; }
clang::CanProxy<clang::FunctionProtoType>::operator clang::CanQual<clang::FunctionProtoType>() const
Line
Count
Source
356
2.12M
  operator CanQual<T>() const { return this->Stored; }
clang::CanProxy<clang::Type>::operator clang::CanQual<clang::Type>() const
Line
Count
Source
356
550k
  operator CanQual<T>() const { return this->Stored; }
clang::CanProxy<clang::FunctionNoProtoType>::operator clang::CanQual<clang::FunctionNoProtoType>() const
Line
Count
Source
356
507k
  operator CanQual<T>() const { return this->Stored; }
clang::CanProxy<clang::ReferenceType>::operator clang::CanQual<clang::ReferenceType>() const
Line
Count
Source
356
9.33k
  operator CanQual<T>() const { return this->Stored; }
clang::CanProxy<clang::PointerType>::operator clang::CanQual<clang::PointerType>() const
Line
Count
Source
356
6.31k
  operator CanQual<T>() const { return this->Stored; }
357
};
358
359
} // namespace clang
360
361
namespace llvm {
362
363
/// Implement simplify_type for CanQual<T>, so that we can dyn_cast from
364
/// CanQual<T> to a specific Type class. We're prefer isa/dyn_cast/cast/etc.
365
/// to return smart pointer (proxies?).
366
template<typename T>
367
struct simplify_type< ::clang::CanQual<T>> {
368
  using SimpleType = const T *;
369
370
856k
  static SimpleType getSimplifiedValue(::clang::CanQual<T> Val) {
371
856k
    return Val.getTypePtr();
372
856k
  }
373
};
374
375
// Teach SmallPtrSet that CanQual<T> is "basically a pointer".
376
template<typename T>
377
struct PointerLikeTypeTraits<clang::CanQual<T>> {
378
271k
  static void *getAsVoidPointer(clang::CanQual<T> P) {
379
271k
    return P.getAsOpaquePtr();
380
271k
  }
381
382
  static clang::CanQual<T> getFromVoidPointer(void *P) {
383
    return clang::CanQual<T>::getFromOpaquePtr(P);
384
  }
385
386
  // qualifier information is encoded in the low bits.
387
  enum { NumLowBitsAvailable = 0 };
388
};
389
390
} // namespace llvm
391
392
namespace clang {
393
394
//----------------------------------------------------------------------------//
395
// Canonical proxy adaptors for canonical type nodes.
396
//----------------------------------------------------------------------------//
397
398
/// Iterator adaptor that turns an iterator over canonical QualTypes
399
/// into an iterator over CanQualTypes.
400
template <typename InputIterator>
401
struct CanTypeIterator
402
    : llvm::iterator_adaptor_base<
403
          CanTypeIterator<InputIterator>, InputIterator,
404
          typename std::iterator_traits<InputIterator>::iterator_category,
405
          CanQualType,
406
          typename std::iterator_traits<InputIterator>::difference_type,
407
          CanProxy<Type>, CanQualType> {
408
  CanTypeIterator() = default;
409
  explicit CanTypeIterator(InputIterator Iter)
410
3.20M
      : CanTypeIterator::iterator_adaptor_base(std::move(Iter)) {}
411
412
1.77M
  CanQualType operator*() const { return CanQualType::CreateUnsafe(*this->I); }
413
  CanProxy<Type> operator->() const;
414
};
415
416
template<>
417
struct CanProxyAdaptor<ComplexType> : public CanProxyBase<ComplexType> {
418
  LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getElementType)
419
};
420
421
template<>
422
struct CanProxyAdaptor<PointerType> : public CanProxyBase<PointerType> {
423
  LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getPointeeType)
424
};
425
426
template<>
427
struct CanProxyAdaptor<BlockPointerType>
428
  : public CanProxyBase<BlockPointerType> {
429
  LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getPointeeType)
430
};
431
432
template<>
433
struct CanProxyAdaptor<ReferenceType> : public CanProxyBase<ReferenceType> {
434
  LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getPointeeType)
435
};
436
437
template<>
438
struct CanProxyAdaptor<LValueReferenceType>
439
  : public CanProxyBase<LValueReferenceType> {
440
  LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getPointeeType)
441
};
442
443
template<>
444
struct CanProxyAdaptor<RValueReferenceType>
445
  : public CanProxyBase<RValueReferenceType> {
446
  LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getPointeeType)
447
};
448
449
template<>
450
struct CanProxyAdaptor<MemberPointerType>
451
  : public CanProxyBase<MemberPointerType> {
452
  LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getPointeeType)
453
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const Type *, getClass)
454
};
455
456
// CanProxyAdaptors for arrays are intentionally unimplemented because
457
// they are not safe.
458
template<> struct CanProxyAdaptor<ArrayType>;
459
template<> struct CanProxyAdaptor<ConstantArrayType>;
460
template<> struct CanProxyAdaptor<IncompleteArrayType>;
461
template<> struct CanProxyAdaptor<VariableArrayType>;
462
template<> struct CanProxyAdaptor<DependentSizedArrayType>;
463
464
template<>
465
struct CanProxyAdaptor<DependentSizedExtVectorType>
466
  : public CanProxyBase<DependentSizedExtVectorType> {
467
  LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getElementType)
468
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const Expr *, getSizeExpr)
469
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(SourceLocation, getAttributeLoc)
470
};
471
472
template<>
473
struct CanProxyAdaptor<VectorType> : public CanProxyBase<VectorType> {
474
  LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getElementType)
475
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getNumElements)
476
};
477
478
template<>
479
struct CanProxyAdaptor<ExtVectorType> : public CanProxyBase<ExtVectorType> {
480
  LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getElementType)
481
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getNumElements)
482
};
483
484
template<>
485
struct CanProxyAdaptor<FunctionType> : public CanProxyBase<FunctionType> {
486
  LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getReturnType)
487
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(FunctionType::ExtInfo, getExtInfo)
488
};
489
490
template<>
491
struct CanProxyAdaptor<FunctionNoProtoType>
492
  : public CanProxyBase<FunctionNoProtoType> {
493
  LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getReturnType)
494
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(FunctionType::ExtInfo, getExtInfo)
495
};
496
497
template<>
498
struct CanProxyAdaptor<FunctionProtoType>
499
  : public CanProxyBase<FunctionProtoType> {
500
  LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getReturnType)
501
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(FunctionType::ExtInfo, getExtInfo)
502
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getNumParams)
503
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasExtParameterInfos)
504
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(
505
            ArrayRef<FunctionProtoType::ExtParameterInfo>, getExtParameterInfos)
506
507
1.46k
  CanQualType getParamType(unsigned i) const {
508
1.46k
    return CanQualType::CreateUnsafe(this->getTypePtr()->getParamType(i));
509
1.46k
  }
510
511
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isVariadic)
512
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Qualifiers, getMethodQuals)
513
514
  using param_type_iterator =
515
      CanTypeIterator<FunctionProtoType::param_type_iterator>;
516
517
1.60M
  param_type_iterator param_type_begin() const {
518
1.60M
    return param_type_iterator(this->getTypePtr()->param_type_begin());
519
1.60M
  }
520
521
1.60M
  param_type_iterator param_type_end() const {
522
1.60M
    return param_type_iterator(this->getTypePtr()->param_type_end());
523
1.60M
  }
524
525
  // Note: canonical function types never have exception specifications
526
};
527
528
template<>
529
struct CanProxyAdaptor<TypeOfType> : public CanProxyBase<TypeOfType> {
530
  LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getUnderlyingType)
531
};
532
533
template<>
534
struct CanProxyAdaptor<DecltypeType> : public CanProxyBase<DecltypeType> {
535
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(Expr *, getUnderlyingExpr)
536
  LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getUnderlyingType)
537
};
538
539
template <>
540
struct CanProxyAdaptor<UnaryTransformType>
541
    : public CanProxyBase<UnaryTransformType> {
542
  LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getBaseType)
543
  LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getUnderlyingType)
544
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(UnaryTransformType::UTTKind, getUTTKind)
545
};
546
547
template<>
548
struct CanProxyAdaptor<TagType> : public CanProxyBase<TagType> {
549
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(TagDecl *, getDecl)
550
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isBeingDefined)
551
};
552
553
template<>
554
struct CanProxyAdaptor<RecordType> : public CanProxyBase<RecordType> {
555
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(RecordDecl *, getDecl)
556
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isBeingDefined)
557
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasConstFields)
558
};
559
560
template<>
561
struct CanProxyAdaptor<EnumType> : public CanProxyBase<EnumType> {
562
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(EnumDecl *, getDecl)
563
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isBeingDefined)
564
};
565
566
template<>
567
struct CanProxyAdaptor<TemplateTypeParmType>
568
  : public CanProxyBase<TemplateTypeParmType> {
569
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getDepth)
570
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getIndex)
571
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isParameterPack)
572
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(TemplateTypeParmDecl *, getDecl)
573
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(IdentifierInfo *, getIdentifier)
574
};
575
576
template<>
577
struct CanProxyAdaptor<ObjCObjectType>
578
  : public CanProxyBase<ObjCObjectType> {
579
  LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getBaseType)
580
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const ObjCInterfaceDecl *,
581
                                      getInterface)
582
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCUnqualifiedId)
583
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCUnqualifiedClass)
584
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCQualifiedId)
585
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCQualifiedClass)
586
587
  using qual_iterator = ObjCObjectPointerType::qual_iterator;
588
589
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(qual_iterator, qual_begin)
590
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(qual_iterator, qual_end)
591
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, qual_empty)
592
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getNumProtocols)
593
};
594
595
template<>
596
struct CanProxyAdaptor<ObjCObjectPointerType>
597
  : public CanProxyBase<ObjCObjectPointerType> {
598
  LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getPointeeType)
599
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(const ObjCInterfaceType *,
600
                                      getInterfaceType)
601
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCIdType)
602
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCClassType)
603
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCQualifiedIdType)
604
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isObjCQualifiedClassType)
605
606
  using qual_iterator = ObjCObjectPointerType::qual_iterator;
607
608
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(qual_iterator, qual_begin)
609
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(qual_iterator, qual_end)
610
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, qual_empty)
611
  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getNumProtocols)
612
};
613
614
//----------------------------------------------------------------------------//
615
// Method and function definitions
616
//----------------------------------------------------------------------------//
617
template<typename T>
618
41.2M
inline CanQual<T> CanQual<T>::getUnqualifiedType() const {
619
41.2M
  return CanQual<T>::CreateUnsafe(Stored.getLocalUnqualifiedType());
620
41.2M
}
621
622
template<typename T>
623
2.09k
inline CanQual<Type> CanQual<T>::getNonReferenceType() const {
624
2.09k
  if (CanQual<ReferenceType> RefType = getAs<ReferenceType>())
625
0
    return RefType->getPointeeType();
626
2.09k
  else
627
2.09k
    return *this;
628
2.09k
}
629
630
template<typename T>
631
591
CanQual<T> CanQual<T>::getFromOpaquePtr(void *Ptr) {
632
591
  CanQual<T> Result;
633
591
  Result.Stored = QualType::getFromOpaquePtr(Ptr);
634
591
  assert((!Result || Result.Stored.getAsOpaquePtr() == (void*)-1 ||
635
591
          Result.Stored.isCanonical()) && "Type is not canonical!");
636
591
  return Result;
637
591
}
638
639
template<typename T>
640
814M
CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) {
641
814M
  assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!");
642
814M
  assert((Other.isNull() || isa<T>(Other.getTypePtr())) &&
643
814M
         "Dynamic type does not meet the static type's requires");
644
814M
  CanQual<T> Result;
645
814M
  Result.Stored = Other;
646
814M
  return Result;
647
814M
}
clang::CanQual<clang::Type>::CreateUnsafe(clang::QualType)
Line
Count
Source
640
809M
CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) {
641
809M
  assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!");
642
809M
  assert((Other.isNull() || isa<T>(Other.getTypePtr())) &&
643
809M
         "Dynamic type does not meet the static type's requires");
644
809M
  CanQual<T> Result;
645
809M
  Result.Stored = Other;
646
809M
  return Result;
647
809M
}
clang::CanQual<clang::FunctionType>::CreateUnsafe(clang::QualType)
Line
Count
Source
640
39.4k
CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) {
641
39.4k
  assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!");
642
39.4k
  assert((Other.isNull() || isa<T>(Other.getTypePtr())) &&
643
39.4k
         "Dynamic type does not meet the static type's requires");
644
39.4k
  CanQual<T> Result;
645
39.4k
  Result.Stored = Other;
646
39.4k
  return Result;
647
39.4k
}
clang::CanQual<clang::FunctionProtoType>::CreateUnsafe(clang::QualType)
Line
Count
Source
640
2.78M
CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) {
641
2.78M
  assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!");
642
2.78M
  assert((Other.isNull() || isa<T>(Other.getTypePtr())) &&
643
2.78M
         "Dynamic type does not meet the static type's requires");
644
2.78M
  CanQual<T> Result;
645
2.78M
  Result.Stored = Other;
646
2.78M
  return Result;
647
2.78M
}
clang::CanQual<clang::FunctionNoProtoType>::CreateUnsafe(clang::QualType)
Line
Count
Source
640
22.6k
CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) {
641
22.6k
  assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!");
642
22.6k
  assert((Other.isNull() || isa<T>(Other.getTypePtr())) &&
643
22.6k
         "Dynamic type does not meet the static type's requires");
644
22.6k
  CanQual<T> Result;
645
22.6k
  Result.Stored = Other;
646
22.6k
  return Result;
647
22.6k
}
clang::CanQual<clang::PointerType>::CreateUnsafe(clang::QualType)
Line
Count
Source
640
1.19M
CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) {
641
1.19M
  assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!");
642
1.19M
  assert((Other.isNull() || isa<T>(Other.getTypePtr())) &&
643
1.19M
         "Dynamic type does not meet the static type's requires");
644
1.19M
  CanQual<T> Result;
645
1.19M
  Result.Stored = Other;
646
1.19M
  return Result;
647
1.19M
}
clang::CanQual<clang::ComplexType>::CreateUnsafe(clang::QualType)
Line
Count
Source
640
2
CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) {
641
2
  assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!");
642
2
  assert((Other.isNull() || isa<T>(Other.getTypePtr())) &&
643
2
         "Dynamic type does not meet the static type's requires");
644
2
  CanQual<T> Result;
645
2
  Result.Stored = Other;
646
2
  return Result;
647
2
}
clang::CanQual<clang::RecordType>::CreateUnsafe(clang::QualType)
Line
Count
Source
640
149k
CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) {
641
149k
  assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!");
642
149k
  assert((Other.isNull() || isa<T>(Other.getTypePtr())) &&
643
149k
         "Dynamic type does not meet the static type's requires");
644
149k
  CanQual<T> Result;
645
149k
  Result.Stored = Other;
646
149k
  return Result;
647
149k
}
clang::CanQual<clang::ReferenceType>::CreateUnsafe(clang::QualType)
Line
Count
Source
640
1.07k
CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) {
641
1.07k
  assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!");
642
1.07k
  assert((Other.isNull() || isa<T>(Other.getTypePtr())) &&
643
1.07k
         "Dynamic type does not meet the static type's requires");
644
1.07k
  CanQual<T> Result;
645
1.07k
  Result.Stored = Other;
646
1.07k
  return Result;
647
1.07k
}
clang::CanQual<clang::BlockPointerType>::CreateUnsafe(clang::QualType)
Line
Count
Source
640
24
CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) {
641
24
  assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!");
642
24
  assert((Other.isNull() || isa<T>(Other.getTypePtr())) &&
643
24
         "Dynamic type does not meet the static type's requires");
644
24
  CanQual<T> Result;
645
24
  Result.Stored = Other;
646
24
  return Result;
647
24
}
clang::CanQual<clang::MemberPointerType>::CreateUnsafe(clang::QualType)
Line
Count
Source
640
1.55k
CanQual<T> CanQual<T>::CreateUnsafe(QualType Other) {
641
1.55k
  assert((Other.isNull() || Other.isCanonical()) && "Type is not canonical!");
642
1.55k
  assert((Other.isNull() || isa<T>(Other.getTypePtr())) &&
643
1.55k
         "Dynamic type does not meet the static type's requires");
644
1.55k
  CanQual<T> Result;
645
1.55k
  Result.Stored = Other;
646
1.55k
  return Result;
647
1.55k
}
648
649
template<typename T>
650
template<typename U>
651
6.59M
CanProxy<U> CanQual<T>::getAs() const {
652
6.59M
  static_assert(!TypeIsArrayType<T>::value,
653
6.59M
                "ArrayType cannot be used with getAs!");
654
6.59M
655
6.59M
  if (Stored.isNull())
656
0
    return CanProxy<U>();
657
6.59M
658
6.59M
  if (isa<U>(Stored.getTypePtr()))
659
4.12M
    return CanQual<U>::CreateUnsafe(Stored);
660
2.46M
661
2.46M
  return CanProxy<U>();
662
2.46M
}
clang::CanProxy<clang::FunctionType> clang::CanQual<clang::Type>::getAs<clang::FunctionType>() const
Line
Count
Source
651
39.4k
CanProxy<U> CanQual<T>::getAs() const {
652
39.4k
  static_assert(!TypeIsArrayType<T>::value,
653
39.4k
                "ArrayType cannot be used with getAs!");
654
39.4k
655
39.4k
  if (Stored.isNull())
656
0
    return CanProxy<U>();
657
39.4k
658
39.4k
  if (isa<U>(Stored.getTypePtr()))
659
39.4k
    return CanQual<U>::CreateUnsafe(Stored);
660
0
661
0
  return CanProxy<U>();
662
0
}
clang::CanProxy<clang::FunctionProtoType> clang::CanQual<clang::Type>::getAs<clang::FunctionProtoType>() const
Line
Count
Source
651
2.17M
CanProxy<U> CanQual<T>::getAs() const {
652
2.17M
  static_assert(!TypeIsArrayType<T>::value,
653
2.17M
                "ArrayType cannot be used with getAs!");
654
2.17M
655
2.17M
  if (Stored.isNull())
656
0
    return CanProxy<U>();
657
2.17M
658
2.17M
  if (isa<U>(Stored.getTypePtr()))
659
2.17M
    return CanQual<U>::CreateUnsafe(Stored);
660
0
661
0
  return CanProxy<U>();
662
0
}
clang::CanProxy<clang::Type> clang::CanQual<clang::FunctionProtoType>::getAs<clang::Type>() const
Line
Count
Source
651
550k
CanProxy<U> CanQual<T>::getAs() const {
652
550k
  static_assert(!TypeIsArrayType<T>::value,
653
550k
                "ArrayType cannot be used with getAs!");
654
550k
655
550k
  if (Stored.isNull())
656
0
    return CanProxy<U>();
657
550k
658
550k
  if (isa<U>(Stored.getTypePtr()))
659
550k
    return CanQual<U>::CreateUnsafe(Stored);
660
0
661
0
  return CanProxy<U>();
662
0
}
clang::CanProxy<clang::FunctionNoProtoType> clang::CanQual<clang::Type>::getAs<clang::FunctionNoProtoType>() const
Line
Count
Source
651
507k
CanProxy<U> CanQual<T>::getAs() const {
652
507k
  static_assert(!TypeIsArrayType<T>::value,
653
507k
                "ArrayType cannot be used with getAs!");
654
507k
655
507k
  if (Stored.isNull())
656
0
    return CanProxy<U>();
657
507k
658
507k
  if (isa<U>(Stored.getTypePtr()))
659
21.2k
    return CanQual<U>::CreateUnsafe(Stored);
660
486k
661
486k
  return CanProxy<U>();
662
486k
}
clang::CanProxy<clang::ComplexType> clang::CanQual<clang::Type>::getAs<clang::ComplexType>() const
Line
Count
Source
651
21
CanProxy<U> CanQual<T>::getAs() const {
652
21
  static_assert(!TypeIsArrayType<T>::value,
653
21
                "ArrayType cannot be used with getAs!");
654
21
655
21
  if (Stored.isNull())
656
0
    return CanProxy<U>();
657
21
658
21
  if (isa<U>(Stored.getTypePtr()))
659
2
    return CanQual<U>::CreateUnsafe(Stored);
660
19
661
19
  return CanProxy<U>();
662
19
}
clang::CanProxy<clang::RecordType> clang::CanQual<clang::Type>::getAs<clang::RecordType>() const
Line
Count
Source
651
2.11M
CanProxy<U> CanQual<T>::getAs() const {
652
2.11M
  static_assert(!TypeIsArrayType<T>::value,
653
2.11M
                "ArrayType cannot be used with getAs!");
654
2.11M
655
2.11M
  if (Stored.isNull())
656
0
    return CanProxy<U>();
657
2.11M
658
2.11M
  if (isa<U>(Stored.getTypePtr()))
659
149k
    return CanQual<U>::CreateUnsafe(Stored);
660
1.96M
661
1.96M
  return CanProxy<U>();
662
1.96M
}
clang::CanProxy<clang::ReferenceType> clang::CanQual<clang::Type>::getAs<clang::ReferenceType>() const
Line
Count
Source
651
9.34k
CanProxy<U> CanQual<T>::getAs() const {
652
9.34k
  static_assert(!TypeIsArrayType<T>::value,
653
9.34k
                "ArrayType cannot be used with getAs!");
654
9.34k
655
9.34k
  if (Stored.isNull())
656
0
    return CanProxy<U>();
657
9.34k
658
9.34k
  if (isa<U>(Stored.getTypePtr()))
659
1.07k
    return CanQual<U>::CreateUnsafe(Stored);
660
8.27k
661
8.27k
  return CanProxy<U>();
662
8.27k
}
clang::CanProxy<clang::PointerType> clang::CanQual<clang::Type>::getAs<clang::PointerType>() const
Line
Count
Source
651
1.19M
CanProxy<U> CanQual<T>::getAs() const {
652
1.19M
  static_assert(!TypeIsArrayType<T>::value,
653
1.19M
                "ArrayType cannot be used with getAs!");
654
1.19M
655
1.19M
  if (Stored.isNull())
656
0
    return CanProxy<U>();
657
1.19M
658
1.19M
  if (isa<U>(Stored.getTypePtr()))
659
1.19M
    return CanQual<U>::CreateUnsafe(Stored);
660
6.10k
661
6.10k
  return CanProxy<U>();
662
6.10k
}
clang::CanProxy<clang::BlockPointerType> clang::CanQual<clang::Type>::getAs<clang::BlockPointerType>() const
Line
Count
Source
651
24
CanProxy<U> CanQual<T>::getAs() const {
652
24
  static_assert(!TypeIsArrayType<T>::value,
653
24
                "ArrayType cannot be used with getAs!");
654
24
655
24
  if (Stored.isNull())
656
0
    return CanProxy<U>();
657
24
658
24
  if (isa<U>(Stored.getTypePtr()))
659
24
    return CanQual<U>::CreateUnsafe(Stored);
660
0
661
0
  return CanProxy<U>();
662
0
}
clang::CanProxy<clang::MemberPointerType> clang::CanQual<clang::Type>::getAs<clang::MemberPointerType>() const
Line
Count
Source
651
1.55k
CanProxy<U> CanQual<T>::getAs() const {
652
1.55k
  static_assert(!TypeIsArrayType<T>::value,
653
1.55k
                "ArrayType cannot be used with getAs!");
654
1.55k
655
1.55k
  if (Stored.isNull())
656
0
    return CanProxy<U>();
657
1.55k
658
1.55k
  if (isa<U>(Stored.getTypePtr()))
659
1.55k
    return CanQual<U>::CreateUnsafe(Stored);
660
0
661
0
  return CanProxy<U>();
662
0
}
663
664
template<typename T>
665
template<typename U>
666
486k
CanProxy<U> CanQual<T>::castAs() const {
667
486k
  static_assert(!TypeIsArrayType<U>::value,
668
486k
                "ArrayType cannot be used with castAs!");
669
486k
670
486k
  assert(!Stored.isNull() && isa<U>(Stored.getTypePtr()));
671
486k
  return CanQual<U>::CreateUnsafe(Stored);
672
486k
}
clang::CanProxy<clang::FunctionProtoType> clang::CanQual<clang::Type>::castAs<clang::FunctionProtoType>() const
Line
Count
Source
666
486k
CanProxy<U> CanQual<T>::castAs() const {
667
486k
  static_assert(!TypeIsArrayType<U>::value,
668
486k
                "ArrayType cannot be used with castAs!");
669
486k
670
486k
  assert(!Stored.isNull() && isa<U>(Stored.getTypePtr()));
671
486k
  return CanQual<U>::CreateUnsafe(Stored);
672
486k
}
clang::CanProxy<clang::PointerType> clang::CanQual<clang::Type>::castAs<clang::PointerType>() const
Line
Count
Source
666
247
CanProxy<U> CanQual<T>::castAs() const {
667
247
  static_assert(!TypeIsArrayType<U>::value,
668
247
                "ArrayType cannot be used with castAs!");
669
247
670
247
  assert(!Stored.isNull() && isa<U>(Stored.getTypePtr()));
671
247
  return CanQual<U>::CreateUnsafe(Stored);
672
247
}
673
674
template<typename T>
675
18.7M
CanProxy<T> CanQual<T>::operator->() const {
676
18.7M
  return CanProxy<T>(*this);
677
18.7M
}
clang::CanQual<clang::Type>::operator->() const
Line
Count
Source
675
10.9M
CanProxy<T> CanQual<T>::operator->() const {
676
10.9M
  return CanProxy<T>(*this);
677
10.9M
}
clang::CanQual<clang::FunctionNoProtoType>::operator->() const
Line
Count
Source
675
45.2k
CanProxy<T> CanQual<T>::operator->() const {
676
45.2k
  return CanProxy<T>(*this);
677
45.2k
}
clang::CanQual<clang::FunctionProtoType>::operator->() const
Line
Count
Source
675
7.76M
CanProxy<T> CanQual<T>::operator->() const {
676
7.76M
  return CanProxy<T>(*this);
677
7.76M
}
clang::CanQual<clang::ReferenceType>::operator->() const
Line
Count
Source
675
1.06k
CanProxy<T> CanQual<T>::operator->() const {
676
1.06k
  return CanProxy<T>(*this);
677
1.06k
}
clang::CanQual<clang::PointerType>::operator->() const
Line
Count
Source
675
152
CanProxy<T> CanQual<T>::operator->() const {
676
152
  return CanProxy<T>(*this);
677
152
}
678
679
template <typename InputIterator>
680
CanProxy<Type> CanTypeIterator<InputIterator>::operator->() const {
681
  return CanProxy<Type>(*this);
682
}
683
684
} // namespace clang
685
686
#endif // LLVM_CLANG_AST_CANONICALTYPE_H