Coverage Report

Created: 2018-07-22 10:17

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/include/clang/AST/ASTTypeTraits.h
Line
Count
Source (jump to first uncovered line)
1
//===--- ASTTypeTraits.h ----------------------------------------*- C++ -*-===//
2
//
3
//                     The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
//
10
//  Provides a dynamic type identifier and a dynamically typed node container
11
//  that can be used to store an AST base node at runtime in the same storage in
12
//  a type safe way.
13
//
14
//===----------------------------------------------------------------------===//
15
16
#ifndef LLVM_CLANG_AST_ASTTYPETRAITS_H
17
#define LLVM_CLANG_AST_ASTTYPETRAITS_H
18
19
#include "clang/AST/ASTFwd.h"
20
#include "clang/AST/Decl.h"
21
#include "clang/AST/NestedNameSpecifier.h"
22
#include "clang/AST/Stmt.h"
23
#include "clang/AST/TemplateBase.h"
24
#include "clang/AST/TypeLoc.h"
25
#include "clang/Basic/LLVM.h"
26
#include "llvm/ADT/DenseMapInfo.h"
27
#include "llvm/Support/AlignOf.h"
28
29
namespace llvm {
30
31
class raw_ostream;
32
33
}
34
35
namespace clang {
36
37
struct PrintingPolicy;
38
39
namespace ast_type_traits {
40
41
/// Kind identifier.
42
///
43
/// It can be constructed from any node kind and allows for runtime type
44
/// hierarchy checks.
45
/// Use getFromNodeKind<T>() to construct them.
46
0
class ASTNodeKind {
Unexecuted instantiation: clang::ast_type_traits::ASTNodeKind::operator=(clang::ast_type_traits::ASTNodeKind const&)
Unexecuted instantiation: clang::ast_type_traits::ASTNodeKind::operator=(clang::ast_type_traits::ASTNodeKind&&)
47
public:
48
  /// Empty identifier. It matches nothing.
49
609k
  ASTNodeKind() : KindId(NKI_None) {}
50
51
  /// Construct an identifier for T.
52
  template <class T>
53
1.22M
  static ASTNodeKind getFromNodeKind() {
54
1.22M
    return ASTNodeKind(KindToKindId<T>::Id);
55
1.22M
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::QualType>()
Line
Count
Source
53
137k
  static ASTNodeKind getFromNodeKind() {
54
137k
    return ASTNodeKind(KindToKindId<T>::Id);
55
137k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::TemplateName>()
Line
Count
Source
53
48
  static ASTNodeKind getFromNodeKind() {
54
48
    return ASTNodeKind(KindToKindId<T>::Id);
55
48
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::CXXRecordDecl>()
Line
Count
Source
53
1.32k
  static ASTNodeKind getFromNodeKind() {
54
1.32k
    return ASTNodeKind(KindToKindId<T>::Id);
55
1.32k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::CallExpr>()
Line
Count
Source
53
20.8k
  static ASTNodeKind getFromNodeKind() {
54
20.8k
    return ASTNodeKind(KindToKindId<T>::Id);
55
20.8k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::Stmt>()
Line
Count
Source
53
215k
  static ASTNodeKind getFromNodeKind() {
54
215k
    return ASTNodeKind(KindToKindId<T>::Id);
55
215k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::TypeLoc>()
Line
Count
Source
53
82.3k
  static ASTNodeKind getFromNodeKind() {
54
82.3k
    return ASTNodeKind(KindToKindId<T>::Id);
55
82.3k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::Expr>()
Line
Count
Source
53
115k
  static ASTNodeKind getFromNodeKind() {
54
115k
    return ASTNodeKind(KindToKindId<T>::Id);
55
115k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::NestedNameSpecifier>()
Line
Count
Source
53
1.41k
  static ASTNodeKind getFromNodeKind() {
54
1.41k
    return ASTNodeKind(KindToKindId<T>::Id);
55
1.41k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::NestedNameSpecifierLoc>()
Line
Count
Source
53
33.5k
  static ASTNodeKind getFromNodeKind() {
54
33.5k
    return ASTNodeKind(KindToKindId<T>::Id);
55
33.5k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::CXXCtorInitializer>()
Line
Count
Source
53
612
  static ASTNodeKind getFromNodeKind() {
54
612
    return ASTNodeKind(KindToKindId<T>::Id);
55
612
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::FunctionDecl>()
Line
Count
Source
53
3.02k
  static ASTNodeKind getFromNodeKind() {
54
3.02k
    return ASTNodeKind(KindToKindId<T>::Id);
55
3.02k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::LambdaExpr>()
Line
Count
Source
53
66
  static ASTNodeKind getFromNodeKind() {
54
66
    return ASTNodeKind(KindToKindId<T>::Id);
55
66
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::NamedDecl>()
Line
Count
Source
53
3.61k
  static ASTNodeKind getFromNodeKind() {
54
3.61k
    return ASTNodeKind(KindToKindId<T>::Id);
55
3.61k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::CXXMemberCallExpr>()
Line
Count
Source
53
178
  static ASTNodeKind getFromNodeKind() {
54
178
    return ASTNodeKind(KindToKindId<T>::Id);
55
178
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::Decl>()
Line
Count
Source
53
201k
  static ASTNodeKind getFromNodeKind() {
54
201k
    return ASTNodeKind(KindToKindId<T>::Id);
55
201k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::IntegerLiteral>()
Line
Count
Source
53
2.70k
  static ASTNodeKind getFromNodeKind() {
54
2.70k
    return ASTNodeKind(KindToKindId<T>::Id);
55
2.70k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::VarDecl>()
Line
Count
Source
53
120k
  static ASTNodeKind getFromNodeKind() {
54
120k
    return ASTNodeKind(KindToKindId<T>::Id);
55
120k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::BinaryOperator>()
Line
Count
Source
53
8.96k
  static ASTNodeKind getFromNodeKind() {
54
8.96k
    return ASTNodeKind(KindToKindId<T>::Id);
55
8.96k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::DeclRefExpr>()
Line
Count
Source
53
68.2k
  static ASTNodeKind getFromNodeKind() {
54
68.2k
    return ASTNodeKind(KindToKindId<T>::Id);
55
68.2k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::BlockPointerType>()
Line
Count
Source
53
562
  static ASTNodeKind getFromNodeKind() {
54
562
    return ASTNodeKind(KindToKindId<T>::Id);
55
562
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::Type>()
Line
Count
Source
53
21.8k
  static ASTNodeKind getFromNodeKind() {
54
21.8k
    return ASTNodeKind(KindToKindId<T>::Id);
55
21.8k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::ObjCMessageExpr>()
Line
Count
Source
53
1.42k
  static ASTNodeKind getFromNodeKind() {
54
1.42k
    return ASTNodeKind(KindToKindId<T>::Id);
55
1.42k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::CompoundStmt>()
Line
Count
Source
53
1.51k
  static ASTNodeKind getFromNodeKind() {
54
1.51k
    return ASTNodeKind(KindToKindId<T>::Id);
55
1.51k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::TemplateArgument>()
Line
Count
Source
53
301
  static ASTNodeKind getFromNodeKind() {
54
301
    return ASTNodeKind(KindToKindId<T>::Id);
55
301
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::InitListExpr>()
Line
Count
Source
53
16.3k
  static ASTNodeKind getFromNodeKind() {
54
16.3k
    return ASTNodeKind(KindToKindId<T>::Id);
55
16.3k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::ForStmt>()
Line
Count
Source
53
1.47k
  static ASTNodeKind getFromNodeKind() {
54
1.47k
    return ASTNodeKind(KindToKindId<T>::Id);
55
1.47k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::DeclStmt>()
Line
Count
Source
53
17.1k
  static ASTNodeKind getFromNodeKind() {
54
17.1k
    return ASTNodeKind(KindToKindId<T>::Id);
55
17.1k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::CXXConstructorDecl>()
Line
Count
Source
53
347
  static ASTNodeKind getFromNodeKind() {
54
347
    return ASTNodeKind(KindToKindId<T>::Id);
55
347
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::CXXConstructExpr>()
Line
Count
Source
53
263
  static ASTNodeKind getFromNodeKind() {
54
263
    return ASTNodeKind(KindToKindId<T>::Id);
55
263
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::CXXMethodDecl>()
Line
Count
Source
53
2.85k
  static ASTNodeKind getFromNodeKind() {
54
2.85k
    return ASTNodeKind(KindToKindId<T>::Id);
55
2.85k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::CXXOperatorCallExpr>()
Line
Count
Source
53
1.20k
  static ASTNodeKind getFromNodeKind() {
54
1.20k
    return ASTNodeKind(KindToKindId<T>::Id);
55
1.20k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::IfStmt>()
Line
Count
Source
53
848
  static ASTNodeKind getFromNodeKind() {
54
848
    return ASTNodeKind(KindToKindId<T>::Id);
55
848
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::UnaryOperator>()
Line
Count
Source
53
67.6k
  static ASTNodeKind getFromNodeKind() {
54
67.6k
    return ASTNodeKind(KindToKindId<T>::Id);
55
67.6k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::ExplicitCastExpr>()
Line
Count
Source
53
873
  static ASTNodeKind getFromNodeKind() {
54
873
    return ASTNodeKind(KindToKindId<T>::Id);
55
873
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::AbstractConditionalOperator>()
Line
Count
Source
53
287
  static ASTNodeKind getFromNodeKind() {
54
287
    return ASTNodeKind(KindToKindId<T>::Id);
55
287
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::SwitchStmt>()
Line
Count
Source
53
433
  static ASTNodeKind getFromNodeKind() {
54
433
    return ASTNodeKind(KindToKindId<T>::Id);
55
433
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::ReturnStmt>()
Line
Count
Source
53
416
  static ASTNodeKind getFromNodeKind() {
54
416
    return ASTNodeKind(KindToKindId<T>::Id);
55
416
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::PointerType>()
Line
Count
Source
53
303
  static ASTNodeKind getFromNodeKind() {
54
303
    return ASTNodeKind(KindToKindId<T>::Id);
55
303
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::ParmVarDecl>()
Line
Count
Source
53
32.7k
  static ASTNodeKind getFromNodeKind() {
54
32.7k
    return ASTNodeKind(KindToKindId<T>::Id);
55
32.7k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::TypedefType>()
Line
Count
Source
53
372
  static ASTNodeKind getFromNodeKind() {
54
372
    return ASTNodeKind(KindToKindId<T>::Id);
55
372
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::TypedefDecl>()
Line
Count
Source
53
467
  static ASTNodeKind getFromNodeKind() {
54
467
    return ASTNodeKind(KindToKindId<T>::Id);
55
467
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::RecordType>()
Line
Count
Source
53
174
  static ASTNodeKind getFromNodeKind() {
54
174
    return ASTNodeKind(KindToKindId<T>::Id);
55
174
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::ObjCObjectPointerType>()
Line
Count
Source
53
335
  static ASTNodeKind getFromNodeKind() {
54
335
    return ASTNodeKind(KindToKindId<T>::Id);
55
335
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::ObjCInterfaceDecl>()
Line
Count
Source
53
144
  static ASTNodeKind getFromNodeKind() {
54
144
    return ASTNodeKind(KindToKindId<T>::Id);
55
144
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::ConditionalOperator>()
Line
Count
Source
53
980
  static ASTNodeKind getFromNodeKind() {
54
980
    return ASTNodeKind(KindToKindId<T>::Id);
55
980
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::ObjCMethodDecl>()
Line
Count
Source
53
503
  static ASTNodeKind getFromNodeKind() {
54
503
    return ASTNodeKind(KindToKindId<T>::Id);
55
503
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::BlockDecl>()
Line
Count
Source
53
469
  static ASTNodeKind getFromNodeKind() {
54
469
    return ASTNodeKind(KindToKindId<T>::Id);
55
469
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::GotoStmt>()
Line
Count
Source
53
373
  static ASTNodeKind getFromNodeKind() {
54
373
    return ASTNodeKind(KindToKindId<T>::Id);
55
373
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::ReferenceType>()
Line
Count
Source
53
32.3k
  static ASTNodeKind getFromNodeKind() {
54
32.3k
    return ASTNodeKind(KindToKindId<T>::Id);
55
32.3k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::TranslationUnitDecl>()
Line
Count
Source
53
753
  static ASTNodeKind getFromNodeKind() {
54
753
    return ASTNodeKind(KindToKindId<T>::Id);
55
753
  }
56
57
  /// \{
58
  /// Construct an identifier for the dynamic type of the node
59
  static ASTNodeKind getFromNode(const Decl &D);
60
  static ASTNodeKind getFromNode(const Stmt &S);
61
  static ASTNodeKind getFromNode(const Type &T);
62
  /// \}
63
64
  /// Returns \c true if \c this and \c Other represent the same kind.
65
244k
  bool isSame(ASTNodeKind Other) const {
66
244k
    return KindId != NKI_None && 
KindId == Other.KindId244k
;
67
244k
  }
68
69
  /// Returns \c true only for the default \c ASTNodeKind()
70
  bool isNone() const { return KindId == NKI_None; }
71
72
  /// Returns \c true if \c this is a base kind of (or same as) \c Other.
73
  /// \param Distance If non-null, used to return the distance between \c this
74
  /// and \c Other in the class hierarchy.
75
  bool isBaseOf(ASTNodeKind Other, unsigned *Distance = nullptr) const;
76
77
  /// String representation of the kind.
78
  StringRef asStringRef() const;
79
80
  /// Strict weak ordering for ASTNodeKind.
81
123k
  bool operator<(const ASTNodeKind &Other) const {
82
123k
    return KindId < Other.KindId;
83
123k
  }
84
85
  /// Return the most derived type between \p Kind1 and \p Kind2.
86
  ///
87
  /// Return ASTNodeKind() if they are not related.
88
  static ASTNodeKind getMostDerivedType(ASTNodeKind Kind1, ASTNodeKind Kind2);
89
90
  /// Return the most derived common ancestor between Kind1 and Kind2.
91
  ///
92
  /// Return ASTNodeKind() if they are not related.
93
  static ASTNodeKind getMostDerivedCommonAncestor(ASTNodeKind Kind1,
94
                                                  ASTNodeKind Kind2);
95
96
  /// Hooks for using ASTNodeKind as a key in a DenseMap.
97
  struct DenseMapInfo {
98
    // ASTNodeKind() is a good empty key because it is represented as a 0.
99
331k
    static inline ASTNodeKind getEmptyKey() { return ASTNodeKind(); }
100
    // NKI_NumberOfKinds is not a valid value, so it is good for a
101
    // tombstone key.
102
264k
    static inline ASTNodeKind getTombstoneKey() {
103
264k
      return ASTNodeKind(NKI_NumberOfKinds);
104
264k
    }
105
71.1k
    static unsigned getHashValue(const ASTNodeKind &Val) { return Val.KindId; }
106
1.78M
    static bool isEqual(const ASTNodeKind &LHS, const ASTNodeKind &RHS) {
107
1.78M
      return LHS.KindId == RHS.KindId;
108
1.78M
    }
109
  };
110
111
  /// Check if the given ASTNodeKind identifies a type that offers pointer
112
  /// identity. This is useful for the fast path in DynTypedNode.
113
48.8k
  bool hasPointerIdentity() const {
114
48.8k
    return KindId > NKI_LastKindWithoutPointerIdentity;
115
48.8k
  }
116
117
private:
118
  /// Kind ids.
119
  ///
120
  /// Includes all possible base and derived kinds.
121
  enum NodeKindId {
122
    NKI_None,
123
    NKI_TemplateArgument,
124
    NKI_TemplateName,
125
    NKI_NestedNameSpecifierLoc,
126
    NKI_QualType,
127
    NKI_TypeLoc,
128
    NKI_LastKindWithoutPointerIdentity = NKI_TypeLoc,
129
    NKI_CXXCtorInitializer,
130
    NKI_NestedNameSpecifier,
131
    NKI_Decl,
132
#define DECL(DERIVED, BASE) NKI_##DERIVED##Decl,
133
#include "clang/AST/DeclNodes.inc"
134
    NKI_Stmt,
135
#define STMT(DERIVED, BASE) NKI_##DERIVED,
136
#include "clang/AST/StmtNodes.inc"
137
    NKI_Type,
138
#define TYPE(DERIVED, BASE) NKI_##DERIVED##Type,
139
#include "clang/AST/TypeNodes.def"
140
    NKI_NumberOfKinds
141
  };
142
143
  /// Use getFromNodeKind<T>() to construct the kind.
144
1.63M
  ASTNodeKind(NodeKindId KindId) : KindId(KindId) {}
145
146
  /// Returns \c true if \c Base is a base kind of (or same as) \c
147
  ///   Derived.
148
  /// \param Distance If non-null, used to return the distance between \c Base
149
  /// and \c Derived in the class hierarchy.
150
  static bool isBaseOf(NodeKindId Base, NodeKindId Derived, unsigned *Distance);
151
152
  /// Helper meta-function to convert a kind T to its enum value.
153
  ///
154
  /// This struct is specialized below for all known kinds.
155
  template <class T> struct KindToKindId {
156
    static const NodeKindId Id = NKI_None;
157
  };
158
  template <class T>
159
  struct KindToKindId<const T> : KindToKindId<T> {};
160
161
  /// Per kind info.
162
  struct KindInfo {
163
    /// The id of the parent kind, or None if it has no parent.
164
    NodeKindId ParentId;
165
    /// Name of the kind.
166
    const char *Name;
167
  };
168
  static const KindInfo AllKindInfo[NKI_NumberOfKinds];
169
170
  NodeKindId KindId;
171
};
172
173
#define KIND_TO_KIND_ID(Class)                                                 \
174
  template <> struct ASTNodeKind::KindToKindId<Class> {                        \
175
    static const NodeKindId Id = NKI_##Class;                                  \
176
  };
177
KIND_TO_KIND_ID(CXXCtorInitializer)
178
KIND_TO_KIND_ID(TemplateArgument)
179
KIND_TO_KIND_ID(TemplateName)
180
KIND_TO_KIND_ID(NestedNameSpecifier)
181
KIND_TO_KIND_ID(NestedNameSpecifierLoc)
182
KIND_TO_KIND_ID(QualType)
183
KIND_TO_KIND_ID(TypeLoc)
184
KIND_TO_KIND_ID(Decl)
185
KIND_TO_KIND_ID(Stmt)
186
KIND_TO_KIND_ID(Type)
187
#define DECL(DERIVED, BASE) KIND_TO_KIND_ID(DERIVED##Decl)
188
#include "clang/AST/DeclNodes.inc"
189
#define STMT(DERIVED, BASE) KIND_TO_KIND_ID(DERIVED)
190
#include "clang/AST/StmtNodes.inc"
191
#define TYPE(DERIVED, BASE) KIND_TO_KIND_ID(DERIVED##Type)
192
#include "clang/AST/TypeNodes.def"
193
#undef KIND_TO_KIND_ID
194
195
inline raw_ostream &operator<<(raw_ostream &OS, ASTNodeKind K) {
196
  OS << K.asStringRef();
197
  return OS;
198
}
199
200
/// A dynamically typed AST node container.
201
///
202
/// Stores an AST node in a type safe way. This allows writing code that
203
/// works with different kinds of AST nodes, despite the fact that they don't
204
/// have a common base class.
205
///
206
/// Use \c create(Node) to create a \c DynTypedNode from an AST node,
207
/// and \c get<T>() to retrieve the node as type T if the types match.
208
///
209
/// See \c ASTNodeKind for which node base types are currently supported;
210
/// You can create DynTypedNodes for all nodes in the inheritance hierarchy of
211
/// the supported base types.
212
0
class DynTypedNode {
213
public:
214
  /// Creates a \c DynTypedNode from \c Node.
215
  template <typename T>
216
186k
  static DynTypedNode create(const T &Node) {
217
186k
    return BaseConverter<T>::create(Node);
218
186k
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::Expr>(clang::Expr const&)
Line
Count
Source
216
5.23k
  static DynTypedNode create(const T &Node) {
217
5.23k
    return BaseConverter<T>::create(Node);
218
5.23k
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::ClassTemplateDecl>(clang::ClassTemplateDecl const&)
Line
Count
Source
216
94
  static DynTypedNode create(const T &Node) {
217
94
    return BaseConverter<T>::create(Node);
218
94
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::QualType>(clang::QualType const&)
Line
Count
Source
216
10.8k
  static DynTypedNode create(const T &Node) {
217
10.8k
    return BaseConverter<T>::create(Node);
218
10.8k
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::TemplateName>(clang::TemplateName const&)
Line
Count
Source
216
2
  static DynTypedNode create(const T &Node) {
217
2
    return BaseConverter<T>::create(Node);
218
2
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::Decl>(clang::Decl const&)
Line
Count
Source
216
54.0k
  static DynTypedNode create(const T &Node) {
217
54.0k
    return BaseConverter<T>::create(Node);
218
54.0k
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::Stmt>(clang::Stmt const&)
Line
Count
Source
216
68.8k
  static DynTypedNode create(const T &Node) {
217
68.8k
    return BaseConverter<T>::create(Node);
218
68.8k
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::VarDecl>(clang::VarDecl const&)
Line
Count
Source
216
478
  static DynTypedNode create(const T &Node) {
217
478
    return BaseConverter<T>::create(Node);
218
478
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::CXXRecordDecl>(clang::CXXRecordDecl const&)
Line
Count
Source
216
650
  static DynTypedNode create(const T &Node) {
217
650
    return BaseConverter<T>::create(Node);
218
650
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::NamedDecl>(clang::NamedDecl const&)
Line
Count
Source
216
308
  static DynTypedNode create(const T &Node) {
217
308
    return BaseConverter<T>::create(Node);
218
308
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::TypeLoc>(clang::TypeLoc const&)
Line
Count
Source
216
26.9k
  static DynTypedNode create(const T &Node) {
217
26.9k
    return BaseConverter<T>::create(Node);
218
26.9k
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::Type>(clang::Type const&)
Line
Count
Source
216
8.11k
  static DynTypedNode create(const T &Node) {
217
8.11k
    return BaseConverter<T>::create(Node);
218
8.11k
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::CXXMemberCallExpr>(clang::CXXMemberCallExpr const&)
Line
Count
Source
216
18
  static DynTypedNode create(const T &Node) {
217
18
    return BaseConverter<T>::create(Node);
218
18
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::UsingShadowDecl>(clang::UsingShadowDecl const&)
Line
Count
Source
216
12
  static DynTypedNode create(const T &Node) {
217
12
    return BaseConverter<T>::create(Node);
218
12
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::FieldDecl>(clang::FieldDecl const&)
Line
Count
Source
216
50
  static DynTypedNode create(const T &Node) {
217
50
    return BaseConverter<T>::create(Node);
218
50
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::DeclStmt>(clang::DeclStmt const&)
Line
Count
Source
216
85
  static DynTypedNode create(const T &Node) {
217
85
    return BaseConverter<T>::create(Node);
218
85
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::CXXMethodDecl>(clang::CXXMethodDecl const&)
Line
Count
Source
216
104
  static DynTypedNode create(const T &Node) {
217
104
    return BaseConverter<T>::create(Node);
218
104
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::ValueDecl>(clang::ValueDecl const&)
Line
Count
Source
216
18
  static DynTypedNode create(const T &Node) {
217
18
    return BaseConverter<T>::create(Node);
218
18
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::NestedNameSpecifier>(clang::NestedNameSpecifier const&)
Line
Count
Source
216
154
  static DynTypedNode create(const T &Node) {
217
154
    return BaseConverter<T>::create(Node);
218
154
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::NestedNameSpecifierLoc>(clang::NestedNameSpecifierLoc const&)
Line
Count
Source
216
8.99k
  static DynTypedNode create(const T &Node) {
217
8.99k
    return BaseConverter<T>::create(Node);
218
8.99k
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::NamespaceDecl>(clang::NamespaceDecl const&)
Line
Count
Source
216
36
  static DynTypedNode create(const T &Node) {
217
36
    return BaseConverter<T>::create(Node);
218
36
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::SwitchCase>(clang::SwitchCase const&)
Line
Count
Source
216
23
  static DynTypedNode create(const T &Node) {
217
23
    return BaseConverter<T>::create(Node);
218
23
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::CXXCtorInitializer>(clang::CXXCtorInitializer const&)
Line
Count
Source
216
81
  static DynTypedNode create(const T &Node) {
217
81
    return BaseConverter<T>::create(Node);
218
81
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::FunctionDecl>(clang::FunctionDecl const&)
Line
Count
Source
216
351
  static DynTypedNode create(const T &Node) {
217
351
    return BaseConverter<T>::create(Node);
218
351
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::CompoundStmt>(clang::CompoundStmt const&)
Line
Count
Source
216
419
  static DynTypedNode create(const T &Node) {
217
419
    return BaseConverter<T>::create(Node);
218
419
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::UnaryOperator>(clang::UnaryOperator const&)
Line
Count
Source
216
14
  static DynTypedNode create(const T &Node) {
217
14
    return BaseConverter<T>::create(Node);
218
14
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::ExplicitCastExpr>(clang::ExplicitCastExpr const&)
Line
Count
Source
216
110
  static DynTypedNode create(const T &Node) {
217
110
    return BaseConverter<T>::create(Node);
218
110
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::ParmVarDecl>(clang::ParmVarDecl const&)
Line
Count
Source
216
185
  static DynTypedNode create(const T &Node) {
217
185
    return BaseConverter<T>::create(Node);
218
185
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::ObjCMethodDecl>(clang::ObjCMethodDecl const&)
Line
Count
Source
216
6
  static DynTypedNode create(const T &Node) {
217
6
    return BaseConverter<T>::create(Node);
218
6
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::BlockDecl>(clang::BlockDecl const&)
Line
Count
Source
216
1
  static DynTypedNode create(const T &Node) {
217
1
    return BaseConverter<T>::create(Node);
218
1
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::InitListExpr>(clang::InitListExpr const&)
Line
Count
Source
216
135
  static DynTypedNode create(const T &Node) {
217
135
    return BaseConverter<T>::create(Node);
218
135
  }
219
220
  /// Retrieve the stored node as type \c T.
221
  ///
222
  /// Returns NULL if the stored node does not have a type that is
223
  /// convertible to \c T.
224
  ///
225
  /// For types that have identity via their pointer in the AST
226
  /// (like \c Stmt, \c Decl, \c Type and \c NestedNameSpecifier) the returned
227
  /// pointer points to the referenced AST node.
228
  /// For other types (like \c QualType) the value is stored directly
229
  /// in the \c DynTypedNode, and the returned pointer points at
230
  /// the storage inside DynTypedNode. For those nodes, do not
231
  /// use the pointer outside the scope of the DynTypedNode.
232
  template <typename T>
233
93.9k
  const T *get() const {
234
93.9k
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
93.9k
  }
clang::FunctionDecl const* clang::ast_type_traits::DynTypedNode::get<clang::FunctionDecl>() const
Line
Count
Source
233
594
  const T *get() const {
234
594
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
594
  }
clang::LambdaExpr const* clang::ast_type_traits::DynTypedNode::get<clang::LambdaExpr>() const
Line
Count
Source
233
22
  const T *get() const {
234
22
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
22
  }
clang::CallExpr const* clang::ast_type_traits::DynTypedNode::get<clang::CallExpr>() const
Line
Count
Source
233
28
  const T *get() const {
234
28
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
28
  }
clang::Stmt const* clang::ast_type_traits::DynTypedNode::get<clang::Stmt>() const
Line
Count
Source
233
31.1k
  const T *get() const {
234
31.1k
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
31.1k
  }
clang::Expr const* clang::ast_type_traits::DynTypedNode::get<clang::Expr>() const
Line
Count
Source
233
219
  const T *get() const {
234
219
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
219
  }
clang::Decl const* clang::ast_type_traits::DynTypedNode::get<clang::Decl>() const
Line
Count
Source
233
49.5k
  const T *get() const {
234
49.5k
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
49.5k
  }
clang::QualType const* clang::ast_type_traits::DynTypedNode::get<clang::QualType>() const
Line
Count
Source
233
196
  const T *get() const {
234
196
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
196
  }
clang::ParmVarDecl const* clang::ast_type_traits::DynTypedNode::get<clang::ParmVarDecl>() const
Line
Count
Source
233
60
  const T *get() const {
234
60
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
60
  }
clang::ObjCMethodDecl const* clang::ast_type_traits::DynTypedNode::get<clang::ObjCMethodDecl>() const
Line
Count
Source
233
5
  const T *get() const {
234
5
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
5
  }
clang::VarDecl const* clang::ast_type_traits::DynTypedNode::get<clang::VarDecl>() const
Line
Count
Source
233
208
  const T *get() const {
234
208
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
208
  }
clang::IntegerLiteral const* clang::ast_type_traits::DynTypedNode::get<clang::IntegerLiteral>() const
Line
Count
Source
233
240
  const T *get() const {
234
240
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
240
  }
clang::BinaryOperator const* clang::ast_type_traits::DynTypedNode::get<clang::BinaryOperator>() const
Line
Count
Source
233
112
  const T *get() const {
234
112
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
112
  }
clang::NestedNameSpecifier const* clang::ast_type_traits::DynTypedNode::get<clang::NestedNameSpecifier>() const
Line
Count
Source
233
175
  const T *get() const {
234
175
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
175
  }
clang::NestedNameSpecifierLoc const* clang::ast_type_traits::DynTypedNode::get<clang::NestedNameSpecifierLoc>() const
Line
Count
Source
233
5.44k
  const T *get() const {
234
5.44k
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
5.44k
  }
clang::TypeLoc const* clang::ast_type_traits::DynTypedNode::get<clang::TypeLoc>() const
Line
Count
Source
233
5.35k
  const T *get() const {
234
5.35k
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
5.35k
  }
clang::CXXCtorInitializer const* clang::ast_type_traits::DynTypedNode::get<clang::CXXCtorInitializer>() const
Line
Count
Source
233
176
  const T *get() const {
234
176
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
176
  }
clang::TranslationUnitDecl const* clang::ast_type_traits::DynTypedNode::get<clang::TranslationUnitDecl>() const
Line
Count
Source
233
413
  const T *get() const {
234
413
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
413
  }
clang::Type const* clang::ast_type_traits::DynTypedNode::get<clang::Type>() const
Line
Count
Source
233
16
  const T *get() const {
234
16
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
16
  }
clang::TemplateArgument const* clang::ast_type_traits::DynTypedNode::get<clang::TemplateArgument>() const
Line
Count
Source
233
2
  const T *get() const {
234
2
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
2
  }
clang::TemplateName const* clang::ast_type_traits::DynTypedNode::get<clang::TemplateName>() const
Line
Count
Source
233
2
  const T *get() const {
234
2
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
2
  }
236
237
  /// Retrieve the stored node as type \c T.
238
  ///
239
  /// Similar to \c get(), but asserts that the type is what we are expecting.
240
  template <typename T>
241
86.3k
  const T &getUnchecked() const {
242
86.3k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
86.3k
  }
clang::CallExpr const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::CallExpr>() const
Line
Count
Source
241
2.08k
  const T &getUnchecked() const {
242
2.08k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
2.08k
  }
clang::QualType const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::QualType>() const
Line
Count
Source
241
8.25k
  const T &getUnchecked() const {
242
8.25k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
8.25k
  }
clang::Expr const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::Expr>() const
Line
Count
Source
241
4.50k
  const T &getUnchecked() const {
242
4.50k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
4.50k
  }
clang::CXXRecordDecl const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::CXXRecordDecl>() const
Line
Count
Source
241
933
  const T &getUnchecked() const {
242
933
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
933
  }
clang::CXXMemberCallExpr const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::CXXMemberCallExpr>() const
Line
Count
Source
241
69
  const T &getUnchecked() const {
242
69
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
69
  }
clang::IntegerLiteral const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::IntegerLiteral>() const
Line
Count
Source
241
326
  const T &getUnchecked() const {
242
326
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
326
  }
clang::VarDecl const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::VarDecl>() const
Line
Count
Source
241
1.78k
  const T &getUnchecked() const {
242
1.78k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
1.78k
  }
clang::BinaryOperator const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::BinaryOperator>() const
Line
Count
Source
241
2.43k
  const T &getUnchecked() const {
242
2.43k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
2.43k
  }
clang::DeclRefExpr const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::DeclRefExpr>() const
Line
Count
Source
241
655
  const T &getUnchecked() const {
242
655
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
655
  }
clang::TypeLoc const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::TypeLoc>() const
Line
Count
Source
241
45.1k
  const T &getUnchecked() const {
242
45.1k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
45.1k
  }
clang::NestedNameSpecifierLoc const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::NestedNameSpecifierLoc>() const
Line
Count
Source
241
1.10k
  const T &getUnchecked() const {
242
1.10k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
1.10k
  }
clang::Stmt const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::Stmt>() const
Line
Count
Source
241
1.78k
  const T &getUnchecked() const {
242
1.78k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
1.78k
  }
clang::ObjCMessageExpr const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::ObjCMessageExpr>() const
Line
Count
Source
241
148
  const T &getUnchecked() const {
242
148
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
148
  }
clang::CompoundStmt const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::CompoundStmt>() const
Line
Count
Source
241
467
  const T &getUnchecked() const {
242
467
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
467
  }
clang::Decl const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::Decl>() const
Line
Count
Source
241
717
  const T &getUnchecked() const {
242
717
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
717
  }
clang::InitListExpr const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::InitListExpr>() const
Line
Count
Source
241
180
  const T &getUnchecked() const {
242
180
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
180
  }
clang::ForStmt const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::ForStmt>() const
Line
Count
Source
241
624
  const T &getUnchecked() const {
242
624
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
624
  }
clang::NamedDecl const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::NamedDecl>() const
Line
Count
Source
241
9.10k
  const T &getUnchecked() const {
242
9.10k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
9.10k
  }
clang::Type const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::Type>() const
Line
Count
Source
241
477
  const T &getUnchecked() const {
242
477
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
477
  }
clang::DeclStmt const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::DeclStmt>() const
Line
Count
Source
241
301
  const T &getUnchecked() const {
242
301
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
301
  }
clang::CXXConstructorDecl const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::CXXConstructorDecl>() const
Line
Count
Source
241
184
  const T &getUnchecked() const {
242
184
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
184
  }
clang::CXXConstructExpr const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::CXXConstructExpr>() const
Line
Count
Source
241
71
  const T &getUnchecked() const {
242
71
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
71
  }
clang::FunctionDecl const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::FunctionDecl>() const
Line
Count
Source
241
1.08k
  const T &getUnchecked() const {
242
1.08k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
1.08k
  }
clang::IfStmt const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::IfStmt>() const
Line
Count
Source
241
159
  const T &getUnchecked() const {
242
159
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
159
  }
clang::UnaryOperator const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::UnaryOperator>() const
Line
Count
Source
241
2.54k
  const T &getUnchecked() const {
242
2.54k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
2.54k
  }
clang::ExplicitCastExpr const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::ExplicitCastExpr>() const
Line
Count
Source
241
314
  const T &getUnchecked() const {
242
314
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
314
  }
clang::AbstractConditionalOperator const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::AbstractConditionalOperator>() const
Line
Count
Source
241
63
  const T &getUnchecked() const {
242
63
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
63
  }
clang::ParmVarDecl const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::ParmVarDecl>() const
Line
Count
Source
241
159
  const T &getUnchecked() const {
242
159
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
159
  }
clang::TypedefType const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::TypedefType>() const
Line
Count
Source
241
286
  const T &getUnchecked() const {
242
286
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
286
  }
clang::RecordType const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::RecordType>() const
Line
Count
Source
241
54
  const T &getUnchecked() const {
242
54
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
54
  }
clang::PointerType const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::PointerType>() const
Line
Count
Source
241
154
  const T &getUnchecked() const {
242
154
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
154
  }
clang::ObjCObjectPointerType const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::ObjCObjectPointerType>() const
Line
Count
Source
241
120
  const T &getUnchecked() const {
242
120
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
120
  }
clang::ConditionalOperator const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::ConditionalOperator>() const
Line
Count
Source
241
25
  const T &getUnchecked() const {
242
25
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
25
  }
clang::ObjCMethodDecl const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::ObjCMethodDecl>() const
Line
Count
Source
241
42
  const T &getUnchecked() const {
242
42
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
42
  }
clang::BlockDecl const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::BlockDecl>() const
Line
Count
Source
241
27
  const T &getUnchecked() const {
242
27
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
27
  }
244
245
230k
  ASTNodeKind getNodeKind() const { return NodeKind; }
246
247
  /// Returns a pointer that identifies the stored AST node.
248
  ///
249
  /// Note that this is not supported by all AST nodes. For AST nodes
250
  /// that don't have a pointer-defined identity inside the AST, this
251
  /// method returns NULL.
252
41.7k
  const void *getMemoizationData() const {
253
41.7k
    return NodeKind.hasPointerIdentity()
254
41.7k
               ? 
*reinterpret_cast<void *const *>(Storage.buffer)41.5k
255
41.7k
               : 
nullptr227
;
256
41.7k
  }
257
258
  /// Prints the node to the given output stream.
259
  void print(llvm::raw_ostream &OS, const PrintingPolicy &PP) const;
260
261
  /// Dumps the node to the given output stream.
262
  void dump(llvm::raw_ostream &OS, SourceManager &SM) const;
263
264
  /// For nodes which represent textual entities in the source code,
265
  /// return their SourceRange.  For all other nodes, return SourceRange().
266
  SourceRange getSourceRange() const;
267
268
  /// @{
269
  /// Imposes an order on \c DynTypedNode.
270
  ///
271
  /// Supports comparison of nodes that support memoization.
272
  /// FIXME: Implement comparison for other node types (currently
273
  /// only Stmt, Decl, Type and NestedNameSpecifier return memoization data).
274
31.4k
  bool operator<(const DynTypedNode &Other) const {
275
31.4k
    if (!NodeKind.isSame(Other.NodeKind))
276
14.8k
      return NodeKind < Other.NodeKind;
277
16.6k
278
16.6k
    if (ASTNodeKind::getFromNodeKind<QualType>().isSame(NodeKind))
279
1
      return getUnchecked<QualType>().getAsOpaquePtr() <
280
1
             Other.getUnchecked<QualType>().getAsOpaquePtr();
281
16.6k
282
16.6k
    if (ASTNodeKind::getFromNodeKind<TypeLoc>().isSame(NodeKind)) {
283
123
      auto TLA = getUnchecked<TypeLoc>();
284
123
      auto TLB = Other.getUnchecked<TypeLoc>();
285
123
      return std::make_pair(TLA.getType().getAsOpaquePtr(),
286
123
                            TLA.getOpaqueData()) <
287
123
             std::make_pair(TLB.getType().getAsOpaquePtr(),
288
123
                            TLB.getOpaqueData());
289
123
    }
290
16.5k
291
16.5k
    if (ASTNodeKind::getFromNodeKind<NestedNameSpecifierLoc>().isSame(
292
16.5k
            NodeKind)) {
293
0
      auto NNSLA = getUnchecked<NestedNameSpecifierLoc>();
294
0
      auto NNSLB = Other.getUnchecked<NestedNameSpecifierLoc>();
295
0
      return std::make_pair(NNSLA.getNestedNameSpecifier(),
296
0
                            NNSLA.getOpaqueData()) <
297
0
             std::make_pair(NNSLB.getNestedNameSpecifier(),
298
0
                            NNSLB.getOpaqueData());
299
0
    }
300
16.5k
301
16.5k
    assert(getMemoizationData() && Other.getMemoizationData());
302
16.5k
    return getMemoizationData() < Other.getMemoizationData();
303
16.5k
  }
304
87.9k
  bool operator==(const DynTypedNode &Other) const {
305
87.9k
    // DynTypedNode::create() stores the exact kind of the node in NodeKind.
306
87.9k
    // If they contain the same node, their NodeKind must be the same.
307
87.9k
    if (!NodeKind.isSame(Other.NodeKind))
308
73.1k
      return false;
309
14.7k
310
14.7k
    // FIXME: Implement for other types.
311
14.7k
    if (ASTNodeKind::getFromNodeKind<QualType>().isSame(NodeKind))
312
11
      return getUnchecked<QualType>() == Other.getUnchecked<QualType>();
313
14.7k
314
14.7k
    if (ASTNodeKind::getFromNodeKind<TypeLoc>().isSame(NodeKind))
315
14.0k
      return getUnchecked<TypeLoc>() == Other.getUnchecked<TypeLoc>();
316
677
317
677
    if (ASTNodeKind::getFromNodeKind<NestedNameSpecifierLoc>().isSame(NodeKind))
318
130
      return getUnchecked<NestedNameSpecifierLoc>() ==
319
130
             Other.getUnchecked<NestedNameSpecifierLoc>();
320
547
321
547
    assert(getMemoizationData() && Other.getMemoizationData());
322
547
    return getMemoizationData() == Other.getMemoizationData();
323
547
  }
324
497
  bool operator!=(const DynTypedNode &Other) const {
325
497
    return !operator==(Other);
326
497
  }
327
  /// @}
328
329
  /// Hooks for using DynTypedNode as a key in a DenseMap.
330
  struct DenseMapInfo {
331
37.8k
    static inline DynTypedNode getEmptyKey() {
332
37.8k
      DynTypedNode Node;
333
37.8k
      Node.NodeKind = ASTNodeKind::DenseMapInfo::getEmptyKey();
334
37.8k
      return Node;
335
37.8k
    }
336
27.7k
    static inline DynTypedNode getTombstoneKey() {
337
27.7k
      DynTypedNode Node;
338
27.7k
      Node.NodeKind = ASTNodeKind::DenseMapInfo::getTombstoneKey();
339
27.7k
      return Node;
340
27.7k
    }
341
17.3k
    static unsigned getHashValue(const DynTypedNode &Val) {
342
17.3k
      // FIXME: Add hashing support for the remaining types.
343
17.3k
      if (ASTNodeKind::getFromNodeKind<TypeLoc>().isSame(Val.NodeKind)) {
344
16.5k
        auto TL = Val.getUnchecked<TypeLoc>();
345
16.5k
        return llvm::hash_combine(TL.getType().getAsOpaquePtr(),
346
16.5k
                                  TL.getOpaqueData());
347
16.5k
      }
348
782
349
782
      if (ASTNodeKind::getFromNodeKind<NestedNameSpecifierLoc>().isSame(
350
782
              Val.NodeKind)) {
351
782
        auto NNSL = Val.getUnchecked<NestedNameSpecifierLoc>();
352
782
        return llvm::hash_combine(NNSL.getNestedNameSpecifier(),
353
782
                                  NNSL.getOpaqueData());
354
782
      }
355
0
356
0
      assert(Val.getMemoizationData());
357
0
      return llvm::hash_value(Val.getMemoizationData());
358
0
    }
359
145k
    static bool isEqual(const DynTypedNode &LHS, const DynTypedNode &RHS) {
360
145k
      auto Empty = ASTNodeKind::DenseMapInfo::getEmptyKey();
361
145k
      auto TombStone = ASTNodeKind::DenseMapInfo::getTombstoneKey();
362
145k
      return (ASTNodeKind::DenseMapInfo::isEqual(LHS.NodeKind, Empty) &&
363
145k
              
ASTNodeKind::DenseMapInfo::isEqual(RHS.NodeKind, Empty)58.5k
) ||
364
145k
             
(87.3k
ASTNodeKind::DenseMapInfo::isEqual(LHS.NodeKind, TombStone)87.3k
&&
365
87.3k
              
ASTNodeKind::DenseMapInfo::isEqual(RHS.NodeKind, TombStone)0
) ||
366
145k
             
LHS == RHS87.3k
;
367
145k
    }
368
  };
369
370
private:
371
  /// Takes care of converting from and to \c T.
372
  template <typename T, typename EnablerT = void> struct BaseConverter;
373
374
  /// Converter that uses dyn_cast<T> from a stored BaseT*.
375
  template <typename T, typename BaseT> struct DynCastPtrConverter {
376
82.5k
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
82.5k
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
50.1k
        return &getUnchecked(NodeKind, Storage);
379
32.3k
      return nullptr;
380
32.3k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::FunctionDecl, clang::Decl>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
376
594
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
594
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
564
        return &getUnchecked(NodeKind, Storage);
379
30
      return nullptr;
380
30
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::LambdaExpr, clang::Stmt>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
376
22
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
22
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
6
        return &getUnchecked(NodeKind, Storage);
379
16
      return nullptr;
380
16
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::CallExpr, clang::Stmt>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
376
28
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
28
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
28
        return &getUnchecked(NodeKind, Storage);
379
0
      return nullptr;
380
0
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::Stmt, clang::Stmt>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
376
31.1k
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
31.1k
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
25.7k
        return &getUnchecked(NodeKind, Storage);
379
5.37k
      return nullptr;
380
5.37k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::Expr, clang::Stmt>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
376
219
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
219
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
219
        return &getUnchecked(NodeKind, Storage);
379
0
      return nullptr;
380
0
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::Decl, clang::Decl>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
376
49.5k
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
49.5k
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
22.9k
        return &getUnchecked(NodeKind, Storage);
379
26.5k
      return nullptr;
380
26.5k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::ParmVarDecl, clang::Decl>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
376
60
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
60
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
60
        return &getUnchecked(NodeKind, Storage);
379
0
      return nullptr;
380
0
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::ObjCMethodDecl, clang::Decl>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
376
5
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
5
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
5
        return &getUnchecked(NodeKind, Storage);
379
0
      return nullptr;
380
0
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::VarDecl, clang::Decl>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
376
208
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
208
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
208
        return &getUnchecked(NodeKind, Storage);
379
0
      return nullptr;
380
0
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::IntegerLiteral, clang::Stmt>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
376
240
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
240
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
240
        return &getUnchecked(NodeKind, Storage);
379
0
      return nullptr;
380
0
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::BinaryOperator, clang::Stmt>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
376
112
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
112
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
112
        return &getUnchecked(NodeKind, Storage);
379
0
      return nullptr;
380
0
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::TranslationUnitDecl, clang::Decl>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
376
413
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
413
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
36
        return &getUnchecked(NodeKind, Storage);
379
377
      return nullptr;
380
377
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::Type, clang::Type>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
376
16
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
16
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
16
        return &getUnchecked(NodeKind, Storage);
379
0
      return nullptr;
380
0
    }
381
82.8k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
82.8k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
82.8k
      return *cast<T>(static_cast<const BaseT *>(
384
82.8k
          *reinterpret_cast<const void *const *>(Storage)));
385
82.8k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::CallExpr, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
2.10k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
2.10k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
2.10k
      return *cast<T>(static_cast<const BaseT *>(
384
2.10k
          *reinterpret_cast<const void *const *>(Storage)));
385
2.10k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::Expr, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
4.72k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
4.72k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
4.72k
      return *cast<T>(static_cast<const BaseT *>(
384
4.72k
          *reinterpret_cast<const void *const *>(Storage)));
385
4.72k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::FunctionDecl, clang::Decl>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
1.64k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
1.64k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
1.64k
      return *cast<T>(static_cast<const BaseT *>(
384
1.64k
          *reinterpret_cast<const void *const *>(Storage)));
385
1.64k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::LambdaExpr, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
6
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
6
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
6
      return *cast<T>(static_cast<const BaseT *>(
384
6
          *reinterpret_cast<const void *const *>(Storage)));
385
6
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::CXXRecordDecl, clang::Decl>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
1.03k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
1.03k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
1.03k
      return *cast<T>(static_cast<const BaseT *>(
384
1.03k
          *reinterpret_cast<const void *const *>(Storage)));
385
1.03k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::CXXMemberCallExpr, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
75
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
75
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
75
      return *cast<T>(static_cast<const BaseT *>(
384
75
          *reinterpret_cast<const void *const *>(Storage)));
385
75
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::IntegerLiteral, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
566
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
566
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
566
      return *cast<T>(static_cast<const BaseT *>(
384
566
          *reinterpret_cast<const void *const *>(Storage)));
385
566
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::VarDecl, clang::Decl>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
1.99k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
1.99k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
1.99k
      return *cast<T>(static_cast<const BaseT *>(
384
1.99k
          *reinterpret_cast<const void *const *>(Storage)));
385
1.99k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::BinaryOperator, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
2.55k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
2.55k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
2.55k
      return *cast<T>(static_cast<const BaseT *>(
384
2.55k
          *reinterpret_cast<const void *const *>(Storage)));
385
2.55k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::DeclRefExpr, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
689
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
689
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
689
      return *cast<T>(static_cast<const BaseT *>(
384
689
          *reinterpret_cast<const void *const *>(Storage)));
385
689
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::Stmt, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
27.5k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
27.5k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
27.5k
      return *cast<T>(static_cast<const BaseT *>(
384
27.5k
          *reinterpret_cast<const void *const *>(Storage)));
385
27.5k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::ObjCMessageExpr, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
148
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
148
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
148
      return *cast<T>(static_cast<const BaseT *>(
384
148
          *reinterpret_cast<const void *const *>(Storage)));
385
148
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::CompoundStmt, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
498
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
498
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
498
      return *cast<T>(static_cast<const BaseT *>(
384
498
          *reinterpret_cast<const void *const *>(Storage)));
385
498
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::TypedefType, clang::Type>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
286
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
286
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
286
      return *cast<T>(static_cast<const BaseT *>(
384
286
          *reinterpret_cast<const void *const *>(Storage)));
385
286
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::RecordType, clang::Type>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
54
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
54
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
54
      return *cast<T>(static_cast<const BaseT *>(
384
54
          *reinterpret_cast<const void *const *>(Storage)));
385
54
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::PointerType, clang::Type>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
155
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
155
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
155
      return *cast<T>(static_cast<const BaseT *>(
384
155
          *reinterpret_cast<const void *const *>(Storage)));
385
155
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::ObjCObjectPointerType, clang::Type>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
120
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
120
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
120
      return *cast<T>(static_cast<const BaseT *>(
384
120
          *reinterpret_cast<const void *const *>(Storage)));
385
120
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::Type, clang::Type>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
493
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
493
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
493
      return *cast<T>(static_cast<const BaseT *>(
384
493
          *reinterpret_cast<const void *const *>(Storage)));
385
493
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::NamedDecl, clang::Decl>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
9.41k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
9.41k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
9.41k
      return *cast<T>(static_cast<const BaseT *>(
384
9.41k
          *reinterpret_cast<const void *const *>(Storage)));
385
9.41k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::IfStmt, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
203
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
203
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
203
      return *cast<T>(static_cast<const BaseT *>(
384
203
          *reinterpret_cast<const void *const *>(Storage)));
385
203
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::AbstractConditionalOperator, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
63
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
63
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
63
      return *cast<T>(static_cast<const BaseT *>(
384
63
          *reinterpret_cast<const void *const *>(Storage)));
385
63
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::ConditionalOperator, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
25
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
25
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
25
      return *cast<T>(static_cast<const BaseT *>(
384
25
          *reinterpret_cast<const void *const *>(Storage)));
385
25
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::UnaryOperator, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
2.54k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
2.54k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
2.54k
      return *cast<T>(static_cast<const BaseT *>(
384
2.54k
          *reinterpret_cast<const void *const *>(Storage)));
385
2.54k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::ExplicitCastExpr, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
314
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
314
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
314
      return *cast<T>(static_cast<const BaseT *>(
384
314
          *reinterpret_cast<const void *const *>(Storage)));
385
314
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::DeclStmt, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
312
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
312
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
312
      return *cast<T>(static_cast<const BaseT *>(
384
312
          *reinterpret_cast<const void *const *>(Storage)));
385
312
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::Decl, clang::Decl>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
23.6k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
23.6k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
23.6k
      return *cast<T>(static_cast<const BaseT *>(
384
23.6k
          *reinterpret_cast<const void *const *>(Storage)));
385
23.6k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::ParmVarDecl, clang::Decl>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
219
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
219
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
219
      return *cast<T>(static_cast<const BaseT *>(
384
219
          *reinterpret_cast<const void *const *>(Storage)));
385
219
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::ObjCMethodDecl, clang::Decl>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
47
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
47
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
47
      return *cast<T>(static_cast<const BaseT *>(
384
47
          *reinterpret_cast<const void *const *>(Storage)));
385
47
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::BlockDecl, clang::Decl>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
27
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
27
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
27
      return *cast<T>(static_cast<const BaseT *>(
384
27
          *reinterpret_cast<const void *const *>(Storage)));
385
27
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::ForStmt, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
624
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
624
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
624
      return *cast<T>(static_cast<const BaseT *>(
384
624
          *reinterpret_cast<const void *const *>(Storage)));
385
624
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::CXXConstructorDecl, clang::Decl>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
193
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
193
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
193
      return *cast<T>(static_cast<const BaseT *>(
384
193
          *reinterpret_cast<const void *const *>(Storage)));
385
193
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::CXXConstructExpr, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
74
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
74
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
74
      return *cast<T>(static_cast<const BaseT *>(
384
74
          *reinterpret_cast<const void *const *>(Storage)));
385
74
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::InitListExpr, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
182
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
182
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
182
      return *cast<T>(static_cast<const BaseT *>(
384
182
          *reinterpret_cast<const void *const *>(Storage)));
385
182
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::TranslationUnitDecl, clang::Decl>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
324
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
324
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
324
      return *cast<T>(static_cast<const BaseT *>(
384
324
          *reinterpret_cast<const void *const *>(Storage)));
385
324
    }
386
139k
    static DynTypedNode create(const BaseT &Node) {
387
139k
      DynTypedNode Result;
388
139k
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
139k
      new (Result.Storage.buffer) const void *(&Node);
390
139k
      return Result;
391
139k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::Expr, clang::Stmt>::create(clang::Stmt const&)
Line
Count
Source
386
5.23k
    static DynTypedNode create(const BaseT &Node) {
387
5.23k
      DynTypedNode Result;
388
5.23k
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
5.23k
      new (Result.Storage.buffer) const void *(&Node);
390
5.23k
      return Result;
391
5.23k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::ClassTemplateDecl, clang::Decl>::create(clang::Decl const&)
Line
Count
Source
386
94
    static DynTypedNode create(const BaseT &Node) {
387
94
      DynTypedNode Result;
388
94
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
94
      new (Result.Storage.buffer) const void *(&Node);
390
94
      return Result;
391
94
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::Decl, clang::Decl>::create(clang::Decl const&)
Line
Count
Source
386
54.0k
    static DynTypedNode create(const BaseT &Node) {
387
54.0k
      DynTypedNode Result;
388
54.0k
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
54.0k
      new (Result.Storage.buffer) const void *(&Node);
390
54.0k
      return Result;
391
54.0k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::Stmt, clang::Stmt>::create(clang::Stmt const&)
Line
Count
Source
386
68.8k
    static DynTypedNode create(const BaseT &Node) {
387
68.8k
      DynTypedNode Result;
388
68.8k
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
68.8k
      new (Result.Storage.buffer) const void *(&Node);
390
68.8k
      return Result;
391
68.8k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::VarDecl, clang::Decl>::create(clang::Decl const&)
Line
Count
Source
386
478
    static DynTypedNode create(const BaseT &Node) {
387
478
      DynTypedNode Result;
388
478
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
478
      new (Result.Storage.buffer) const void *(&Node);
390
478
      return Result;
391
478
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::CXXRecordDecl, clang::Decl>::create(clang::Decl const&)
Line
Count
Source
386
650
    static DynTypedNode create(const BaseT &Node) {
387
650
      DynTypedNode Result;
388
650
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
650
      new (Result.Storage.buffer) const void *(&Node);
390
650
      return Result;
391
650
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::NamedDecl, clang::Decl>::create(clang::Decl const&)
Line
Count
Source
386
308
    static DynTypedNode create(const BaseT &Node) {
387
308
      DynTypedNode Result;
388
308
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
308
      new (Result.Storage.buffer) const void *(&Node);
390
308
      return Result;
391
308
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::Type, clang::Type>::create(clang::Type const&)
Line
Count
Source
386
8.11k
    static DynTypedNode create(const BaseT &Node) {
387
8.11k
      DynTypedNode Result;
388
8.11k
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
8.11k
      new (Result.Storage.buffer) const void *(&Node);
390
8.11k
      return Result;
391
8.11k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::CXXMemberCallExpr, clang::Stmt>::create(clang::Stmt const&)
Line
Count
Source
386
18
    static DynTypedNode create(const BaseT &Node) {
387
18
      DynTypedNode Result;
388
18
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
18
      new (Result.Storage.buffer) const void *(&Node);
390
18
      return Result;
391
18
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::UsingShadowDecl, clang::Decl>::create(clang::Decl const&)
Line
Count
Source
386
12
    static DynTypedNode create(const BaseT &Node) {
387
12
      DynTypedNode Result;
388
12
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
12
      new (Result.Storage.buffer) const void *(&Node);
390
12
      return Result;
391
12
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::FieldDecl, clang::Decl>::create(clang::Decl const&)
Line
Count
Source
386
50
    static DynTypedNode create(const BaseT &Node) {
387
50
      DynTypedNode Result;
388
50
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
50
      new (Result.Storage.buffer) const void *(&Node);
390
50
      return Result;
391
50
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::DeclStmt, clang::Stmt>::create(clang::Stmt const&)
Line
Count
Source
386
85
    static DynTypedNode create(const BaseT &Node) {
387
85
      DynTypedNode Result;
388
85
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
85
      new (Result.Storage.buffer) const void *(&Node);
390
85
      return Result;
391
85
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::CXXMethodDecl, clang::Decl>::create(clang::Decl const&)
Line
Count
Source
386
104
    static DynTypedNode create(const BaseT &Node) {
387
104
      DynTypedNode Result;
388
104
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
104
      new (Result.Storage.buffer) const void *(&Node);
390
104
      return Result;
391
104
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::ValueDecl, clang::Decl>::create(clang::Decl const&)
Line
Count
Source
386
18
    static DynTypedNode create(const BaseT &Node) {
387
18
      DynTypedNode Result;
388
18
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
18
      new (Result.Storage.buffer) const void *(&Node);
390
18
      return Result;
391
18
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::NamespaceDecl, clang::Decl>::create(clang::Decl const&)
Line
Count
Source
386
36
    static DynTypedNode create(const BaseT &Node) {
387
36
      DynTypedNode Result;
388
36
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
36
      new (Result.Storage.buffer) const void *(&Node);
390
36
      return Result;
391
36
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::SwitchCase, clang::Stmt>::create(clang::Stmt const&)
Line
Count
Source
386
23
    static DynTypedNode create(const BaseT &Node) {
387
23
      DynTypedNode Result;
388
23
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
23
      new (Result.Storage.buffer) const void *(&Node);
390
23
      return Result;
391
23
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::FunctionDecl, clang::Decl>::create(clang::Decl const&)
Line
Count
Source
386
351
    static DynTypedNode create(const BaseT &Node) {
387
351
      DynTypedNode Result;
388
351
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
351
      new (Result.Storage.buffer) const void *(&Node);
390
351
      return Result;
391
351
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::CompoundStmt, clang::Stmt>::create(clang::Stmt const&)
Line
Count
Source
386
419
    static DynTypedNode create(const BaseT &Node) {
387
419
      DynTypedNode Result;
388
419
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
419
      new (Result.Storage.buffer) const void *(&Node);
390
419
      return Result;
391
419
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::UnaryOperator, clang::Stmt>::create(clang::Stmt const&)
Line
Count
Source
386
14
    static DynTypedNode create(const BaseT &Node) {
387
14
      DynTypedNode Result;
388
14
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
14
      new (Result.Storage.buffer) const void *(&Node);
390
14
      return Result;
391
14
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::ExplicitCastExpr, clang::Stmt>::create(clang::Stmt const&)
Line
Count
Source
386
110
    static DynTypedNode create(const BaseT &Node) {
387
110
      DynTypedNode Result;
388
110
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
110
      new (Result.Storage.buffer) const void *(&Node);
390
110
      return Result;
391
110
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::ParmVarDecl, clang::Decl>::create(clang::Decl const&)
Line
Count
Source
386
185
    static DynTypedNode create(const BaseT &Node) {
387
185
      DynTypedNode Result;
388
185
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
185
      new (Result.Storage.buffer) const void *(&Node);
390
185
      return Result;
391
185
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::ObjCMethodDecl, clang::Decl>::create(clang::Decl const&)
Line
Count
Source
386
6
    static DynTypedNode create(const BaseT &Node) {
387
6
      DynTypedNode Result;
388
6
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
6
      new (Result.Storage.buffer) const void *(&Node);
390
6
      return Result;
391
6
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::BlockDecl, clang::Decl>::create(clang::Decl const&)
Line
Count
Source
386
1
    static DynTypedNode create(const BaseT &Node) {
387
1
      DynTypedNode Result;
388
1
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
1
      new (Result.Storage.buffer) const void *(&Node);
390
1
      return Result;
391
1
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::InitListExpr, clang::Stmt>::create(clang::Stmt const&)
Line
Count
Source
386
135
    static DynTypedNode create(const BaseT &Node) {
387
135
      DynTypedNode Result;
388
135
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
135
      new (Result.Storage.buffer) const void *(&Node);
390
135
      return Result;
391
135
    }
392
  };
393
394
  /// Converter that stores T* (by pointer).
395
  template <typename T> struct PtrConverter {
396
351
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
397
351
      if (ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind))
398
60
        return &getUnchecked(NodeKind, Storage);
399
291
      return nullptr;
400
291
    }
clang::ast_type_traits::DynTypedNode::PtrConverter<clang::NestedNameSpecifier>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
396
175
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
397
175
      if (ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind))
398
45
        return &getUnchecked(NodeKind, Storage);
399
130
      return nullptr;
400
130
    }
clang::ast_type_traits::DynTypedNode::PtrConverter<clang::CXXCtorInitializer>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
396
176
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
397
176
      if (ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind))
398
15
        return &getUnchecked(NodeKind, Storage);
399
161
      return nullptr;
400
161
    }
401
256
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
402
256
      assert(ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind));
403
256
      return *static_cast<const T *>(
404
256
          *reinterpret_cast<const void *const *>(Storage));
405
256
    }
clang::ast_type_traits::DynTypedNode::PtrConverter<clang::NestedNameSpecifier>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
401
157
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
402
157
      assert(ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind));
403
157
      return *static_cast<const T *>(
404
157
          *reinterpret_cast<const void *const *>(Storage));
405
157
    }
clang::ast_type_traits::DynTypedNode::PtrConverter<clang::CXXCtorInitializer>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
401
99
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
402
99
      assert(ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind));
403
99
      return *static_cast<const T *>(
404
99
          *reinterpret_cast<const void *const *>(Storage));
405
99
    }
406
235
    static DynTypedNode create(const T &Node) {
407
235
      DynTypedNode Result;
408
235
      Result.NodeKind = ASTNodeKind::getFromNodeKind<T>();
409
235
      new (Result.Storage.buffer) const void *(&Node);
410
235
      return Result;
411
235
    }
clang::ast_type_traits::DynTypedNode::PtrConverter<clang::NestedNameSpecifier>::create(clang::NestedNameSpecifier const&)
Line
Count
Source
406
154
    static DynTypedNode create(const T &Node) {
407
154
      DynTypedNode Result;
408
154
      Result.NodeKind = ASTNodeKind::getFromNodeKind<T>();
409
154
      new (Result.Storage.buffer) const void *(&Node);
410
154
      return Result;
411
154
    }
clang::ast_type_traits::DynTypedNode::PtrConverter<clang::CXXCtorInitializer>::create(clang::CXXCtorInitializer const&)
Line
Count
Source
406
81
    static DynTypedNode create(const T &Node) {
407
81
      DynTypedNode Result;
408
81
      Result.NodeKind = ASTNodeKind::getFromNodeKind<T>();
409
81
      new (Result.Storage.buffer) const void *(&Node);
410
81
      return Result;
411
81
    }
412
  };
413
414
  /// Converter that stores T (by value).
415
  template <typename T> struct ValueConverter {
416
10.9k
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
417
10.9k
      if (ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind))
418
2.81k
        return reinterpret_cast<const T *>(Storage);
419
8.17k
      return nullptr;
420
8.17k
    }
clang::ast_type_traits::DynTypedNode::ValueConverter<clang::QualType>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
416
196
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
417
196
      if (ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind))
418
176
        return reinterpret_cast<const T *>(Storage);
419
20
      return nullptr;
420
20
    }
clang::ast_type_traits::DynTypedNode::ValueConverter<clang::NestedNameSpecifierLoc>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
416
5.44k
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
417
5.44k
      if (ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind))
418
174
        return reinterpret_cast<const T *>(Storage);
419
5.26k
      return nullptr;
420
5.26k
    }
clang::ast_type_traits::DynTypedNode::ValueConverter<clang::TypeLoc>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
416
5.35k
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
417
5.35k
      if (ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind))
418
2.46k
        return reinterpret_cast<const T *>(Storage);
419
2.88k
      return nullptr;
420
2.88k
    }
clang::ast_type_traits::DynTypedNode::ValueConverter<clang::TemplateArgument>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
416
2
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
417
2
      if (ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind))
418
0
        return reinterpret_cast<const T *>(Storage);
419
2
      return nullptr;
420
2
    }
clang::ast_type_traits::DynTypedNode::ValueConverter<clang::TemplateName>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
416
2
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
417
2
      if (ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind))
418
0
        return reinterpret_cast<const T *>(Storage);
419
2
      return nullptr;
420
2
    }
421
54.5k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
422
54.5k
      assert(ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind));
423
54.5k
      return *reinterpret_cast<const T *>(Storage);
424
54.5k
    }
clang::ast_type_traits::DynTypedNode::ValueConverter<clang::QualType>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
421
8.25k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
422
8.25k
      assert(ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind));
423
8.25k
      return *reinterpret_cast<const T *>(Storage);
424
8.25k
    }
clang::ast_type_traits::DynTypedNode::ValueConverter<clang::TypeLoc>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
421
45.1k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
422
45.1k
      assert(ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind));
423
45.1k
      return *reinterpret_cast<const T *>(Storage);
424
45.1k
    }
clang::ast_type_traits::DynTypedNode::ValueConverter<clang::NestedNameSpecifierLoc>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
421
1.10k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
422
1.10k
      assert(ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind));
423
1.10k
      return *reinterpret_cast<const T *>(Storage);
424
1.10k
    }
425
46.8k
    static DynTypedNode create(const T &Node) {
426
46.8k
      DynTypedNode Result;
427
46.8k
      Result.NodeKind = ASTNodeKind::getFromNodeKind<T>();
428
46.8k
      new (Result.Storage.buffer) T(Node);
429
46.8k
      return Result;
430
46.8k
    }
clang::ast_type_traits::DynTypedNode::ValueConverter<clang::QualType>::create(clang::QualType const&)
Line
Count
Source
425
10.8k
    static DynTypedNode create(const T &Node) {
426
10.8k
      DynTypedNode Result;
427
10.8k
      Result.NodeKind = ASTNodeKind::getFromNodeKind<T>();
428
10.8k
      new (Result.Storage.buffer) T(Node);
429
10.8k
      return Result;
430
10.8k
    }
clang::ast_type_traits::DynTypedNode::ValueConverter<clang::TemplateName>::create(clang::TemplateName const&)
Line
Count
Source
425
2
    static DynTypedNode create(const T &Node) {
426
2
      DynTypedNode Result;
427
2
      Result.NodeKind = ASTNodeKind::getFromNodeKind<T>();
428
2
      new (Result.Storage.buffer) T(Node);
429
2
      return Result;
430
2
    }
clang::ast_type_traits::DynTypedNode::ValueConverter<clang::TypeLoc>::create(clang::TypeLoc const&)
Line
Count
Source
425
26.9k
    static DynTypedNode create(const T &Node) {
426
26.9k
      DynTypedNode Result;
427
26.9k
      Result.NodeKind = ASTNodeKind::getFromNodeKind<T>();
428
26.9k
      new (Result.Storage.buffer) T(Node);
429
26.9k
      return Result;
430
26.9k
    }
clang::ast_type_traits::DynTypedNode::ValueConverter<clang::NestedNameSpecifierLoc>::create(clang::NestedNameSpecifierLoc const&)
Line
Count
Source
425
8.99k
    static DynTypedNode create(const T &Node) {
426
8.99k
      DynTypedNode Result;
427
8.99k
      Result.NodeKind = ASTNodeKind::getFromNodeKind<T>();
428
8.99k
      new (Result.Storage.buffer) T(Node);
429
8.99k
      return Result;
430
8.99k
    }
431
  };
432
433
  ASTNodeKind NodeKind;
434
435
  /// Stores the data of the node.
436
  ///
437
  /// Note that we can store \c Decls, \c Stmts, \c Types,
438
  /// \c NestedNameSpecifiers and \c CXXCtorInitializer by pointer as they are
439
  /// guaranteed to be unique pointers pointing to dedicated storage in the AST.
440
  /// \c QualTypes, \c NestedNameSpecifierLocs, \c TypeLocs and
441
  /// \c TemplateArguments on the other hand do not have storage or unique
442
  /// pointers and thus need to be stored by value.
443
  llvm::AlignedCharArrayUnion<const void *, TemplateArgument,
444
                              NestedNameSpecifierLoc, QualType,
445
                              TypeLoc> Storage;
446
};
447
448
template <typename T>
449
struct DynTypedNode::BaseConverter<
450
    T, typename std::enable_if<std::is_base_of<Decl, T>::value>::type>
451
    : public DynCastPtrConverter<T, Decl> {};
452
453
template <typename T>
454
struct DynTypedNode::BaseConverter<
455
    T, typename std::enable_if<std::is_base_of<Stmt, T>::value>::type>
456
    : public DynCastPtrConverter<T, Stmt> {};
457
458
template <typename T>
459
struct DynTypedNode::BaseConverter<
460
    T, typename std::enable_if<std::is_base_of<Type, T>::value>::type>
461
    : public DynCastPtrConverter<T, Type> {};
462
463
template <>
464
struct DynTypedNode::BaseConverter<
465
    NestedNameSpecifier, void> : public PtrConverter<NestedNameSpecifier> {};
466
467
template <>
468
struct DynTypedNode::BaseConverter<
469
    CXXCtorInitializer, void> : public PtrConverter<CXXCtorInitializer> {};
470
471
template <>
472
struct DynTypedNode::BaseConverter<
473
    TemplateArgument, void> : public ValueConverter<TemplateArgument> {};
474
475
template <>
476
struct DynTypedNode::BaseConverter<
477
    TemplateName, void> : public ValueConverter<TemplateName> {};
478
479
template <>
480
struct DynTypedNode::BaseConverter<
481
    NestedNameSpecifierLoc,
482
    void> : public ValueConverter<NestedNameSpecifierLoc> {};
483
484
template <>
485
struct DynTypedNode::BaseConverter<QualType,
486
                                   void> : public ValueConverter<QualType> {};
487
488
template <>
489
struct DynTypedNode::BaseConverter<
490
    TypeLoc, void> : public ValueConverter<TypeLoc> {};
491
492
// The only operation we allow on unsupported types is \c get.
493
// This allows to conveniently use \c DynTypedNode when having an arbitrary
494
// AST node that is not supported, but prevents misuse - a user cannot create
495
// a DynTypedNode from arbitrary types.
496
template <typename T, typename EnablerT> struct DynTypedNode::BaseConverter {
497
  static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
498
    return NULL;
499
  }
500
};
501
502
} // end namespace ast_type_traits
503
} // end namespace clang
504
505
namespace llvm {
506
507
template <>
508
struct DenseMapInfo<clang::ast_type_traits::ASTNodeKind>
509
    : clang::ast_type_traits::ASTNodeKind::DenseMapInfo {};
510
511
template <>
512
struct DenseMapInfo<clang::ast_type_traits::DynTypedNode>
513
    : clang::ast_type_traits::DynTypedNode::DenseMapInfo {};
514
515
}  // end namespace llvm
516
517
#endif