Coverage Report

Created: 2019-02-23 12:57

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