Coverage Report

Created: 2018-09-23 22:08

/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
867k
  ASTNodeKind() : KindId(NKI_None) {}
50
51
  /// Construct an identifier for T.
52
  template <class T>
53
1.39M
  static ASTNodeKind getFromNodeKind() {
54
1.39M
    return ASTNodeKind(KindToKindId<T>::Id);
55
1.39M
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::QualType>()
Line
Count
Source
53
155k
  static ASTNodeKind getFromNodeKind() {
54
155k
    return ASTNodeKind(KindToKindId<T>::Id);
55
155k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::TemplateName>()
Line
Count
Source
53
50
  static ASTNodeKind getFromNodeKind() {
54
50
    return ASTNodeKind(KindToKindId<T>::Id);
55
50
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::CXXRecordDecl>()
Line
Count
Source
53
5.94k
  static ASTNodeKind getFromNodeKind() {
54
5.94k
    return ASTNodeKind(KindToKindId<T>::Id);
55
5.94k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::CallExpr>()
Line
Count
Source
53
27.1k
  static ASTNodeKind getFromNodeKind() {
54
27.1k
    return ASTNodeKind(KindToKindId<T>::Id);
55
27.1k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::Stmt>()
Line
Count
Source
53
251k
  static ASTNodeKind getFromNodeKind() {
54
251k
    return ASTNodeKind(KindToKindId<T>::Id);
55
251k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::TypeLoc>()
Line
Count
Source
53
105k
  static ASTNodeKind getFromNodeKind() {
54
105k
    return ASTNodeKind(KindToKindId<T>::Id);
55
105k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::Expr>()
Line
Count
Source
53
130k
  static ASTNodeKind getFromNodeKind() {
54
130k
    return ASTNodeKind(KindToKindId<T>::Id);
55
130k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::NestedNameSpecifier>()
Line
Count
Source
53
1.74k
  static ASTNodeKind getFromNodeKind() {
54
1.74k
    return ASTNodeKind(KindToKindId<T>::Id);
55
1.74k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::NestedNameSpecifierLoc>()
Line
Count
Source
53
37.5k
  static ASTNodeKind getFromNodeKind() {
54
37.5k
    return ASTNodeKind(KindToKindId<T>::Id);
55
37.5k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::CXXCtorInitializer>()
Line
Count
Source
53
728
  static ASTNodeKind getFromNodeKind() {
54
728
    return ASTNodeKind(KindToKindId<T>::Id);
55
728
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::FunctionDecl>()
Line
Count
Source
53
6.17k
  static ASTNodeKind getFromNodeKind() {
54
6.17k
    return ASTNodeKind(KindToKindId<T>::Id);
55
6.17k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::LambdaExpr>()
Line
Count
Source
53
307
  static ASTNodeKind getFromNodeKind() {
54
307
    return ASTNodeKind(KindToKindId<T>::Id);
55
307
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::NamedDecl>()
Line
Count
Source
53
4.45k
  static ASTNodeKind getFromNodeKind() {
54
4.45k
    return ASTNodeKind(KindToKindId<T>::Id);
55
4.45k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::CXXMemberCallExpr>()
Line
Count
Source
53
1.14k
  static ASTNodeKind getFromNodeKind() {
54
1.14k
    return ASTNodeKind(KindToKindId<T>::Id);
55
1.14k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::Decl>()
Line
Count
Source
53
221k
  static ASTNodeKind getFromNodeKind() {
54
221k
    return ASTNodeKind(KindToKindId<T>::Id);
55
221k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::IntegerLiteral>()
Line
Count
Source
53
2.72k
  static ASTNodeKind getFromNodeKind() {
54
2.72k
    return ASTNodeKind(KindToKindId<T>::Id);
55
2.72k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::VarDecl>()
Line
Count
Source
53
122k
  static ASTNodeKind getFromNodeKind() {
54
122k
    return ASTNodeKind(KindToKindId<T>::Id);
55
122k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::BinaryOperator>()
Line
Count
Source
53
10.0k
  static ASTNodeKind getFromNodeKind() {
54
10.0k
    return ASTNodeKind(KindToKindId<T>::Id);
55
10.0k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::DeclRefExpr>()
Line
Count
Source
53
68.5k
  static ASTNodeKind getFromNodeKind() {
54
68.5k
    return ASTNodeKind(KindToKindId<T>::Id);
55
68.5k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::BlockPointerType>()
Line
Count
Source
53
571
  static ASTNodeKind getFromNodeKind() {
54
571
    return ASTNodeKind(KindToKindId<T>::Id);
55
571
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::Type>()
Line
Count
Source
53
25.2k
  static ASTNodeKind getFromNodeKind() {
54
25.2k
    return ASTNodeKind(KindToKindId<T>::Id);
55
25.2k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::ObjCMessageExpr>()
Line
Count
Source
53
4.13k
  static ASTNodeKind getFromNodeKind() {
54
4.13k
    return ASTNodeKind(KindToKindId<T>::Id);
55
4.13k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::CompoundStmt>()
Line
Count
Source
53
1.84k
  static ASTNodeKind getFromNodeKind() {
54
1.84k
    return ASTNodeKind(KindToKindId<T>::Id);
55
1.84k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::TemplateArgument>()
Line
Count
Source
53
311
  static ASTNodeKind getFromNodeKind() {
54
311
    return ASTNodeKind(KindToKindId<T>::Id);
55
311
  }
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.7k
  static ASTNodeKind getFromNodeKind() {
54
17.7k
    return ASTNodeKind(KindToKindId<T>::Id);
55
17.7k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::CXXConstructorDecl>()
Line
Count
Source
53
5.11k
  static ASTNodeKind getFromNodeKind() {
54
5.11k
    return ASTNodeKind(KindToKindId<T>::Id);
55
5.11k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::CXXConstructExpr>()
Line
Count
Source
53
2.52k
  static ASTNodeKind getFromNodeKind() {
54
2.52k
    return ASTNodeKind(KindToKindId<T>::Id);
55
2.52k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::CXXMethodDecl>()
Line
Count
Source
53
12.1k
  static ASTNodeKind getFromNodeKind() {
54
12.1k
    return ASTNodeKind(KindToKindId<T>::Id);
55
12.1k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::CXXOperatorCallExpr>()
Line
Count
Source
53
4.86k
  static ASTNodeKind getFromNodeKind() {
54
4.86k
    return ASTNodeKind(KindToKindId<T>::Id);
55
4.86k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::IfStmt>()
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::UnaryOperator>()
Line
Count
Source
53
71.1k
  static ASTNodeKind getFromNodeKind() {
54
71.1k
    return ASTNodeKind(KindToKindId<T>::Id);
55
71.1k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::ExplicitCastExpr>()
Line
Count
Source
53
1.05k
  static ASTNodeKind getFromNodeKind() {
54
1.05k
    return ASTNodeKind(KindToKindId<T>::Id);
55
1.05k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::AbstractConditionalOperator>()
Line
Count
Source
53
574
  static ASTNodeKind getFromNodeKind() {
54
574
    return ASTNodeKind(KindToKindId<T>::Id);
55
574
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::SwitchStmt>()
Line
Count
Source
53
437
  static ASTNodeKind getFromNodeKind() {
54
437
    return ASTNodeKind(KindToKindId<T>::Id);
55
437
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::ReturnStmt>()
Line
Count
Source
53
658
  static ASTNodeKind getFromNodeKind() {
54
658
    return ASTNodeKind(KindToKindId<T>::Id);
55
658
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::PointerType>()
Line
Count
Source
53
551
  static ASTNodeKind getFromNodeKind() {
54
551
    return ASTNodeKind(KindToKindId<T>::Id);
55
551
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::ParmVarDecl>()
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::TypedefType>()
Line
Count
Source
53
384
  static ASTNodeKind getFromNodeKind() {
54
384
    return ASTNodeKind(KindToKindId<T>::Id);
55
384
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::TypedefDecl>()
Line
Count
Source
53
481
  static ASTNodeKind getFromNodeKind() {
54
481
    return ASTNodeKind(KindToKindId<T>::Id);
55
481
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::RecordType>()
Line
Count
Source
53
180
  static ASTNodeKind getFromNodeKind() {
54
180
    return ASTNodeKind(KindToKindId<T>::Id);
55
180
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::ObjCObjectPointerType>()
Line
Count
Source
53
346
  static ASTNodeKind getFromNodeKind() {
54
346
    return ASTNodeKind(KindToKindId<T>::Id);
55
346
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::ObjCInterfaceDecl>()
Line
Count
Source
53
149
  static ASTNodeKind getFromNodeKind() {
54
149
    return ASTNodeKind(KindToKindId<T>::Id);
55
149
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::ConditionalOperator>()
Line
Count
Source
53
1.56k
  static ASTNodeKind getFromNodeKind() {
54
1.56k
    return ASTNodeKind(KindToKindId<T>::Id);
55
1.56k
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::ObjCMethodDecl>()
Line
Count
Source
53
520
  static ASTNodeKind getFromNodeKind() {
54
520
    return ASTNodeKind(KindToKindId<T>::Id);
55
520
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::BlockDecl>()
Line
Count
Source
53
485
  static ASTNodeKind getFromNodeKind() {
54
485
    return ASTNodeKind(KindToKindId<T>::Id);
55
485
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::ObjCAutoreleasePoolStmt>()
Line
Count
Source
53
620
  static ASTNodeKind getFromNodeKind() {
54
620
    return ASTNodeKind(KindToKindId<T>::Id);
55
620
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::ObjCIvarRefExpr>()
Line
Count
Source
53
82
  static ASTNodeKind getFromNodeKind() {
54
82
    return ASTNodeKind(KindToKindId<T>::Id);
55
82
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::GotoStmt>()
Line
Count
Source
53
375
  static ASTNodeKind getFromNodeKind() {
54
375
    return ASTNodeKind(KindToKindId<T>::Id);
55
375
  }
clang::ast_type_traits::ASTNodeKind clang::ast_type_traits::ASTNodeKind::getFromNodeKind<clang::ReferenceType>()
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::TranslationUnitDecl>()
Line
Count
Source
53
4.55k
  static ASTNodeKind getFromNodeKind() {
54
4.55k
    return ASTNodeKind(KindToKindId<T>::Id);
55
4.55k
  }
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
301k
  bool isSame(ASTNodeKind Other) const {
66
301k
    return KindId != NKI_None && 
KindId == Other.KindId301k
;
67
301k
  }
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
194k
  bool operator<(const ASTNodeKind &Other) const {
82
194k
    return KindId < Other.KindId;
83
194k
  }
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
454k
    static inline ASTNodeKind getEmptyKey() { return ASTNodeKind(); }
100
    // NKI_NumberOfKinds is not a valid value, so it is good for a
101
    // tombstone key.
102
369k
    static inline ASTNodeKind getTombstoneKey() {
103
369k
      return ASTNodeKind(NKI_NumberOfKinds);
104
369k
    }
105
105k
    static unsigned getHashValue(const ASTNodeKind &Val) { return Val.KindId; }
106
2.16M
    static bool isEqual(const ASTNodeKind &LHS, const ASTNodeKind &RHS) {
107
2.16M
      return LHS.KindId == RHS.KindId;
108
2.16M
    }
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
59.5k
  bool hasPointerIdentity() const {
114
59.5k
    return KindId > NKI_LastKindWithoutPointerIdentity;
115
59.5k
  }
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
2.00M
  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
286k
  static DynTypedNode create(const T &Node) {
217
286k
    return BaseConverter<T>::create(Node);
218
286k
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::Expr>(clang::Expr const&)
Line
Count
Source
216
6.84k
  static DynTypedNode create(const T &Node) {
217
6.84k
    return BaseConverter<T>::create(Node);
218
6.84k
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::ClassTemplateDecl>(clang::ClassTemplateDecl const&)
Line
Count
Source
216
102
  static DynTypedNode create(const T &Node) {
217
102
    return BaseConverter<T>::create(Node);
218
102
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::QualType>(clang::QualType const&)
Line
Count
Source
216
19.4k
  static DynTypedNode create(const T &Node) {
217
19.4k
    return BaseConverter<T>::create(Node);
218
19.4k
  }
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
78.3k
  static DynTypedNode create(const T &Node) {
217
78.3k
    return BaseConverter<T>::create(Node);
218
78.3k
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::Stmt>(clang::Stmt const&)
Line
Count
Source
216
107k
  static DynTypedNode create(const T &Node) {
217
107k
    return BaseConverter<T>::create(Node);
218
107k
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::VarDecl>(clang::VarDecl const&)
Line
Count
Source
216
544
  static DynTypedNode create(const T &Node) {
217
544
    return BaseConverter<T>::create(Node);
218
544
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::CXXRecordDecl>(clang::CXXRecordDecl const&)
Line
Count
Source
216
694
  static DynTypedNode create(const T &Node) {
217
694
    return BaseConverter<T>::create(Node);
218
694
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::NamedDecl>(clang::NamedDecl const&)
Line
Count
Source
216
316
  static DynTypedNode create(const T &Node) {
217
316
    return BaseConverter<T>::create(Node);
218
316
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::TypeLoc>(clang::TypeLoc const&)
Line
Count
Source
216
41.0k
  static DynTypedNode create(const T &Node) {
217
41.0k
    return BaseConverter<T>::create(Node);
218
41.0k
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::Type>(clang::Type const&)
Line
Count
Source
216
16.8k
  static DynTypedNode create(const T &Node) {
217
16.8k
    return BaseConverter<T>::create(Node);
218
16.8k
  }
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
129
  static DynTypedNode create(const T &Node) {
217
129
    return BaseConverter<T>::create(Node);
218
129
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::CXXMethodDecl>(clang::CXXMethodDecl const&)
Line
Count
Source
216
280
  static DynTypedNode create(const T &Node) {
217
280
    return BaseConverter<T>::create(Node);
218
280
  }
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
444
  static DynTypedNode create(const T &Node) {
217
444
    return BaseConverter<T>::create(Node);
218
444
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::NestedNameSpecifierLoc>(clang::NestedNameSpecifierLoc const&)
Line
Count
Source
216
11.8k
  static DynTypedNode create(const T &Node) {
217
11.8k
    return BaseConverter<T>::create(Node);
218
11.8k
  }
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
183
  static DynTypedNode create(const T &Node) {
217
183
    return BaseConverter<T>::create(Node);
218
183
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::FunctionDecl>(clang::FunctionDecl const&)
Line
Count
Source
216
386
  static DynTypedNode create(const T &Node) {
217
386
    return BaseConverter<T>::create(Node);
218
386
  }
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
15
  static DynTypedNode create(const T &Node) {
217
15
    return BaseConverter<T>::create(Node);
218
15
  }
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
401
  static DynTypedNode create(const T &Node) {
217
401
    return BaseConverter<T>::create(Node);
218
401
  }
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::ObjCMessageExpr>(clang::ObjCMessageExpr const&)
Line
Count
Source
216
30
  static DynTypedNode create(const T &Node) {
217
30
    return BaseConverter<T>::create(Node);
218
30
  }
clang::ast_type_traits::DynTypedNode clang::ast_type_traits::DynTypedNode::create<clang::ObjCAutoreleasePoolStmt>(clang::ObjCAutoreleasePoolStmt 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::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
119k
  const T *get() const {
234
119k
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
119k
  }
clang::FunctionDecl const* clang::ast_type_traits::DynTypedNode::get<clang::FunctionDecl>() const
Line
Count
Source
233
730
  const T *get() const {
234
730
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
730
  }
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
38.7k
  const T *get() const {
234
38.7k
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
38.7k
  }
clang::Expr const* clang::ast_type_traits::DynTypedNode::get<clang::Expr>() const
Line
Count
Source
233
498
  const T *get() const {
234
498
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
498
  }
clang::Decl const* clang::ast_type_traits::DynTypedNode::get<clang::Decl>() const
Line
Count
Source
233
62.7k
  const T *get() const {
234
62.7k
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
62.7k
  }
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
81
  const T *get() const {
234
81
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
81
  }
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::ObjCMessageExpr const* clang::ast_type_traits::DynTypedNode::get<clang::ObjCMessageExpr>() const
Line
Count
Source
233
16
  const T *get() const {
234
16
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
16
  }
clang::ObjCAutoreleasePoolStmt const* clang::ast_type_traits::DynTypedNode::get<clang::ObjCAutoreleasePoolStmt>() const
Line
Count
Source
233
12
  const T *get() const {
234
12
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
12
  }
clang::ObjCIvarRefExpr const* clang::ast_type_traits::DynTypedNode::get<clang::ObjCIvarRefExpr>() const
Line
Count
Source
233
2
  const T *get() const {
234
2
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
2
  }
clang::VarDecl const* clang::ast_type_traits::DynTypedNode::get<clang::VarDecl>() const
Line
Count
Source
233
270
  const T *get() const {
234
270
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
270
  }
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
4.20k
  const T *get() const {
234
4.20k
    return BaseConverter<T>::get(NodeKind, Storage.buffer);
235
4.20k
  }
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
108k
  const T &getUnchecked() const {
242
108k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
108k
  }
clang::CallExpr const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::CallExpr>() const
Line
Count
Source
241
3.45k
  const T &getUnchecked() const {
242
3.45k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
3.45k
  }
clang::QualType const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::QualType>() const
Line
Count
Source
241
9.40k
  const T &getUnchecked() const {
242
9.40k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
9.40k
  }
clang::Expr const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::Expr>() const
Line
Count
Source
241
5.40k
  const T &getUnchecked() const {
242
5.40k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
5.40k
  }
clang::CXXRecordDecl const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::CXXRecordDecl>() const
Line
Count
Source
241
1.02k
  const T &getUnchecked() const {
242
1.02k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
1.02k
  }
clang::CXXMemberCallExpr const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::CXXMemberCallExpr>() const
Line
Count
Source
241
80
  const T &getUnchecked() const {
242
80
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
80
  }
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
2.34k
  const T &getUnchecked() const {
242
2.34k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
2.34k
  }
clang::BinaryOperator const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::BinaryOperator>() const
Line
Count
Source
241
2.60k
  const T &getUnchecked() const {
242
2.60k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
2.60k
  }
clang::DeclRefExpr const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::DeclRefExpr>() const
Line
Count
Source
241
1.30k
  const T &getUnchecked() const {
242
1.30k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
1.30k
  }
clang::TypeLoc const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::TypeLoc>() const
Line
Count
Source
241
54.4k
  const T &getUnchecked() const {
242
54.4k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
54.4k
  }
clang::NestedNameSpecifierLoc const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::NestedNameSpecifierLoc>() const
Line
Count
Source
241
1.24k
  const T &getUnchecked() const {
242
1.24k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
1.24k
  }
clang::Stmt const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::Stmt>() const
Line
Count
Source
241
5.95k
  const T &getUnchecked() const {
242
5.95k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
5.95k
  }
clang::ObjCMessageExpr const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::ObjCMessageExpr>() const
Line
Count
Source
241
233
  const T &getUnchecked() const {
242
233
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
233
  }
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
1.16k
  const T &getUnchecked() const {
242
1.16k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
1.16k
  }
clang::FunctionDecl const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::FunctionDecl>() const
Line
Count
Source
241
1.42k
  const T &getUnchecked() const {
242
1.42k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
1.42k
  }
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
10.3k
  const T &getUnchecked() const {
242
10.3k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
10.3k
  }
clang::Type const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::Type>() const
Line
Count
Source
241
1.05k
  const T &getUnchecked() const {
242
1.05k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
1.05k
  }
clang::DeclStmt const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::DeclStmt>() const
Line
Count
Source
241
336
  const T &getUnchecked() const {
242
336
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
336
  }
clang::CXXConstructorDecl const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::CXXConstructorDecl>() const
Line
Count
Source
241
490
  const T &getUnchecked() const {
242
490
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
490
  }
clang::CXXConstructExpr const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::CXXConstructExpr>() const
Line
Count
Source
241
341
  const T &getUnchecked() const {
242
341
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
341
  }
clang::IfStmt const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::IfStmt>() const
Line
Count
Source
241
162
  const T &getUnchecked() const {
242
162
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
162
  }
clang::UnaryOperator const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::UnaryOperator>() const
Line
Count
Source
241
2.68k
  const T &getUnchecked() const {
242
2.68k
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
2.68k
  }
clang::ExplicitCastExpr const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::ExplicitCastExpr>() const
Line
Count
Source
241
323
  const T &getUnchecked() const {
242
323
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
323
  }
clang::AbstractConditionalOperator const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::AbstractConditionalOperator>() const
Line
Count
Source
241
65
  const T &getUnchecked() const {
242
65
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
65
  }
clang::ParmVarDecl const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::ParmVarDecl>() const
Line
Count
Source
241
319
  const T &getUnchecked() const {
242
319
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
319
  }
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
164
  const T &getUnchecked() const {
242
164
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
164
  }
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
  }
clang::ObjCAutoreleasePoolStmt const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::ObjCAutoreleasePoolStmt>() const
Line
Count
Source
241
18
  const T &getUnchecked() const {
242
18
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
18
  }
clang::ObjCIvarRefExpr const& clang::ast_type_traits::DynTypedNode::getUnchecked<clang::ObjCIvarRefExpr>() const
Line
Count
Source
241
6
  const T &getUnchecked() const {
242
6
    return BaseConverter<T>::getUnchecked(NodeKind, Storage.buffer);
243
6
  }
244
245
358k
  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
49.1k
  const void *getMemoizationData() const {
253
49.1k
    return NodeKind.hasPointerIdentity()
254
49.1k
               ? 
*reinterpret_cast<void *const *>(Storage.buffer)48.9k
255
49.1k
               : 
nullptr253
;
256
49.1k
  }
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
45.4k
  bool operator<(const DynTypedNode &Other) const {
275
45.4k
    if (!NodeKind.isSame(Other.NodeKind))
276
27.8k
      return NodeKind < Other.NodeKind;
277
17.5k
278
17.5k
    if (ASTNodeKind::getFromNodeKind<QualType>().isSame(NodeKind))
279
1
      return getUnchecked<QualType>().getAsOpaquePtr() <
280
1
             Other.getUnchecked<QualType>().getAsOpaquePtr();
281
17.5k
282
17.5k
    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
17.3k
291
17.3k
    if (ASTNodeKind::getFromNodeKind<NestedNameSpecifierLoc>().isSame(
292
17.3k
            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
17.3k
301
17.3k
    assert(getMemoizationData() && Other.getMemoizationData());
302
17.3k
    return getMemoizationData() < Other.getMemoizationData();
303
17.3k
  }
304
117k
  bool operator==(const DynTypedNode &Other) const {
305
117k
    // DynTypedNode::create() stores the exact kind of the node in NodeKind.
306
117k
    // If they contain the same node, their NodeKind must be the same.
307
117k
    if (!NodeKind.isSame(Other.NodeKind))
308
101k
      return false;
309
16.9k
310
16.9k
    // FIXME: Implement for other types.
311
16.9k
    if (ASTNodeKind::getFromNodeKind<QualType>().isSame(NodeKind))
312
11
      return getUnchecked<QualType>() == Other.getUnchecked<QualType>();
313
16.8k
314
16.8k
    if (ASTNodeKind::getFromNodeKind<TypeLoc>().isSame(NodeKind))
315
16.1k
      return getUnchecked<TypeLoc>() == Other.getUnchecked<TypeLoc>();
316
786
317
786
    if (ASTNodeKind::getFromNodeKind<NestedNameSpecifierLoc>().isSame(NodeKind))
318
133
      return getUnchecked<NestedNameSpecifierLoc>() ==
319
133
             Other.getUnchecked<NestedNameSpecifierLoc>();
320
653
321
653
    assert(getMemoizationData() && Other.getMemoizationData());
322
653
    return getMemoizationData() == Other.getMemoizationData();
323
653
  }
324
536
  bool operator!=(const DynTypedNode &Other) const {
325
536
    return !operator==(Other);
326
536
  }
327
  /// @}
328
329
  /// Hooks for using DynTypedNode as a key in a DenseMap.
330
  struct DenseMapInfo {
331
51.7k
    static inline DynTypedNode getEmptyKey() {
332
51.7k
      DynTypedNode Node;
333
51.7k
      Node.NodeKind = ASTNodeKind::DenseMapInfo::getEmptyKey();
334
51.7k
      return Node;
335
51.7k
    }
336
37.4k
    static inline DynTypedNode getTombstoneKey() {
337
37.4k
      DynTypedNode Node;
338
37.4k
      Node.NodeKind = ASTNodeKind::DenseMapInfo::getTombstoneKey();
339
37.4k
      return Node;
340
37.4k
    }
341
22.6k
    static unsigned getHashValue(const DynTypedNode &Val) {
342
22.6k
      // FIXME: Add hashing support for the remaining types.
343
22.6k
      if (ASTNodeKind::getFromNodeKind<TypeLoc>().isSame(Val.NodeKind)) {
344
21.7k
        auto TL = Val.getUnchecked<TypeLoc>();
345
21.7k
        return llvm::hash_combine(TL.getType().getAsOpaquePtr(),
346
21.7k
                                  TL.getOpaqueData());
347
21.7k
      }
348
909
349
909
      if (ASTNodeKind::getFromNodeKind<NestedNameSpecifierLoc>().isSame(
350
909
              Val.NodeKind)) {
351
909
        auto NNSL = Val.getUnchecked<NestedNameSpecifierLoc>();
352
909
        return llvm::hash_combine(NNSL.getNestedNameSpecifier(),
353
909
                                  NNSL.getOpaqueData());
354
909
      }
355
0
356
0
      assert(Val.getMemoizationData());
357
0
      return llvm::hash_value(Val.getMemoizationData());
358
0
    }
359
204k
    static bool isEqual(const DynTypedNode &LHS, const DynTypedNode &RHS) {
360
204k
      auto Empty = ASTNodeKind::DenseMapInfo::getEmptyKey();
361
204k
      auto TombStone = ASTNodeKind::DenseMapInfo::getTombstoneKey();
362
204k
      return (ASTNodeKind::DenseMapInfo::isEqual(LHS.NodeKind, Empty) &&
363
204k
              
ASTNodeKind::DenseMapInfo::isEqual(RHS.NodeKind, Empty)86.9k
) ||
364
204k
             
(117k
ASTNodeKind::DenseMapInfo::isEqual(LHS.NodeKind, TombStone)117k
&&
365
117k
              
ASTNodeKind::DenseMapInfo::isEqual(RHS.NodeKind, TombStone)0
) ||
366
204k
             
LHS == RHS117k
;
367
204k
    }
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
107k
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
107k
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
62.7k
        return &getUnchecked(NodeKind, Storage);
379
45.0k
      return nullptr;
380
45.0k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::FunctionDecl, clang::Decl>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
376
730
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
730
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
700
        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
38.7k
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
38.7k
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
31.4k
        return &getUnchecked(NodeKind, Storage);
379
7.31k
      return nullptr;
380
7.31k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::Expr, clang::Stmt>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
376
498
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
498
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
498
        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
62.7k
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
62.7k
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
28.7k
        return &getUnchecked(NodeKind, Storage);
379
34.0k
      return nullptr;
380
34.0k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::ParmVarDecl, clang::Decl>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
376
81
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
81
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
81
        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::ObjCMessageExpr, clang::Stmt>::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
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::ObjCAutoreleasePoolStmt, clang::Stmt>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
376
12
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
12
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
12
        return &getUnchecked(NodeKind, Storage);
379
0
      return nullptr;
380
0
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::ObjCIvarRefExpr, clang::Stmt>::get(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
376
2
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
2
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
2
        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
270
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
270
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
270
        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
4.20k
    static const T *get(ASTNodeKind NodeKind, const char Storage[]) {
377
4.20k
      if (ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind))
378
545
        return &getUnchecked(NodeKind, Storage);
379
3.66k
      return nullptr;
380
3.66k
    }
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
107k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
107k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
107k
      return *cast<T>(static_cast<const BaseT *>(
384
107k
          *reinterpret_cast<const void *const *>(Storage)));
385
107k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::CallExpr, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
3.48k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
3.48k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
3.48k
      return *cast<T>(static_cast<const BaseT *>(
384
3.48k
          *reinterpret_cast<const void *const *>(Storage)));
385
3.48k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::Expr, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
5.90k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
5.90k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
5.90k
      return *cast<T>(static_cast<const BaseT *>(
384
5.90k
          *reinterpret_cast<const void *const *>(Storage)));
385
5.90k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::FunctionDecl, clang::Decl>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
2.12k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
2.12k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
2.12k
      return *cast<T>(static_cast<const BaseT *>(
384
2.12k
          *reinterpret_cast<const void *const *>(Storage)));
385
2.12k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::LambdaExpr, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
10
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
10
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
10
      return *cast<T>(static_cast<const BaseT *>(
384
10
          *reinterpret_cast<const void *const *>(Storage)));
385
10
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::CXXRecordDecl, clang::Decl>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
1.25k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
1.25k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
1.25k
      return *cast<T>(static_cast<const BaseT *>(
384
1.25k
          *reinterpret_cast<const void *const *>(Storage)));
385
1.25k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::CXXMemberCallExpr, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
86
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
86
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
86
      return *cast<T>(static_cast<const BaseT *>(
384
86
          *reinterpret_cast<const void *const *>(Storage)));
385
86
    }
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
2.61k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
2.61k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
2.61k
      return *cast<T>(static_cast<const BaseT *>(
384
2.61k
          *reinterpret_cast<const void *const *>(Storage)));
385
2.61k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::BinaryOperator, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
2.72k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
2.72k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
2.72k
      return *cast<T>(static_cast<const BaseT *>(
384
2.72k
          *reinterpret_cast<const void *const *>(Storage)));
385
2.72k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::DeclRefExpr, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
1.34k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
1.34k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
1.34k
      return *cast<T>(static_cast<const BaseT *>(
384
1.34k
          *reinterpret_cast<const void *const *>(Storage)));
385
1.34k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::Stmt, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
37.4k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
37.4k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
37.4k
      return *cast<T>(static_cast<const BaseT *>(
384
37.4k
          *reinterpret_cast<const void *const *>(Storage)));
385
37.4k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::ObjCMessageExpr, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
249
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
249
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
249
      return *cast<T>(static_cast<const BaseT *>(
384
249
          *reinterpret_cast<const void *const *>(Storage)));
385
249
    }
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
165
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
165
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
165
      return *cast<T>(static_cast<const BaseT *>(
384
165
          *reinterpret_cast<const void *const *>(Storage)));
385
165
    }
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
1.07k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
1.07k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
1.07k
      return *cast<T>(static_cast<const BaseT *>(
384
1.07k
          *reinterpret_cast<const void *const *>(Storage)));
385
1.07k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::NamedDecl, clang::Decl>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
10.6k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
10.6k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
10.6k
      return *cast<T>(static_cast<const BaseT *>(
384
10.6k
          *reinterpret_cast<const void *const *>(Storage)));
385
10.6k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::IfStmt, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
206
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
206
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
206
      return *cast<T>(static_cast<const BaseT *>(
384
206
          *reinterpret_cast<const void *const *>(Storage)));
385
206
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::AbstractConditionalOperator, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
65
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
65
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
65
      return *cast<T>(static_cast<const BaseT *>(
384
65
          *reinterpret_cast<const void *const *>(Storage)));
385
65
    }
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.68k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
2.68k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
2.68k
      return *cast<T>(static_cast<const BaseT *>(
384
2.68k
          *reinterpret_cast<const void *const *>(Storage)));
385
2.68k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::ExplicitCastExpr, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
323
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
323
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
323
      return *cast<T>(static_cast<const BaseT *>(
384
323
          *reinterpret_cast<const void *const *>(Storage)));
385
323
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::DeclStmt, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
347
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
347
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
347
      return *cast<T>(static_cast<const BaseT *>(
384
347
          *reinterpret_cast<const void *const *>(Storage)));
385
347
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::Decl, clang::Decl>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
29.9k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
29.9k
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
29.9k
      return *cast<T>(static_cast<const BaseT *>(
384
29.9k
          *reinterpret_cast<const void *const *>(Storage)));
385
29.9k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::ParmVarDecl, clang::Decl>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
400
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
400
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
400
      return *cast<T>(static_cast<const BaseT *>(
384
400
          *reinterpret_cast<const void *const *>(Storage)));
385
400
    }
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::ObjCAutoreleasePoolStmt, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
30
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
30
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
30
      return *cast<T>(static_cast<const BaseT *>(
384
30
          *reinterpret_cast<const void *const *>(Storage)));
385
30
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::ObjCIvarRefExpr, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
8
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
8
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
8
      return *cast<T>(static_cast<const BaseT *>(
384
8
          *reinterpret_cast<const void *const *>(Storage)));
385
8
    }
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
507
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
507
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
507
      return *cast<T>(static_cast<const BaseT *>(
384
507
          *reinterpret_cast<const void *const *>(Storage)));
385
507
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::CXXConstructExpr, clang::Stmt>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
381
344
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
344
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
344
      return *cast<T>(static_cast<const BaseT *>(
384
344
          *reinterpret_cast<const void *const *>(Storage)));
385
344
    }
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
837
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
382
837
      assert(ASTNodeKind::getFromNodeKind<T>().isBaseOf(NodeKind));
383
837
      return *cast<T>(static_cast<const BaseT *>(
384
837
          *reinterpret_cast<const void *const *>(Storage)));
385
837
    }
386
213k
    static DynTypedNode create(const BaseT &Node) {
387
213k
      DynTypedNode Result;
388
213k
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
213k
      new (Result.Storage.buffer) const void *(&Node);
390
213k
      return Result;
391
213k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::Expr, clang::Stmt>::create(clang::Stmt const&)
Line
Count
Source
386
6.84k
    static DynTypedNode create(const BaseT &Node) {
387
6.84k
      DynTypedNode Result;
388
6.84k
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
6.84k
      new (Result.Storage.buffer) const void *(&Node);
390
6.84k
      return Result;
391
6.84k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::ClassTemplateDecl, clang::Decl>::create(clang::Decl const&)
Line
Count
Source
386
102
    static DynTypedNode create(const BaseT &Node) {
387
102
      DynTypedNode Result;
388
102
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
102
      new (Result.Storage.buffer) const void *(&Node);
390
102
      return Result;
391
102
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::Decl, clang::Decl>::create(clang::Decl const&)
Line
Count
Source
386
78.3k
    static DynTypedNode create(const BaseT &Node) {
387
78.3k
      DynTypedNode Result;
388
78.3k
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
78.3k
      new (Result.Storage.buffer) const void *(&Node);
390
78.3k
      return Result;
391
78.3k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::Stmt, clang::Stmt>::create(clang::Stmt const&)
Line
Count
Source
386
107k
    static DynTypedNode create(const BaseT &Node) {
387
107k
      DynTypedNode Result;
388
107k
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
107k
      new (Result.Storage.buffer) const void *(&Node);
390
107k
      return Result;
391
107k
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::VarDecl, clang::Decl>::create(clang::Decl const&)
Line
Count
Source
386
544
    static DynTypedNode create(const BaseT &Node) {
387
544
      DynTypedNode Result;
388
544
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
544
      new (Result.Storage.buffer) const void *(&Node);
390
544
      return Result;
391
544
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::CXXRecordDecl, clang::Decl>::create(clang::Decl const&)
Line
Count
Source
386
694
    static DynTypedNode create(const BaseT &Node) {
387
694
      DynTypedNode Result;
388
694
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
694
      new (Result.Storage.buffer) const void *(&Node);
390
694
      return Result;
391
694
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::NamedDecl, clang::Decl>::create(clang::Decl const&)
Line
Count
Source
386
316
    static DynTypedNode create(const BaseT &Node) {
387
316
      DynTypedNode Result;
388
316
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
316
      new (Result.Storage.buffer) const void *(&Node);
390
316
      return Result;
391
316
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::Type, clang::Type>::create(clang::Type const&)
Line
Count
Source
386
16.8k
    static DynTypedNode create(const BaseT &Node) {
387
16.8k
      DynTypedNode Result;
388
16.8k
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
16.8k
      new (Result.Storage.buffer) const void *(&Node);
390
16.8k
      return Result;
391
16.8k
    }
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
129
    static DynTypedNode create(const BaseT &Node) {
387
129
      DynTypedNode Result;
388
129
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
129
      new (Result.Storage.buffer) const void *(&Node);
390
129
      return Result;
391
129
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::CXXMethodDecl, clang::Decl>::create(clang::Decl const&)
Line
Count
Source
386
280
    static DynTypedNode create(const BaseT &Node) {
387
280
      DynTypedNode Result;
388
280
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
280
      new (Result.Storage.buffer) const void *(&Node);
390
280
      return Result;
391
280
    }
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
386
    static DynTypedNode create(const BaseT &Node) {
387
386
      DynTypedNode Result;
388
386
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
386
      new (Result.Storage.buffer) const void *(&Node);
390
386
      return Result;
391
386
    }
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
15
    static DynTypedNode create(const BaseT &Node) {
387
15
      DynTypedNode Result;
388
15
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
15
      new (Result.Storage.buffer) const void *(&Node);
390
15
      return Result;
391
15
    }
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
401
    static DynTypedNode create(const BaseT &Node) {
387
401
      DynTypedNode Result;
388
401
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
401
      new (Result.Storage.buffer) const void *(&Node);
390
401
      return Result;
391
401
    }
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::ObjCMessageExpr, clang::Stmt>::create(clang::Stmt const&)
Line
Count
Source
386
30
    static DynTypedNode create(const BaseT &Node) {
387
30
      DynTypedNode Result;
388
30
      Result.NodeKind = ASTNodeKind::getFromNode(Node);
389
30
      new (Result.Storage.buffer) const void *(&Node);
390
30
      return Result;
391
30
    }
clang::ast_type_traits::DynTypedNode::DynCastPtrConverter<clang::ObjCAutoreleasePoolStmt, 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::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
627
    static DynTypedNode create(const T &Node) {
407
627
      DynTypedNode Result;
408
627
      Result.NodeKind = ASTNodeKind::getFromNodeKind<T>();
409
627
      new (Result.Storage.buffer) const void *(&Node);
410
627
      return Result;
411
627
    }
clang::ast_type_traits::DynTypedNode::PtrConverter<clang::NestedNameSpecifier>::create(clang::NestedNameSpecifier const&)
Line
Count
Source
406
444
    static DynTypedNode create(const T &Node) {
407
444
      DynTypedNode Result;
408
444
      Result.NodeKind = ASTNodeKind::getFromNodeKind<T>();
409
444
      new (Result.Storage.buffer) const void *(&Node);
410
444
      return Result;
411
444
    }
clang::ast_type_traits::DynTypedNode::PtrConverter<clang::CXXCtorInitializer>::create(clang::CXXCtorInitializer const&)
Line
Count
Source
406
183
    static DynTypedNode create(const T &Node) {
407
183
      DynTypedNode Result;
408
183
      Result.NodeKind = ASTNodeKind::getFromNodeKind<T>();
409
183
      new (Result.Storage.buffer) const void *(&Node);
410
183
      return Result;
411
183
    }
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
65.0k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
422
65.0k
      assert(ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind));
423
65.0k
      return *reinterpret_cast<const T *>(Storage);
424
65.0k
    }
clang::ast_type_traits::DynTypedNode::ValueConverter<clang::QualType>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
421
9.40k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
422
9.40k
      assert(ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind));
423
9.40k
      return *reinterpret_cast<const T *>(Storage);
424
9.40k
    }
clang::ast_type_traits::DynTypedNode::ValueConverter<clang::TypeLoc>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
421
54.4k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
422
54.4k
      assert(ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind));
423
54.4k
      return *reinterpret_cast<const T *>(Storage);
424
54.4k
    }
clang::ast_type_traits::DynTypedNode::ValueConverter<clang::NestedNameSpecifierLoc>::getUnchecked(clang::ast_type_traits::ASTNodeKind, char const*)
Line
Count
Source
421
1.24k
    static const T &getUnchecked(ASTNodeKind NodeKind, const char Storage[]) {
422
1.24k
      assert(ASTNodeKind::getFromNodeKind<T>().isSame(NodeKind));
423
1.24k
      return *reinterpret_cast<const T *>(Storage);
424
1.24k
    }
425
72.3k
    static DynTypedNode create(const T &Node) {
426
72.3k
      DynTypedNode Result;
427
72.3k
      Result.NodeKind = ASTNodeKind::getFromNodeKind<T>();
428
72.3k
      new (Result.Storage.buffer) T(Node);
429
72.3k
      return Result;
430
72.3k
    }
clang::ast_type_traits::DynTypedNode::ValueConverter<clang::QualType>::create(clang::QualType const&)
Line
Count
Source
425
19.4k
    static DynTypedNode create(const T &Node) {
426
19.4k
      DynTypedNode Result;
427
19.4k
      Result.NodeKind = ASTNodeKind::getFromNodeKind<T>();
428
19.4k
      new (Result.Storage.buffer) T(Node);
429
19.4k
      return Result;
430
19.4k
    }
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
41.0k
    static DynTypedNode create(const T &Node) {
426
41.0k
      DynTypedNode Result;
427
41.0k
      Result.NodeKind = ASTNodeKind::getFromNodeKind<T>();
428
41.0k
      new (Result.Storage.buffer) T(Node);
429
41.0k
      return Result;
430
41.0k
    }
clang::ast_type_traits::DynTypedNode::ValueConverter<clang::NestedNameSpecifierLoc>::create(clang::NestedNameSpecifierLoc const&)
Line
Count
Source
425
11.8k
    static DynTypedNode create(const T &Node) {
426
11.8k
      DynTypedNode Result;
427
11.8k
      Result.NodeKind = ASTNodeKind::getFromNodeKind<T>();
428
11.8k
      new (Result.Storage.buffer) T(Node);
429
11.8k
      return Result;
430
11.8k
    }
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