Coverage Report

Created: 2017-10-03 07:32

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/tools/clang/include/clang/AST/Redeclarable.h
Line
Count
Source (jump to first uncovered line)
1
//===-- Redeclarable.h - Base for Decls that can be redeclared -*- C++ -*-====//
2
//
3
//                     The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
//
10
//  This file defines the Redeclarable interface.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#ifndef LLVM_CLANG_AST_REDECLARABLE_H
15
#define LLVM_CLANG_AST_REDECLARABLE_H
16
17
#include "clang/AST/ExternalASTSource.h"
18
#include "llvm/Support/Casting.h"
19
#include <iterator>
20
21
namespace clang {
22
class ASTContext;
23
24
// Some notes on redeclarables:
25
//
26
//  - Every redeclarable is on a circular linked list.
27
//
28
//  - Every decl has a pointer to the first element of the chain _and_ a
29
//    DeclLink that may point to one of 3 possible states:
30
//      - the "previous" (temporal) element in the chain
31
//      - the "latest" (temporal) element in the chain
32
//      - the an "uninitialized-latest" value (when newly-constructed)
33
//
34
//  - The first element is also often called the canonical element. Every
35
//    element has a pointer to it so that "getCanonical" can be fast.
36
//
37
//  - Most links in the chain point to previous, except the link out of
38
//    the first; it points to latest.
39
//
40
//  - Elements are called "first", "previous", "latest" or
41
//    "most-recent" when referring to temporal order: order of addition
42
//    to the chain.
43
//
44
//  - To make matters confusing, the DeclLink type uses the term "next"
45
//    for its pointer-storage internally (thus functions like
46
//    NextIsPrevious). It's easiest to just ignore the implementation of
47
//    DeclLink when making sense of the redeclaration chain.
48
//
49
//  - There's also a "definition" link for several types of
50
//    redeclarable, where only one definition should exist at any given
51
//    time (and the defn pointer is stored in the decl's "data" which
52
//    is copied to every element on the chain when it's changed).
53
//
54
//    Here is some ASCII art:
55
//
56
//      "first"                                     "latest"
57
//      "canonical"                                 "most recent"
58
//      +------------+         first                +--------------+
59
//      |            | <--------------------------- |              |
60
//      |            |                              |              |
61
//      |            |                              |              |
62
//      |            |       +--------------+       |              |
63
//      |            | first |              |       |              |
64
//      |            | <---- |              |       |              |
65
//      |            |       |              |       |              |
66
//      | @class A   |  link | @interface A |  link | @class A     |
67
//      | seen first | <---- | seen second  | <---- | seen third   |
68
//      |            |       |              |       |              |
69
//      +------------+       +--------------+       +--------------+
70
//      | data       | defn  | data         |  defn | data         |
71
//      |            | ----> |              | <---- |              |
72
//      +------------+       +--------------+       +--------------+
73
//        |                     |     ^                  ^
74
//        |                     |defn |                  |
75
//        | link                +-----+                  |
76
//        +-->-------------------------------------------+
77
78
/// \brief Provides common interface for the Decls that can be redeclared.
79
template<typename decl_type>
80
class Redeclarable {
81
protected:
82
  class DeclLink {
83
    /// A pointer to a known latest declaration, either statically known or
84
    /// generationally updated as decls are added by an external source.
85
    typedef LazyGenerationalUpdatePtr<const Decl*, Decl*,
86
                                      &ExternalASTSource::CompleteRedeclChain>
87
                                          KnownLatest;
88
89
    /// We store a pointer to the ASTContext in the UninitializedLatest
90
    /// pointer, but to avoid circular type dependencies when we steal the low
91
    /// bits of this pointer, we use a raw void* here.
92
    typedef const void *UninitializedLatest;
93
94
    typedef Decl *Previous;
95
96
    /// A pointer to either an uninitialized latest declaration (where either
97
    /// we've not yet set the previous decl or there isn't one), or to a known
98
    /// previous declaration.
99
    typedef llvm::PointerUnion<Previous, UninitializedLatest> NotKnownLatest;
100
101
    mutable llvm::PointerUnion<NotKnownLatest, KnownLatest> Next;
102
103
  public:
104
    enum PreviousTag { PreviousLink };
105
    enum LatestTag { LatestLink };
106
107
    DeclLink(LatestTag, const ASTContext &Ctx)
108
17.9M
        : Next(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::TagDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::TagDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
108
990k
        : Next(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::FunctionDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::FunctionDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
108
4.82M
        : Next(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
108
1.25M
        : Next(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::VarDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::VarDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
108
10.7M
        : Next(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
108
138
        : Next(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::NamespaceDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
108
37.2k
        : Next(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
108
3.29k
        : Next(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
108
43.1k
        : Next(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
108
5.38k
        : Next(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
108
71.3k
        : Next(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
109
    DeclLink(PreviousTag, decl_type *D)
110
597k
        : Next(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::PreviousTag, clang::TypedefNameDecl*)
Line
Count
Source
110
8.24k
        : Next(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::TagDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::TagDecl>::DeclLink::PreviousTag, clang::TagDecl*)
Line
Count
Source
110
62.5k
        : Next(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::FunctionDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::FunctionDecl>::DeclLink::PreviousTag, clang::FunctionDecl*)
Line
Count
Source
110
482k
        : Next(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::PreviousTag, clang::ObjCInterfaceDecl*)
Line
Count
Source
110
16.6k
        : Next(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::PreviousTag, clang::ObjCProtocolDecl*)
Line
Count
Source
110
911
        : Next(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::VarDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::VarDecl>::DeclLink::PreviousTag, clang::VarDecl*)
Line
Count
Source
110
10.1k
        : Next(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::NamespaceDecl>::DeclLink::PreviousTag, clang::NamespaceDecl*)
Line
Count
Source
110
12.6k
        : Next(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::PreviousTag, clang::NamespaceAliasDecl*)
Line
Count
Source
110
7
        : Next(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::PreviousTag, clang::UsingShadowDecl*)
Line
Count
Source
110
71
        : Next(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::PreviousTag, clang::RedeclarableTemplateDecl*)
Line
Count
Source
110
3.51k
        : Next(NotKnownLatest(Previous(D))) {}
111
112
71.3M
    bool NextIsPrevious() const {
113
71.3M
      return Next.is<NotKnownLatest>() &&
114
71.3M
             // FIXME: 'template' is required on the next line due to an
115
71.3M
             // apparent clang bug.
116
26.6M
             Next.get<NotKnownLatest>().template is<Previous>();
117
71.3M
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::NextIsPrevious() const
Line
Count
Source
112
5.61k
    bool NextIsPrevious() const {
113
5.61k
      return Next.is<NotKnownLatest>() &&
114
5.61k
             // FIXME: 'template' is required on the next line due to an
115
5.61k
             // apparent clang bug.
116
1.12k
             Next.get<NotKnownLatest>().template is<Previous>();
117
5.61k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::NextIsPrevious() const
Line
Count
Source
112
3.94M
    bool NextIsPrevious() const {
113
3.94M
      return Next.is<NotKnownLatest>() &&
114
3.94M
             // FIXME: 'template' is required on the next line due to an
115
3.94M
             // apparent clang bug.
116
1.53M
             Next.get<NotKnownLatest>().template is<Previous>();
117
3.94M
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::NextIsPrevious() const
Line
Count
Source
112
976
    bool NextIsPrevious() const {
113
976
      return Next.is<NotKnownLatest>() &&
114
976
             // FIXME: 'template' is required on the next line due to an
115
976
             // apparent clang bug.
116
375
             Next.get<NotKnownLatest>().template is<Previous>();
117
976
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::NextIsPrevious() const
Line
Count
Source
112
30.7k
    bool NextIsPrevious() const {
113
30.7k
      return Next.is<NotKnownLatest>() &&
114
30.7k
             // FIXME: 'template' is required on the next line due to an
115
30.7k
             // apparent clang bug.
116
10.3k
             Next.get<NotKnownLatest>().template is<Previous>();
117
30.7k
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::NextIsPrevious() const
Line
Count
Source
112
32.0k
    bool NextIsPrevious() const {
113
32.0k
      return Next.is<NotKnownLatest>() &&
114
32.0k
             // FIXME: 'template' is required on the next line due to an
115
32.0k
             // apparent clang bug.
116
19.0k
             Next.get<NotKnownLatest>().template is<Previous>();
117
32.0k
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::NextIsPrevious() const
Line
Count
Source
112
92.0k
    bool NextIsPrevious() const {
113
92.0k
      return Next.is<NotKnownLatest>() &&
114
92.0k
             // FIXME: 'template' is required on the next line due to an
115
92.0k
             // apparent clang bug.
116
46.9k
             Next.get<NotKnownLatest>().template is<Previous>();
117
92.0k
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::NextIsPrevious() const
Line
Count
Source
112
14.7M
    bool NextIsPrevious() const {
113
14.7M
      return Next.is<NotKnownLatest>() &&
114
14.7M
             // FIXME: 'template' is required on the next line due to an
115
14.7M
             // apparent clang bug.
116
5.07M
             Next.get<NotKnownLatest>().template is<Previous>();
117
14.7M
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::NextIsPrevious() const
Line
Count
Source
112
7.75M
    bool NextIsPrevious() const {
113
7.75M
      return Next.is<NotKnownLatest>() &&
114
7.75M
             // FIXME: 'template' is required on the next line due to an
115
7.75M
             // apparent clang bug.
116
419k
             Next.get<NotKnownLatest>().template is<Previous>();
117
7.75M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::NextIsPrevious() const
Line
Count
Source
112
44.7M
    bool NextIsPrevious() const {
113
44.7M
      return Next.is<NotKnownLatest>() &&
114
44.7M
             // FIXME: 'template' is required on the next line due to an
115
44.7M
             // apparent clang bug.
116
19.5M
             Next.get<NotKnownLatest>().template is<Previous>();
117
44.7M
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::NextIsPrevious() const
Line
Count
Source
112
11
    bool NextIsPrevious() const {
113
11
      return Next.is<NotKnownLatest>() &&
114
11
             // FIXME: 'template' is required on the next line due to an
115
11
             // apparent clang bug.
116
11
             Next.get<NotKnownLatest>().template is<Previous>();
117
11
    }
118
119
65.1M
    bool NextIsLatest() const { return !NextIsPrevious(); }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::NextIsLatest() const
Line
Count
Source
119
7
    bool NextIsLatest() const { return !NextIsPrevious(); }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::NextIsLatest() const
Line
Count
Source
119
4.88k
    bool NextIsLatest() const { return !NextIsPrevious(); }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::NextIsLatest() const
Line
Count
Source
119
44.7M
    bool NextIsLatest() const { return !NextIsPrevious(); }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::NextIsLatest() const
Line
Count
Source
119
5.06k
    bool NextIsLatest() const { return !NextIsPrevious(); }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::NextIsLatest() const
Line
Count
Source
119
22.2k
    bool NextIsLatest() const { return !NextIsPrevious(); }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::NextIsLatest() const
Line
Count
Source
119
900
    bool NextIsLatest() const { return !NextIsPrevious(); }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::NextIsLatest() const
Line
Count
Source
119
7.05k
    bool NextIsLatest() const { return !NextIsPrevious(); }
clang::Redeclarable<clang::VarDecl>::DeclLink::NextIsLatest() const
Line
Count
Source
119
3.51M
    bool NextIsLatest() const { return !NextIsPrevious(); }
clang::Redeclarable<clang::TagDecl>::DeclLink::NextIsLatest() const
Line
Count
Source
119
6.96M
    bool NextIsLatest() const { return !NextIsPrevious(); }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::NextIsLatest() const
Line
Count
Source
119
9.88M
    bool NextIsLatest() const { return !NextIsPrevious(); }
120
121
124M
    decl_type *getNext(const decl_type *D) const {
122
124M
      if (
Next.is<NotKnownLatest>()124M
) {
123
11.8M
        NotKnownLatest NKL = Next.get<NotKnownLatest>();
124
11.8M
        if (NKL.is<Previous>())
125
1.64M
          return static_cast<decl_type*>(NKL.get<Previous>());
126
11.8M
127
11.8M
        // Allocate the generational 'most recent' cache now, if needed.
128
10.2M
        Next = KnownLatest(*reinterpret_cast<const ASTContext *>(
129
10.2M
                               NKL.get<UninitializedLatest>()),
130
10.2M
                           const_cast<decl_type *>(D));
131
10.2M
      }
132
124M
133
123M
      return static_cast<decl_type*>(Next.get<KnownLatest>().get(D));
134
124M
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::getNext(clang::NamespaceAliasDecl const*) const
Line
Count
Source
121
121
    decl_type *getNext(const decl_type *D) const {
122
121
      if (
Next.is<NotKnownLatest>()121
) {
123
41
        NotKnownLatest NKL = Next.get<NotKnownLatest>();
124
41
        if (NKL.is<Previous>())
125
1
          return static_cast<decl_type*>(NKL.get<Previous>());
126
41
127
41
        // Allocate the generational 'most recent' cache now, if needed.
128
40
        Next = KnownLatest(*reinterpret_cast<const ASTContext *>(
129
40
                               NKL.get<UninitializedLatest>()),
130
40
                           const_cast<decl_type *>(D));
131
40
      }
132
121
133
120
      return static_cast<decl_type*>(Next.get<KnownLatest>().get(D));
134
121
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::getNext(clang::FunctionDecl const*) const
Line
Count
Source
121
23.7M
    decl_type *getNext(const decl_type *D) const {
122
23.7M
      if (
Next.is<NotKnownLatest>()23.7M
) {
123
5.26M
        NotKnownLatest NKL = Next.get<NotKnownLatest>();
124
5.26M
        if (NKL.is<Previous>())
125
1.08M
          return static_cast<decl_type*>(NKL.get<Previous>());
126
5.26M
127
5.26M
        // Allocate the generational 'most recent' cache now, if needed.
128
4.17M
        Next = KnownLatest(*reinterpret_cast<const ASTContext *>(
129
4.17M
                               NKL.get<UninitializedLatest>()),
130
4.17M
                           const_cast<decl_type *>(D));
131
4.17M
      }
132
23.7M
133
22.6M
      return static_cast<decl_type*>(Next.get<KnownLatest>().get(D));
134
23.7M
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::getNext(clang::RedeclarableTemplateDecl const*) const
Line
Count
Source
121
324k
    decl_type *getNext(const decl_type *D) const {
122
324k
      if (
Next.is<NotKnownLatest>()324k
) {
123
35.3k
        NotKnownLatest NKL = Next.get<NotKnownLatest>();
124
35.3k
        if (NKL.is<Previous>())
125
7.33k
          return static_cast<decl_type*>(NKL.get<Previous>());
126
35.3k
127
35.3k
        // Allocate the generational 'most recent' cache now, if needed.
128
28.0k
        Next = KnownLatest(*reinterpret_cast<const ASTContext *>(
129
28.0k
                               NKL.get<UninitializedLatest>()),
130
28.0k
                           const_cast<decl_type *>(D));
131
28.0k
      }
132
324k
133
317k
      return static_cast<decl_type*>(Next.get<KnownLatest>().get(D));
134
324k
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::getNext(clang::TypedefNameDecl const*) const
Line
Count
Source
121
170k
    decl_type *getNext(const decl_type *D) const {
122
170k
      if (
Next.is<NotKnownLatest>()170k
) {
123
56.9k
        NotKnownLatest NKL = Next.get<NotKnownLatest>();
124
56.9k
        if (NKL.is<Previous>())
125
9.54k
          return static_cast<decl_type*>(NKL.get<Previous>());
126
56.9k
127
56.9k
        // Allocate the generational 'most recent' cache now, if needed.
128
47.3k
        Next = KnownLatest(*reinterpret_cast<const ASTContext *>(
129
47.3k
                               NKL.get<UninitializedLatest>()),
130
47.3k
                           const_cast<decl_type *>(D));
131
47.3k
      }
132
170k
133
160k
      return static_cast<decl_type*>(Next.get<KnownLatest>().get(D));
134
170k
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::getNext(clang::ObjCInterfaceDecl const*) const
Line
Count
Source
121
91.8k
    decl_type *getNext(const decl_type *D) const {
122
91.8k
      if (
Next.is<NotKnownLatest>()91.8k
) {
123
44.0k
        NotKnownLatest NKL = Next.get<NotKnownLatest>();
124
44.0k
        if (NKL.is<Previous>())
125
44.0k
          return static_cast<decl_type*>(NKL.get<Previous>());
126
44.0k
127
44.0k
        // Allocate the generational 'most recent' cache now, if needed.
128
0
        Next = KnownLatest(*reinterpret_cast<const ASTContext *>(
129
0
                               NKL.get<UninitializedLatest>()),
130
0
                           const_cast<decl_type *>(D));
131
0
      }
132
91.8k
133
47.7k
      return static_cast<decl_type*>(Next.get<KnownLatest>().get(D));
134
91.8k
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::getNext(clang::UsingShadowDecl const*) const
Line
Count
Source
121
7.10k
    decl_type *getNext(const decl_type *D) const {
122
7.10k
      if (
Next.is<NotKnownLatest>()7.10k
) {
123
117
        NotKnownLatest NKL = Next.get<NotKnownLatest>();
124
117
        if (NKL.is<Previous>())
125
117
          return static_cast<decl_type*>(NKL.get<Previous>());
126
117
127
117
        // Allocate the generational 'most recent' cache now, if needed.
128
0
        Next = KnownLatest(*reinterpret_cast<const ASTContext *>(
129
0
                               NKL.get<UninitializedLatest>()),
130
0
                           const_cast<decl_type *>(D));
131
0
      }
132
7.10k
133
6.98k
      return static_cast<decl_type*>(Next.get<KnownLatest>().get(D));
134
7.10k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::getNext(clang::VarDecl const*) const
Line
Count
Source
121
21.5M
    decl_type *getNext(const decl_type *D) const {
122
21.5M
      if (
Next.is<NotKnownLatest>()21.5M
) {
123
6.00M
        NotKnownLatest NKL = Next.get<NotKnownLatest>();
124
6.00M
        if (NKL.is<Previous>())
125
58.0k
          return static_cast<decl_type*>(NKL.get<Previous>());
126
6.00M
127
6.00M
        // Allocate the generational 'most recent' cache now, if needed.
128
5.94M
        Next = KnownLatest(*reinterpret_cast<const ASTContext *>(
129
5.94M
                               NKL.get<UninitializedLatest>()),
130
5.94M
                           const_cast<decl_type *>(D));
131
5.94M
      }
132
21.5M
133
21.4M
      return static_cast<decl_type*>(Next.get<KnownLatest>().get(D));
134
21.5M
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::getNext(clang::ObjCProtocolDecl const*) const
Line
Count
Source
121
9.08k
    decl_type *getNext(const decl_type *D) const {
122
9.08k
      if (
Next.is<NotKnownLatest>()9.08k
) {
123
1.39k
        NotKnownLatest NKL = Next.get<NotKnownLatest>();
124
1.39k
        if (NKL.is<Previous>())
125
1.39k
          return static_cast<decl_type*>(NKL.get<Previous>());
126
1.39k
127
1.39k
        // Allocate the generational 'most recent' cache now, if needed.
128
0
        Next = KnownLatest(*reinterpret_cast<const ASTContext *>(
129
0
                               NKL.get<UninitializedLatest>()),
130
0
                           const_cast<decl_type *>(D));
131
0
      }
132
9.08k
133
7.69k
      return static_cast<decl_type*>(Next.get<KnownLatest>().get(D));
134
9.08k
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::getNext(clang::NamespaceDecl const*) const
Line
Count
Source
121
76.8k
    decl_type *getNext(const decl_type *D) const {
122
76.8k
      if (
Next.is<NotKnownLatest>()76.8k
) {
123
7.68k
        NotKnownLatest NKL = Next.get<NotKnownLatest>();
124
7.68k
        if (NKL.is<Previous>())
125
7.68k
          return static_cast<decl_type*>(NKL.get<Previous>());
126
7.68k
127
7.68k
        // Allocate the generational 'most recent' cache now, if needed.
128
0
        Next = KnownLatest(*reinterpret_cast<const ASTContext *>(
129
0
                               NKL.get<UninitializedLatest>()),
130
0
                           const_cast<decl_type *>(D));
131
0
      }
132
76.8k
133
69.1k
      return static_cast<decl_type*>(Next.get<KnownLatest>().get(D));
134
76.8k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::getNext(clang::TagDecl const*) const
Line
Count
Source
121
78.9M
    decl_type *getNext(const decl_type *D) const {
122
78.9M
      if (
Next.is<NotKnownLatest>()78.9M
) {
123
430k
        NotKnownLatest NKL = Next.get<NotKnownLatest>();
124
430k
        if (NKL.is<Previous>())
125
430k
          return static_cast<decl_type*>(NKL.get<Previous>());
126
430k
127
430k
        // Allocate the generational 'most recent' cache now, if needed.
128
0
        Next = KnownLatest(*reinterpret_cast<const ASTContext *>(
129
0
                               NKL.get<UninitializedLatest>()),
130
0
                           const_cast<decl_type *>(D));
131
0
      }
132
78.9M
133
78.4M
      return static_cast<decl_type*>(Next.get<KnownLatest>().get(D));
134
78.9M
    }
135
136
7.48k
    void setPrevious(decl_type *D) {
137
7.48k
      assert(NextIsPrevious() && "decl became non-canonical unexpectedly");
138
7.48k
      Next = Previous(D);
139
7.48k
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::setPrevious(clang::ObjCInterfaceDecl*)
Line
Count
Source
136
107
    void setPrevious(decl_type *D) {
137
107
      assert(NextIsPrevious() && "decl became non-canonical unexpectedly");
138
107
      Next = Previous(D);
139
107
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::setPrevious(clang::UsingShadowDecl*)
Line
Count
Source
136
11
    void setPrevious(decl_type *D) {
137
11
      assert(NextIsPrevious() && "decl became non-canonical unexpectedly");
138
11
      Next = Previous(D);
139
11
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::setPrevious(clang::TagDecl*)
Line
Count
Source
136
2.04k
    void setPrevious(decl_type *D) {
137
2.04k
      assert(NextIsPrevious() && "decl became non-canonical unexpectedly");
138
2.04k
      Next = Previous(D);
139
2.04k
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::setPrevious(clang::RedeclarableTemplateDecl*)
Line
Count
Source
136
554
    void setPrevious(decl_type *D) {
137
554
      assert(NextIsPrevious() && "decl became non-canonical unexpectedly");
138
554
      Next = Previous(D);
139
554
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::setPrevious(clang::ObjCProtocolDecl*)
Line
Count
Source
136
37
    void setPrevious(decl_type *D) {
137
37
      assert(NextIsPrevious() && "decl became non-canonical unexpectedly");
138
37
      Next = Previous(D);
139
37
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::setPrevious(clang::NamespaceAliasDecl*)
Line
Count
Source
136
2
    void setPrevious(decl_type *D) {
137
2
      assert(NextIsPrevious() && "decl became non-canonical unexpectedly");
138
2
      Next = Previous(D);
139
2
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::setPrevious(clang::NamespaceDecl*)
Line
Count
Source
136
328
    void setPrevious(decl_type *D) {
137
328
      assert(NextIsPrevious() && "decl became non-canonical unexpectedly");
138
328
      Next = Previous(D);
139
328
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::setPrevious(clang::FunctionDecl*)
Line
Count
Source
136
1.29k
    void setPrevious(decl_type *D) {
137
1.29k
      assert(NextIsPrevious() && "decl became non-canonical unexpectedly");
138
1.29k
      Next = Previous(D);
139
1.29k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::setPrevious(clang::VarDecl*)
Line
Count
Source
136
911
    void setPrevious(decl_type *D) {
137
911
      assert(NextIsPrevious() && "decl became non-canonical unexpectedly");
138
911
      Next = Previous(D);
139
911
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::setPrevious(clang::TypedefNameDecl*)
Line
Count
Source
136
2.18k
    void setPrevious(decl_type *D) {
137
2.18k
      assert(NextIsPrevious() && "decl became non-canonical unexpectedly");
138
2.18k
      Next = Previous(D);
139
2.18k
    }
140
141
1.66M
    void setLatest(decl_type *D) {
142
1.66M
      assert(NextIsLatest() && "decl became canonical unexpectedly");
143
1.66M
      if (
Next.is<NotKnownLatest>()1.66M
) {
144
1.05M
        NotKnownLatest NKL = Next.get<NotKnownLatest>();
145
1.05M
        Next = KnownLatest(*reinterpret_cast<const ASTContext *>(
146
1.05M
                               NKL.get<UninitializedLatest>()),
147
1.05M
                           D);
148
1.66M
      } else {
149
604k
        auto Latest = Next.get<KnownLatest>();
150
604k
        Latest.set(D);
151
604k
        Next = Latest;
152
604k
      }
153
1.66M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::setLatest(clang::NamespaceDecl*)
Line
Count
Source
141
37.9k
    void setLatest(decl_type *D) {
142
37.9k
      assert(NextIsLatest() && "decl became canonical unexpectedly");
143
37.9k
      if (
Next.is<NotKnownLatest>()37.9k
) {
144
24.9k
        NotKnownLatest NKL = Next.get<NotKnownLatest>();
145
24.9k
        Next = KnownLatest(*reinterpret_cast<const ASTContext *>(
146
24.9k
                               NKL.get<UninitializedLatest>()),
147
24.9k
                           D);
148
37.9k
      } else {
149
12.9k
        auto Latest = Next.get<KnownLatest>();
150
12.9k
        Latest.set(D);
151
12.9k
        Next = Latest;
152
12.9k
      }
153
37.9k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::setLatest(clang::VarDecl*)
Line
Count
Source
141
36.9k
    void setLatest(decl_type *D) {
142
36.9k
      assert(NextIsLatest() && "decl became canonical unexpectedly");
143
36.9k
      if (
Next.is<NotKnownLatest>()36.9k
) {
144
26.9k
        NotKnownLatest NKL = Next.get<NotKnownLatest>();
145
26.9k
        Next = KnownLatest(*reinterpret_cast<const ASTContext *>(
146
26.9k
                               NKL.get<UninitializedLatest>()),
147
26.9k
                           D);
148
36.9k
      } else {
149
10.0k
        auto Latest = Next.get<KnownLatest>();
150
10.0k
        Latest.set(D);
151
10.0k
        Next = Latest;
152
10.0k
      }
153
36.9k
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::setLatest(clang::FunctionDecl*)
Line
Count
Source
141
491k
    void setLatest(decl_type *D) {
142
491k
      assert(NextIsLatest() && "decl became canonical unexpectedly");
143
491k
      if (
Next.is<NotKnownLatest>()491k
) {
144
9.19k
        NotKnownLatest NKL = Next.get<NotKnownLatest>();
145
9.19k
        Next = KnownLatest(*reinterpret_cast<const ASTContext *>(
146
9.19k
                               NKL.get<UninitializedLatest>()),
147
9.19k
                           D);
148
491k
      } else {
149
482k
        auto Latest = Next.get<KnownLatest>();
150
482k
        Latest.set(D);
151
482k
        Next = Latest;
152
482k
      }
153
491k
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::setLatest(clang::UsingShadowDecl*)
Line
Count
Source
141
3.28k
    void setLatest(decl_type *D) {
142
3.28k
      assert(NextIsLatest() && "decl became canonical unexpectedly");
143
3.28k
      if (
Next.is<NotKnownLatest>()3.28k
) {
144
3.22k
        NotKnownLatest NKL = Next.get<NotKnownLatest>();
145
3.22k
        Next = KnownLatest(*reinterpret_cast<const ASTContext *>(
146
3.22k
                               NKL.get<UninitializedLatest>()),
147
3.22k
                           D);
148
3.28k
      } else {
149
61
        auto Latest = Next.get<KnownLatest>();
150
61
        Latest.set(D);
151
61
        Next = Latest;
152
61
      }
153
3.28k
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::setLatest(clang::TypedefNameDecl*)
Line
Count
Source
141
11.4k
    void setLatest(decl_type *D) {
142
11.4k
      assert(NextIsLatest() && "decl became canonical unexpectedly");
143
11.4k
      if (
Next.is<NotKnownLatest>()11.4k
) {
144
5.31k
        NotKnownLatest NKL = Next.get<NotKnownLatest>();
145
5.31k
        Next = KnownLatest(*reinterpret_cast<const ASTContext *>(
146
5.31k
                               NKL.get<UninitializedLatest>()),
147
5.31k
                           D);
148
11.4k
      } else {
149
6.13k
        auto Latest = Next.get<KnownLatest>();
150
6.13k
        Latest.set(D);
151
6.13k
        Next = Latest;
152
6.13k
      }
153
11.4k
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::setLatest(clang::RedeclarableTemplateDecl*)
Line
Count
Source
141
28.5k
    void setLatest(decl_type *D) {
142
28.5k
      assert(NextIsLatest() && "decl became canonical unexpectedly");
143
28.5k
      if (
Next.is<NotKnownLatest>()28.5k
) {
144
25.2k
        NotKnownLatest NKL = Next.get<NotKnownLatest>();
145
25.2k
        Next = KnownLatest(*reinterpret_cast<const ASTContext *>(
146
25.2k
                               NKL.get<UninitializedLatest>()),
147
25.2k
                           D);
148
28.5k
      } else {
149
3.36k
        auto Latest = Next.get<KnownLatest>();
150
3.36k
        Latest.set(D);
151
3.36k
        Next = Latest;
152
3.36k
      }
153
28.5k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::setLatest(clang::ObjCProtocolDecl*)
Line
Count
Source
141
5.47k
    void setLatest(decl_type *D) {
142
5.47k
      assert(NextIsLatest() && "decl became canonical unexpectedly");
143
5.47k
      if (
Next.is<NotKnownLatest>()5.47k
) {
144
4.51k
        NotKnownLatest NKL = Next.get<NotKnownLatest>();
145
4.51k
        Next = KnownLatest(*reinterpret_cast<const ASTContext *>(
146
4.51k
                               NKL.get<UninitializedLatest>()),
147
4.51k
                           D);
148
5.47k
      } else {
149
967
        auto Latest = Next.get<KnownLatest>();
150
967
        Latest.set(D);
151
967
        Next = Latest;
152
967
      }
153
5.47k
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::setLatest(clang::ObjCInterfaceDecl*)
Line
Count
Source
141
43.5k
    void setLatest(decl_type *D) {
142
43.5k
      assert(NextIsLatest() && "decl became canonical unexpectedly");
143
43.5k
      if (
Next.is<NotKnownLatest>()43.5k
) {
144
26.6k
        NotKnownLatest NKL = Next.get<NotKnownLatest>();
145
26.6k
        Next = KnownLatest(*reinterpret_cast<const ASTContext *>(
146
26.6k
                               NKL.get<UninitializedLatest>()),
147
26.6k
                           D);
148
43.5k
      } else {
149
16.8k
        auto Latest = Next.get<KnownLatest>();
150
16.8k
        Latest.set(D);
151
16.8k
        Next = Latest;
152
16.8k
      }
153
43.5k
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::setLatest(clang::NamespaceAliasDecl*)
Line
Count
Source
141
13
    void setLatest(decl_type *D) {
142
13
      assert(NextIsLatest() && "decl became canonical unexpectedly");
143
13
      if (
Next.is<NotKnownLatest>()13
) {
144
6
        NotKnownLatest NKL = Next.get<NotKnownLatest>();
145
6
        Next = KnownLatest(*reinterpret_cast<const ASTContext *>(
146
6
                               NKL.get<UninitializedLatest>()),
147
6
                           D);
148
13
      } else {
149
7
        auto Latest = Next.get<KnownLatest>();
150
7
        Latest.set(D);
151
7
        Next = Latest;
152
7
      }
153
13
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::setLatest(clang::TagDecl*)
Line
Count
Source
141
1.00M
    void setLatest(decl_type *D) {
142
1.00M
      assert(NextIsLatest() && "decl became canonical unexpectedly");
143
1.00M
      if (
Next.is<NotKnownLatest>()1.00M
) {
144
930k
        NotKnownLatest NKL = Next.get<NotKnownLatest>();
145
930k
        Next = KnownLatest(*reinterpret_cast<const ASTContext *>(
146
930k
                               NKL.get<UninitializedLatest>()),
147
930k
                           D);
148
1.00M
      } else {
149
71.8k
        auto Latest = Next.get<KnownLatest>();
150
71.8k
        Latest.set(D);
151
71.8k
        Next = Latest;
152
71.8k
      }
153
1.00M
    }
154
155
3.68k
    void markIncomplete() { Next.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::markIncomplete()
Line
Count
Source
155
1.06k
    void markIncomplete() { Next.get<KnownLatest>().markIncomplete(); }
Unexecuted instantiation: clang::Redeclarable<clang::NamespaceDecl>::DeclLink::markIncomplete()
Unexecuted instantiation: clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::markIncomplete()
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::markIncomplete()
Line
Count
Source
155
117
    void markIncomplete() { Next.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::markIncomplete()
Line
Count
Source
155
1
    void markIncomplete() { Next.get<KnownLatest>().markIncomplete(); }
Unexecuted instantiation: clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::markIncomplete()
clang::Redeclarable<clang::TagDecl>::DeclLink::markIncomplete()
Line
Count
Source
155
2.47k
    void markIncomplete() { Next.get<KnownLatest>().markIncomplete(); }
Unexecuted instantiation: clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::markIncomplete()
Unexecuted instantiation: clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::markIncomplete()
clang::Redeclarable<clang::VarDecl>::DeclLink::markIncomplete()
Line
Count
Source
155
21
    void markIncomplete() { Next.get<KnownLatest>().markIncomplete(); }
156
157
6.21k
    Decl *getLatestNotUpdated() const {
158
6.21k
      assert(NextIsLatest() && "expected a canonical decl");
159
6.21k
      if (Next.is<NotKnownLatest>())
160
71
        return nullptr;
161
6.14k
      return Next.get<KnownLatest>().getNotUpdated();
162
6.21k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
157
1.26k
    Decl *getLatestNotUpdated() const {
158
1.26k
      assert(NextIsLatest() && "expected a canonical decl");
159
1.26k
      if (Next.is<NotKnownLatest>())
160
0
        return nullptr;
161
1.26k
      return Next.get<KnownLatest>().getNotUpdated();
162
1.26k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
157
836
    Decl *getLatestNotUpdated() const {
158
836
      assert(NextIsLatest() && "expected a canonical decl");
159
836
      if (Next.is<NotKnownLatest>())
160
0
        return nullptr;
161
836
      return Next.get<KnownLatest>().getNotUpdated();
162
836
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
157
890
    Decl *getLatestNotUpdated() const {
158
890
      assert(NextIsLatest() && "expected a canonical decl");
159
890
      if (Next.is<NotKnownLatest>())
160
45
        return nullptr;
161
845
      return Next.get<KnownLatest>().getNotUpdated();
162
890
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
157
1
    Decl *getLatestNotUpdated() const {
158
1
      assert(NextIsLatest() && "expected a canonical decl");
159
1
      if (Next.is<NotKnownLatest>())
160
0
        return nullptr;
161
1
      return Next.get<KnownLatest>().getNotUpdated();
162
1
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
157
92
    Decl *getLatestNotUpdated() const {
158
92
      assert(NextIsLatest() && "expected a canonical decl");
159
92
      if (Next.is<NotKnownLatest>())
160
15
        return nullptr;
161
77
      return Next.get<KnownLatest>().getNotUpdated();
162
92
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
157
2.52k
    Decl *getLatestNotUpdated() const {
158
2.52k
      assert(NextIsLatest() && "expected a canonical decl");
159
2.52k
      if (Next.is<NotKnownLatest>())
160
11
        return nullptr;
161
2.50k
      return Next.get<KnownLatest>().getNotUpdated();
162
2.52k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
157
69
    Decl *getLatestNotUpdated() const {
158
69
      assert(NextIsLatest() && "expected a canonical decl");
159
69
      if (Next.is<NotKnownLatest>())
160
0
        return nullptr;
161
69
      return Next.get<KnownLatest>().getNotUpdated();
162
69
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
157
322
    Decl *getLatestNotUpdated() const {
158
322
      assert(NextIsLatest() && "expected a canonical decl");
159
322
      if (Next.is<NotKnownLatest>())
160
0
        return nullptr;
161
322
      return Next.get<KnownLatest>().getNotUpdated();
162
322
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
157
2
    Decl *getLatestNotUpdated() const {
158
2
      assert(NextIsLatest() && "expected a canonical decl");
159
2
      if (Next.is<NotKnownLatest>())
160
0
        return nullptr;
161
2
      return Next.get<KnownLatest>().getNotUpdated();
162
2
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
157
218
    Decl *getLatestNotUpdated() const {
158
218
      assert(NextIsLatest() && "expected a canonical decl");
159
218
      if (Next.is<NotKnownLatest>())
160
0
        return nullptr;
161
218
      return Next.get<KnownLatest>().getNotUpdated();
162
218
    }
163
  };
164
165
597k
  static DeclLink PreviousDeclLink(decl_type *D) {
166
597k
    return DeclLink(DeclLink::PreviousLink, D);
167
597k
  }
clang::Redeclarable<clang::TypedefNameDecl>::PreviousDeclLink(clang::TypedefNameDecl*)
Line
Count
Source
165
8.24k
  static DeclLink PreviousDeclLink(decl_type *D) {
166
8.24k
    return DeclLink(DeclLink::PreviousLink, D);
167
8.24k
  }
clang::Redeclarable<clang::FunctionDecl>::PreviousDeclLink(clang::FunctionDecl*)
Line
Count
Source
165
482k
  static DeclLink PreviousDeclLink(decl_type *D) {
166
482k
    return DeclLink(DeclLink::PreviousLink, D);
167
482k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::PreviousDeclLink(clang::ObjCInterfaceDecl*)
Line
Count
Source
165
16.6k
  static DeclLink PreviousDeclLink(decl_type *D) {
166
16.6k
    return DeclLink(DeclLink::PreviousLink, D);
167
16.6k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::PreviousDeclLink(clang::ObjCProtocolDecl*)
Line
Count
Source
165
911
  static DeclLink PreviousDeclLink(decl_type *D) {
166
911
    return DeclLink(DeclLink::PreviousLink, D);
167
911
  }
clang::Redeclarable<clang::NamespaceDecl>::PreviousDeclLink(clang::NamespaceDecl*)
Line
Count
Source
165
12.6k
  static DeclLink PreviousDeclLink(decl_type *D) {
166
12.6k
    return DeclLink(DeclLink::PreviousLink, D);
167
12.6k
  }
clang::Redeclarable<clang::VarDecl>::PreviousDeclLink(clang::VarDecl*)
Line
Count
Source
165
10.1k
  static DeclLink PreviousDeclLink(decl_type *D) {
166
10.1k
    return DeclLink(DeclLink::PreviousLink, D);
167
10.1k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::PreviousDeclLink(clang::NamespaceAliasDecl*)
Line
Count
Source
165
7
  static DeclLink PreviousDeclLink(decl_type *D) {
166
7
    return DeclLink(DeclLink::PreviousLink, D);
167
7
  }
clang::Redeclarable<clang::UsingShadowDecl>::PreviousDeclLink(clang::UsingShadowDecl*)
Line
Count
Source
165
71
  static DeclLink PreviousDeclLink(decl_type *D) {
166
71
    return DeclLink(DeclLink::PreviousLink, D);
167
71
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::PreviousDeclLink(clang::RedeclarableTemplateDecl*)
Line
Count
Source
165
3.51k
  static DeclLink PreviousDeclLink(decl_type *D) {
166
3.51k
    return DeclLink(DeclLink::PreviousLink, D);
167
3.51k
  }
clang::Redeclarable<clang::TagDecl>::PreviousDeclLink(clang::TagDecl*)
Line
Count
Source
165
62.5k
  static DeclLink PreviousDeclLink(decl_type *D) {
166
62.5k
    return DeclLink(DeclLink::PreviousLink, D);
167
62.5k
  }
168
169
17.9M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
170
17.9M
    return DeclLink(DeclLink::LatestLink, Ctx);
171
17.9M
  }
clang::Redeclarable<clang::VarDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
169
10.7M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
170
10.7M
    return DeclLink(DeclLink::LatestLink, Ctx);
171
10.7M
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
169
5.38k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
170
5.38k
    return DeclLink(DeclLink::LatestLink, Ctx);
171
5.38k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
169
43.1k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
170
43.1k
    return DeclLink(DeclLink::LatestLink, Ctx);
171
43.1k
  }
clang::Redeclarable<clang::UsingShadowDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
169
3.29k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
170
3.29k
    return DeclLink(DeclLink::LatestLink, Ctx);
171
3.29k
  }
clang::Redeclarable<clang::NamespaceDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
169
37.2k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
170
37.2k
    return DeclLink(DeclLink::LatestLink, Ctx);
171
37.2k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
169
138
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
170
138
    return DeclLink(DeclLink::LatestLink, Ctx);
171
138
  }
clang::Redeclarable<clang::TagDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
169
990k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
170
990k
    return DeclLink(DeclLink::LatestLink, Ctx);
171
990k
  }
clang::Redeclarable<clang::FunctionDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
169
4.82M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
170
4.82M
    return DeclLink(DeclLink::LatestLink, Ctx);
171
4.82M
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
169
71.3k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
170
71.3k
    return DeclLink(DeclLink::LatestLink, Ctx);
171
71.3k
  }
clang::Redeclarable<clang::TypedefNameDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
169
1.25M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
170
1.25M
    return DeclLink(DeclLink::LatestLink, Ctx);
171
1.25M
  }
172
173
  /// \brief Points to the next redeclaration in the chain.
174
  ///
175
  /// If NextIsPrevious() is true, this is a link to the previous declaration
176
  /// of this same Decl. If NextIsLatest() is true, this is the first
177
  /// declaration and Link points to the latest declaration. For example:
178
  ///
179
  ///  #1 int f(int x, int y = 1); // <pointer to #3, true>
180
  ///  #2 int f(int x = 0, int y); // <pointer to #1, false>
181
  ///  #3 int f(int x, int y) { return x + y; } // <pointer to #2, false>
182
  ///
183
  /// If there is only one declaration, it is <pointer to self, true>
184
  DeclLink RedeclLink;
185
  decl_type *First;
186
187
124M
  decl_type *getNextRedeclaration() const {
188
124M
    return RedeclLink.getNext(static_cast<const decl_type *>(this));
189
124M
  }
clang::Redeclarable<clang::VarDecl>::getNextRedeclaration() const
Line
Count
Source
187
21.5M
  decl_type *getNextRedeclaration() const {
188
21.5M
    return RedeclLink.getNext(static_cast<const decl_type *>(this));
189
21.5M
  }
clang::Redeclarable<clang::UsingShadowDecl>::getNextRedeclaration() const
Line
Count
Source
187
7.10k
  decl_type *getNextRedeclaration() const {
188
7.10k
    return RedeclLink.getNext(static_cast<const decl_type *>(this));
189
7.10k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getNextRedeclaration() const
Line
Count
Source
187
91.8k
  decl_type *getNextRedeclaration() const {
188
91.8k
    return RedeclLink.getNext(static_cast<const decl_type *>(this));
189
91.8k
  }
clang::Redeclarable<clang::TypedefNameDecl>::getNextRedeclaration() const
Line
Count
Source
187
170k
  decl_type *getNextRedeclaration() const {
188
170k
    return RedeclLink.getNext(static_cast<const decl_type *>(this));
189
170k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getNextRedeclaration() const
Line
Count
Source
187
324k
  decl_type *getNextRedeclaration() const {
188
324k
    return RedeclLink.getNext(static_cast<const decl_type *>(this));
189
324k
  }
clang::Redeclarable<clang::FunctionDecl>::getNextRedeclaration() const
Line
Count
Source
187
23.7M
  decl_type *getNextRedeclaration() const {
188
23.7M
    return RedeclLink.getNext(static_cast<const decl_type *>(this));
189
23.7M
  }
clang::Redeclarable<clang::TagDecl>::getNextRedeclaration() const
Line
Count
Source
187
78.9M
  decl_type *getNextRedeclaration() const {
188
78.9M
    return RedeclLink.getNext(static_cast<const decl_type *>(this));
189
78.9M
  }
clang::Redeclarable<clang::NamespaceDecl>::getNextRedeclaration() const
Line
Count
Source
187
76.8k
  decl_type *getNextRedeclaration() const {
188
76.8k
    return RedeclLink.getNext(static_cast<const decl_type *>(this));
189
76.8k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getNextRedeclaration() const
Line
Count
Source
187
121
  decl_type *getNextRedeclaration() const {
188
121
    return RedeclLink.getNext(static_cast<const decl_type *>(this));
189
121
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getNextRedeclaration() const
Line
Count
Source
187
9.08k
  decl_type *getNextRedeclaration() const {
188
9.08k
    return RedeclLink.getNext(static_cast<const decl_type *>(this));
189
9.08k
  }
190
191
public:
192
 Redeclarable(const ASTContext &Ctx)
193
17.9M
     : RedeclLink(LatestDeclLink(Ctx)), First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::NamespaceDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
193
37.2k
     : RedeclLink(LatestDeclLink(Ctx)), First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::RedeclarableTemplateDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
193
71.3k
     : RedeclLink(LatestDeclLink(Ctx)), First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::NamespaceAliasDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
193
138
     : RedeclLink(LatestDeclLink(Ctx)), First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::VarDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
193
10.7M
     : RedeclLink(LatestDeclLink(Ctx)), First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::TypedefNameDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
193
1.25M
     : RedeclLink(LatestDeclLink(Ctx)), First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::FunctionDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
193
4.82M
     : RedeclLink(LatestDeclLink(Ctx)), First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::TagDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
193
990k
     : RedeclLink(LatestDeclLink(Ctx)), First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::UsingShadowDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
193
3.29k
     : RedeclLink(LatestDeclLink(Ctx)), First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
193
43.1k
     : RedeclLink(LatestDeclLink(Ctx)), First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
193
5.38k
     : RedeclLink(LatestDeclLink(Ctx)), First(static_cast<decl_type *>(this)) {}
194
195
  /// \brief Return the previous declaration of this declaration or NULL if this
196
  /// is the first declaration.
197
6.19M
  decl_type *getPreviousDecl() {
198
6.19M
    if (RedeclLink.NextIsPrevious())
199
493k
      return getNextRedeclaration();
200
5.69M
    return nullptr;
201
6.19M
  }
clang::Redeclarable<clang::UsingShadowDecl>::getPreviousDecl()
Line
Count
Source
197
76
  decl_type *getPreviousDecl() {
198
76
    if (RedeclLink.NextIsPrevious())
199
33
      return getNextRedeclaration();
200
43
    return nullptr;
201
76
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getPreviousDecl()
Line
Count
Source
197
4
  decl_type *getPreviousDecl() {
198
4
    if (RedeclLink.NextIsPrevious())
199
0
      return getNextRedeclaration();
200
4
    return nullptr;
201
4
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getPreviousDecl()
Line
Count
Source
197
556
  decl_type *getPreviousDecl() {
198
556
    if (RedeclLink.NextIsPrevious())
199
344
      return getNextRedeclaration();
200
212
    return nullptr;
201
556
  }
clang::Redeclarable<clang::VarDecl>::getPreviousDecl()
Line
Count
Source
197
428k
  decl_type *getPreviousDecl() {
198
428k
    if (RedeclLink.NextIsPrevious())
199
25.3k
      return getNextRedeclaration();
200
402k
    return nullptr;
201
428k
  }
clang::Redeclarable<clang::TypedefNameDecl>::getPreviousDecl()
Line
Count
Source
197
24.9k
  decl_type *getPreviousDecl() {
198
24.9k
    if (RedeclLink.NextIsPrevious())
199
8.79k
      return getNextRedeclaration();
200
16.1k
    return nullptr;
201
24.9k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getPreviousDecl()
Line
Count
Source
197
87.1k
  decl_type *getPreviousDecl() {
198
87.1k
    if (RedeclLink.NextIsPrevious())
199
5.19k
      return getNextRedeclaration();
200
81.9k
    return nullptr;
201
87.1k
  }
clang::Redeclarable<clang::FunctionDecl>::getPreviousDecl()
Line
Count
Source
197
4.84M
  decl_type *getPreviousDecl() {
198
4.84M
    if (RedeclLink.NextIsPrevious())
199
421k
      return getNextRedeclaration();
200
4.42M
    return nullptr;
201
4.84M
  }
clang::Redeclarable<clang::TagDecl>::getPreviousDecl()
Line
Count
Source
197
782k
  decl_type *getPreviousDecl() {
198
782k
    if (RedeclLink.NextIsPrevious())
199
26.4k
      return getNextRedeclaration();
200
755k
    return nullptr;
201
782k
  }
clang::Redeclarable<clang::NamespaceDecl>::getPreviousDecl()
Line
Count
Source
197
17.2k
  decl_type *getPreviousDecl() {
198
17.2k
    if (RedeclLink.NextIsPrevious())
199
871
      return getNextRedeclaration();
200
16.3k
    return nullptr;
201
17.2k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getPreviousDecl()
Line
Count
Source
197
8.54k
  decl_type *getPreviousDecl() {
198
8.54k
    if (RedeclLink.NextIsPrevious())
199
5.16k
      return getNextRedeclaration();
200
3.37k
    return nullptr;
201
8.54k
  }
202
2.56M
  const decl_type *getPreviousDecl() const {
203
2.56M
    return const_cast<decl_type *>(
204
2.56M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
205
2.56M
  }
clang::Redeclarable<clang::FunctionDecl>::getPreviousDecl() const
Line
Count
Source
202
2.09M
  const decl_type *getPreviousDecl() const {
203
2.09M
    return const_cast<decl_type *>(
204
2.09M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
205
2.09M
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getPreviousDecl() const
Line
Count
Source
202
45.3k
  const decl_type *getPreviousDecl() const {
203
45.3k
    return const_cast<decl_type *>(
204
45.3k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
205
45.3k
  }
clang::Redeclarable<clang::TagDecl>::getPreviousDecl() const
Line
Count
Source
202
1.20k
  const decl_type *getPreviousDecl() const {
203
1.20k
    return const_cast<decl_type *>(
204
1.20k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
205
1.20k
  }
clang::Redeclarable<clang::NamespaceDecl>::getPreviousDecl() const
Line
Count
Source
202
99
  const decl_type *getPreviousDecl() const {
203
99
    return const_cast<decl_type *>(
204
99
                 static_cast<const decl_type*>(this))->getPreviousDecl();
205
99
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getPreviousDecl() const
Line
Count
Source
202
4
  const decl_type *getPreviousDecl() const {
203
4
    return const_cast<decl_type *>(
204
4
                 static_cast<const decl_type*>(this))->getPreviousDecl();
205
4
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getPreviousDecl() const
Line
Count
Source
202
5.06k
  const decl_type *getPreviousDecl() const {
203
5.06k
    return const_cast<decl_type *>(
204
5.06k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
205
5.06k
  }
clang::Redeclarable<clang::UsingShadowDecl>::getPreviousDecl() const
Line
Count
Source
202
15
  const decl_type *getPreviousDecl() const {
203
15
    return const_cast<decl_type *>(
204
15
                 static_cast<const decl_type*>(this))->getPreviousDecl();
205
15
  }
clang::Redeclarable<clang::TypedefNameDecl>::getPreviousDecl() const
Line
Count
Source
202
362
  const decl_type *getPreviousDecl() const {
203
362
    return const_cast<decl_type *>(
204
362
                 static_cast<const decl_type*>(this))->getPreviousDecl();
205
362
  }
clang::Redeclarable<clang::VarDecl>::getPreviousDecl() const
Line
Count
Source
202
409k
  const decl_type *getPreviousDecl() const {
203
409k
    return const_cast<decl_type *>(
204
409k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
205
409k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getPreviousDecl() const
Line
Count
Source
202
17
  const decl_type *getPreviousDecl() const {
203
17
    return const_cast<decl_type *>(
204
17
                 static_cast<const decl_type*>(this))->getPreviousDecl();
205
17
  }
206
207
  /// \brief Return the first declaration of this declaration or itself if this
208
  /// is the only declaration.
209
255M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getFirstDecl()
Line
Count
Source
209
4.63M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::UsingShadowDecl>::getFirstDecl()
Line
Count
Source
209
19.1k
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::ObjCProtocolDecl>::getFirstDecl()
Line
Count
Source
209
20.8k
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::NamespaceAliasDecl>::getFirstDecl()
Line
Count
Source
209
212
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::NamespaceDecl>::getFirstDecl()
Line
Count
Source
209
65.5k
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::TagDecl>::getFirstDecl()
Line
Count
Source
209
82.4M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::FunctionDecl>::getFirstDecl()
Line
Count
Source
209
116M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::VarDecl>::getFirstDecl()
Line
Count
Source
209
45.6M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::TypedefNameDecl>::getFirstDecl()
Line
Count
Source
209
6.13M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getFirstDecl()
Line
Count
Source
209
321k
  decl_type *getFirstDecl() { return First; }
210
211
  /// \brief Return the first declaration of this declaration or itself if this
212
  /// is the only declaration.
213
14.5M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::ObjCProtocolDecl>::getFirstDecl() const
Line
Count
Source
213
773
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::VarDecl>::getFirstDecl() const
Line
Count
Source
213
6.48M
  const decl_type *getFirstDecl() const { return First; }
Unexecuted instantiation: clang::Redeclarable<clang::NamespaceAliasDecl>::getFirstDecl() const
clang::Redeclarable<clang::FunctionDecl>::getFirstDecl() const
Line
Count
Source
213
8.02M
  const decl_type *getFirstDecl() const { return First; }
Unexecuted instantiation: clang::Redeclarable<clang::UsingShadowDecl>::getFirstDecl() const
clang::Redeclarable<clang::ObjCInterfaceDecl>::getFirstDecl() const
Line
Count
Source
213
4.60k
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::TypedefNameDecl>::getFirstDecl() const
Line
Count
Source
213
66
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getFirstDecl() const
Line
Count
Source
213
3.17k
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::TagDecl>::getFirstDecl() const
Line
Count
Source
213
2.29k
  const decl_type *getFirstDecl() const { return First; }
214
215
  /// \brief True if this is the first declaration in its redeclaration chain.
216
65.1M
  bool isFirstDecl() const { return RedeclLink.NextIsLatest(); }
clang::Redeclarable<clang::NamespaceAliasDecl>::isFirstDecl() const
Line
Count
Source
216
7
  bool isFirstDecl() const { return RedeclLink.NextIsLatest(); }
clang::Redeclarable<clang::UsingShadowDecl>::isFirstDecl() const
Line
Count
Source
216
900
  bool isFirstDecl() const { return RedeclLink.NextIsLatest(); }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::isFirstDecl() const
Line
Count
Source
216
4.88k
  bool isFirstDecl() const { return RedeclLink.NextIsLatest(); }
clang::Redeclarable<clang::ObjCProtocolDecl>::isFirstDecl() const
Line
Count
Source
216
5.06k
  bool isFirstDecl() const { return RedeclLink.NextIsLatest(); }
clang::Redeclarable<clang::ObjCInterfaceDecl>::isFirstDecl() const
Line
Count
Source
216
22.2k
  bool isFirstDecl() const { return RedeclLink.NextIsLatest(); }
clang::Redeclarable<clang::TypedefNameDecl>::isFirstDecl() const
Line
Count
Source
216
7.05k
  bool isFirstDecl() const { return RedeclLink.NextIsLatest(); }
clang::Redeclarable<clang::VarDecl>::isFirstDecl() const
Line
Count
Source
216
3.51M
  bool isFirstDecl() const { return RedeclLink.NextIsLatest(); }
clang::Redeclarable<clang::TagDecl>::isFirstDecl() const
Line
Count
Source
216
6.96M
  bool isFirstDecl() const { return RedeclLink.NextIsLatest(); }
clang::Redeclarable<clang::NamespaceDecl>::isFirstDecl() const
Line
Count
Source
216
44.7M
  bool isFirstDecl() const { return RedeclLink.NextIsLatest(); }
clang::Redeclarable<clang::FunctionDecl>::isFirstDecl() const
Line
Count
Source
216
9.88M
  bool isFirstDecl() const { return RedeclLink.NextIsLatest(); }
217
218
  /// \brief Returns the most recent (re)declaration of this declaration.
219
102M
  decl_type *getMostRecentDecl() {
220
102M
    return getFirstDecl()->getNextRedeclaration();
221
102M
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getMostRecentDecl()
Line
Count
Source
219
281k
  decl_type *getMostRecentDecl() {
220
281k
    return getFirstDecl()->getNextRedeclaration();
221
281k
  }
clang::Redeclarable<clang::TypedefNameDecl>::getMostRecentDecl()
Line
Count
Source
219
116k
  decl_type *getMostRecentDecl() {
220
116k
    return getFirstDecl()->getNextRedeclaration();
221
116k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getMostRecentDecl()
Line
Count
Source
219
7.23k
  decl_type *getMostRecentDecl() {
220
7.23k
    return getFirstDecl()->getNextRedeclaration();
221
7.23k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getMostRecentDecl()
Line
Count
Source
219
2.02k
  decl_type *getMostRecentDecl() {
220
2.02k
    return getFirstDecl()->getNextRedeclaration();
221
2.02k
  }
clang::Redeclarable<clang::VarDecl>::getMostRecentDecl()
Line
Count
Source
219
14.0M
  decl_type *getMostRecentDecl() {
220
14.0M
    return getFirstDecl()->getNextRedeclaration();
221
14.0M
  }
clang::Redeclarable<clang::UsingShadowDecl>::getMostRecentDecl()
Line
Count
Source
219
4.21k
  decl_type *getMostRecentDecl() {
220
4.21k
    return getFirstDecl()->getNextRedeclaration();
221
4.21k
  }
clang::Redeclarable<clang::TagDecl>::getMostRecentDecl()
Line
Count
Source
219
71.6M
  decl_type *getMostRecentDecl() {
220
71.6M
    return getFirstDecl()->getNextRedeclaration();
221
71.6M
  }
clang::Redeclarable<clang::NamespaceDecl>::getMostRecentDecl()
Line
Count
Source
219
52.5k
  decl_type *getMostRecentDecl() {
220
52.5k
    return getFirstDecl()->getNextRedeclaration();
221
52.5k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getMostRecentDecl()
Line
Count
Source
219
72
  decl_type *getMostRecentDecl() {
220
72
    return getFirstDecl()->getNextRedeclaration();
221
72
  }
clang::Redeclarable<clang::FunctionDecl>::getMostRecentDecl()
Line
Count
Source
219
16.1M
  decl_type *getMostRecentDecl() {
220
16.1M
    return getFirstDecl()->getNextRedeclaration();
221
16.1M
  }
222
223
  /// \brief Returns the most recent (re)declaration of this declaration.
224
53.6k
  const decl_type *getMostRecentDecl() const {
225
53.6k
    return getFirstDecl()->getNextRedeclaration();
226
53.6k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getMostRecentDecl() const
Line
Count
Source
224
152
  const decl_type *getMostRecentDecl() const {
225
152
    return getFirstDecl()->getNextRedeclaration();
226
152
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getMostRecentDecl() const
Line
Count
Source
224
4.60k
  const decl_type *getMostRecentDecl() const {
225
4.60k
    return getFirstDecl()->getNextRedeclaration();
226
4.60k
  }
clang::Redeclarable<clang::VarDecl>::getMostRecentDecl() const
Line
Count
Source
224
357
  const decl_type *getMostRecentDecl() const {
225
357
    return getFirstDecl()->getNextRedeclaration();
226
357
  }
clang::Redeclarable<clang::TagDecl>::getMostRecentDecl() const
Line
Count
Source
224
120
  const decl_type *getMostRecentDecl() const {
225
120
    return getFirstDecl()->getNextRedeclaration();
226
120
  }
clang::Redeclarable<clang::FunctionDecl>::getMostRecentDecl() const
Line
Count
Source
224
48.4k
  const decl_type *getMostRecentDecl() const {
225
48.4k
    return getFirstDecl()->getNextRedeclaration();
226
48.4k
  }
227
228
  /// \brief Set the previous declaration. If PrevDecl is NULL, set this as the
229
  /// first and only declaration.
230
  void setPreviousDecl(decl_type *PrevDecl);
231
232
  /// \brief Iterates through all the redeclarations of the same decl.
233
  class redecl_iterator {
234
    /// Current - The current declaration.
235
    decl_type *Current;
236
    decl_type *Starter;
237
    bool PassedFirst;
238
239
  public:
240
    typedef decl_type*                value_type;
241
    typedef decl_type*                reference;
242
    typedef decl_type*                pointer;
243
    typedef std::forward_iterator_tag iterator_category;
244
    typedef std::ptrdiff_t            difference_type;
245
246
112M
    redecl_iterator() : Current(nullptr) { }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
246
4.23k
    redecl_iterator() : Current(nullptr) { }
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
246
8.65M
    redecl_iterator() : Current(nullptr) { }
clang::Redeclarable<clang::TagDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
246
91.0M
    redecl_iterator() : Current(nullptr) { }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
246
16.8k
    redecl_iterator() : Current(nullptr) { }
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
246
558
    redecl_iterator() : Current(nullptr) { }
clang::Redeclarable<clang::VarDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
246
12.9M
    redecl_iterator() : Current(nullptr) { }
247
    explicit redecl_iterator(decl_type *C)
248
112M
      : Current(C), Starter(C), PassedFirst(false) { }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::redecl_iterator(clang::ObjCInterfaceDecl*)
Line
Count
Source
248
16.8k
      : Current(C), Starter(C), PassedFirst(false) { }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::redecl_iterator(clang::ObjCProtocolDecl*)
Line
Count
Source
248
4.23k
      : Current(C), Starter(C), PassedFirst(false) { }
clang::Redeclarable<clang::VarDecl>::redecl_iterator::redecl_iterator(clang::VarDecl*)
Line
Count
Source
248
12.9M
      : Current(C), Starter(C), PassedFirst(false) { }
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::redecl_iterator(clang::UsingShadowDecl*)
Line
Count
Source
248
558
      : Current(C), Starter(C), PassedFirst(false) { }
clang::Redeclarable<clang::TagDecl>::redecl_iterator::redecl_iterator(clang::TagDecl*)
Line
Count
Source
248
91.0M
      : Current(C), Starter(C), PassedFirst(false) { }
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::redecl_iterator(clang::FunctionDecl*)
Line
Count
Source
248
8.65M
      : Current(C), Starter(C), PassedFirst(false) { }
249
250
117M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::TagDecl>::redecl_iterator::operator*() const
Line
Count
Source
250
94.9M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::operator*() const
Line
Count
Source
250
9.33M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::VarDecl>::redecl_iterator::operator*() const
Line
Count
Source
250
13.0M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::operator*() const
Line
Count
Source
250
566
    reference operator*() const { return Current; }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::operator*() const
Line
Count
Source
250
4.97k
    reference operator*() const { return Current; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::operator*() const
Line
Count
Source
250
21.9k
    reference operator*() const { return Current; }
251
    pointer operator->() const { return Current; }
252
253
15.3M
    redecl_iterator& operator++() {
254
15.3M
      assert(Current && "Advancing while iterator has reached end");
255
15.3M
      // Sanity check to avoid infinite loop on invalid redecl chain.
256
15.3M
      if (
Current->isFirstDecl()15.3M
) {
257
14.2M
        if (
PassedFirst14.2M
) {
258
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
259
0
          Current = nullptr;
260
0
          return *this;
261
0
        }
262
14.2M
        PassedFirst = true;
263
14.2M
      }
264
15.3M
265
15.3M
      // Get either previous decl or latest decl.
266
15.3M
      decl_type *Next = Current->getNextRedeclaration();
267
15.3M
      Current = (Next != Starter) ? 
Next4.72M
:
nullptr10.6M
;
268
15.3M
      return *this;
269
15.3M
    }
clang::Redeclarable<clang::VarDecl>::redecl_iterator::operator++()
Line
Count
Source
253
2.37M
    redecl_iterator& operator++() {
254
2.37M
      assert(Current && "Advancing while iterator has reached end");
255
2.37M
      // Sanity check to avoid infinite loop on invalid redecl chain.
256
2.37M
      if (
Current->isFirstDecl()2.37M
) {
257
2.34M
        if (
PassedFirst2.34M
) {
258
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
259
0
          Current = nullptr;
260
0
          return *this;
261
0
        }
262
2.34M
        PassedFirst = true;
263
2.34M
      }
264
2.37M
265
2.37M
      // Get either previous decl or latest decl.
266
2.37M
      decl_type *Next = Current->getNextRedeclaration();
267
2.37M
      Current = (Next != Starter) ? 
Next49.5k
:
nullptr2.32M
;
268
2.37M
      return *this;
269
2.37M
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::operator++()
Line
Count
Source
253
21.9k
    redecl_iterator& operator++() {
254
21.9k
      assert(Current && "Advancing while iterator has reached end");
255
21.9k
      // Sanity check to avoid infinite loop on invalid redecl chain.
256
21.9k
      if (
Current->isFirstDecl()21.9k
) {
257
16.8k
        if (
PassedFirst16.8k
) {
258
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
259
0
          Current = nullptr;
260
0
          return *this;
261
0
        }
262
16.8k
        PassedFirst = true;
263
16.8k
      }
264
21.9k
265
21.9k
      // Get either previous decl or latest decl.
266
21.9k
      decl_type *Next = Current->getNextRedeclaration();
267
21.9k
      Current = (Next != Starter) ? 
Next5.10k
:
nullptr16.8k
;
268
21.9k
      return *this;
269
21.9k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::operator++()
Line
Count
Source
253
4.97k
    redecl_iterator& operator++() {
254
4.97k
      assert(Current && "Advancing while iterator has reached end");
255
4.97k
      // Sanity check to avoid infinite loop on invalid redecl chain.
256
4.97k
      if (
Current->isFirstDecl()4.97k
) {
257
4.23k
        if (
PassedFirst4.23k
) {
258
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
259
0
          Current = nullptr;
260
0
          return *this;
261
0
        }
262
4.23k
        PassedFirst = true;
263
4.23k
      }
264
4.97k
265
4.97k
      // Get either previous decl or latest decl.
266
4.97k
      decl_type *Next = Current->getNextRedeclaration();
267
4.97k
      Current = (Next != Starter) ? 
Next747
:
nullptr4.23k
;
268
4.97k
      return *this;
269
4.97k
    }
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::operator++()
Line
Count
Source
253
566
    redecl_iterator& operator++() {
254
566
      assert(Current && "Advancing while iterator has reached end");
255
566
      // Sanity check to avoid infinite loop on invalid redecl chain.
256
566
      if (
Current->isFirstDecl()566
) {
257
558
        if (
PassedFirst558
) {
258
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
259
0
          Current = nullptr;
260
0
          return *this;
261
0
        }
262
558
        PassedFirst = true;
263
558
      }
264
566
265
566
      // Get either previous decl or latest decl.
266
566
      decl_type *Next = Current->getNextRedeclaration();
267
566
      Current = (Next != Starter) ? 
Next8
:
nullptr558
;
268
566
      return *this;
269
566
    }
clang::Redeclarable<clang::TagDecl>::redecl_iterator::operator++()
Line
Count
Source
253
6.96M
    redecl_iterator& operator++() {
254
6.96M
      assert(Current && "Advancing while iterator has reached end");
255
6.96M
      // Sanity check to avoid infinite loop on invalid redecl chain.
256
6.96M
      if (
Current->isFirstDecl()6.96M
) {
257
6.57M
        if (
PassedFirst6.57M
) {
258
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
259
0
          Current = nullptr;
260
0
          return *this;
261
0
        }
262
6.57M
        PassedFirst = true;
263
6.57M
      }
264
6.96M
265
6.96M
      // Get either previous decl or latest decl.
266
6.96M
      decl_type *Next = Current->getNextRedeclaration();
267
6.96M
      Current = (Next != Starter) ? 
Next3.98M
:
nullptr2.98M
;
268
6.96M
      return *this;
269
6.96M
    }
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::operator++()
Line
Count
Source
253
5.99M
    redecl_iterator& operator++() {
254
5.99M
      assert(Current && "Advancing while iterator has reached end");
255
5.99M
      // Sanity check to avoid infinite loop on invalid redecl chain.
256
5.99M
      if (
Current->isFirstDecl()5.99M
) {
257
5.34M
        if (
PassedFirst5.34M
) {
258
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
259
0
          Current = nullptr;
260
0
          return *this;
261
0
        }
262
5.34M
        PassedFirst = true;
263
5.34M
      }
264
5.99M
265
5.99M
      // Get either previous decl or latest decl.
266
5.99M
      decl_type *Next = Current->getNextRedeclaration();
267
5.99M
      Current = (Next != Starter) ? 
Next686k
:
nullptr5.30M
;
268
5.99M
      return *this;
269
5.99M
    }
270
271
    redecl_iterator operator++(int) {
272
      redecl_iterator tmp(*this);
273
      ++(*this);
274
      return tmp;
275
    }
276
277
11
    friend bool operator==(redecl_iterator x, redecl_iterator y) {
278
11
      return x.Current == y.Current;
279
11
    }
280
128M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
281
128M
      return x.Current != y.Current;
282
128M
    }
clang::operator!=(clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator, clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator)
Line
Count
Source
280
9.21k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
281
9.21k
      return x.Current != y.Current;
282
9.21k
    }
clang::operator!=(clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator, clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator)
Line
Count
Source
280
38.8k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
281
38.8k
      return x.Current != y.Current;
282
38.8k
    }
clang::operator!=(clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator, clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator)
Line
Count
Source
280
1.12k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
281
1.12k
      return x.Current != y.Current;
282
1.12k
    }
clang::operator!=(clang::Redeclarable<clang::VarDecl>::redecl_iterator, clang::Redeclarable<clang::VarDecl>::redecl_iterator)
Line
Count
Source
280
15.3M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
281
15.3M
      return x.Current != y.Current;
282
15.3M
    }
clang::operator!=(clang::Redeclarable<clang::TagDecl>::redecl_iterator, clang::Redeclarable<clang::TagDecl>::redecl_iterator)
Line
Count
Source
280
97.9M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
281
97.9M
      return x.Current != y.Current;
282
97.9M
    }
clang::operator!=(clang::Redeclarable<clang::FunctionDecl>::redecl_iterator, clang::Redeclarable<clang::FunctionDecl>::redecl_iterator)
Line
Count
Source
280
14.6M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
281
14.6M
      return x.Current != y.Current;
282
14.6M
    }
283
  };
284
285
  typedef llvm::iterator_range<redecl_iterator> redecl_range;
286
287
  /// \brief Returns an iterator range for all the redeclarations of the same
288
  /// decl. It will iterate at least once (when this decl is the only one).
289
112M
  redecl_range redecls() const {
290
112M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
291
112M
                            static_cast<const decl_type *>(this))),
292
112M
                        redecl_iterator());
293
112M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecls() const
Line
Count
Source
289
16.8k
  redecl_range redecls() const {
290
16.8k
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
291
16.8k
                            static_cast<const decl_type *>(this))),
292
16.8k
                        redecl_iterator());
293
16.8k
  }
clang::Redeclarable<clang::VarDecl>::redecls() const
Line
Count
Source
289
12.9M
  redecl_range redecls() const {
290
12.9M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
291
12.9M
                            static_cast<const decl_type *>(this))),
292
12.9M
                        redecl_iterator());
293
12.9M
  }
clang::Redeclarable<clang::TagDecl>::redecls() const
Line
Count
Source
289
91.0M
  redecl_range redecls() const {
290
91.0M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
291
91.0M
                            static_cast<const decl_type *>(this))),
292
91.0M
                        redecl_iterator());
293
91.0M
  }
clang::Redeclarable<clang::FunctionDecl>::redecls() const
Line
Count
Source
289
8.65M
  redecl_range redecls() const {
290
8.65M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
291
8.65M
                            static_cast<const decl_type *>(this))),
292
8.65M
                        redecl_iterator());
293
8.65M
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecls() const
Line
Count
Source
289
4.23k
  redecl_range redecls() const {
290
4.23k
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
291
4.23k
                            static_cast<const decl_type *>(this))),
292
4.23k
                        redecl_iterator());
293
4.23k
  }
clang::Redeclarable<clang::UsingShadowDecl>::redecls() const
Line
Count
Source
289
558
  redecl_range redecls() const {
290
558
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
291
558
                            static_cast<const decl_type *>(this))),
292
558
                        redecl_iterator());
293
558
  }
294
295
  redecl_iterator redecls_begin() const { return redecls().begin(); }
296
11
  redecl_iterator redecls_end() const { return redecls().end(); }
297
298
  friend class ASTDeclReader;
299
  friend class ASTDeclWriter;
300
};
301
302
/// \brief Get the primary declaration for a declaration from an AST file. That
303
/// will be the first-loaded declaration.
304
Decl *getPrimaryMergedDecl(Decl *D);
305
306
/// \brief Provides common interface for the Decls that cannot be redeclared,
307
/// but can be merged if the same declaration is brought in from multiple
308
/// modules.
309
template<typename decl_type>
310
class Mergeable {
311
public:
312
2.63M
  Mergeable() {}
clang::Mergeable<clang::IndirectFieldDecl>::Mergeable()
Line
Count
Source
312
8.91k
  Mergeable() {}
clang::Mergeable<clang::EnumConstantDecl>::Mergeable()
Line
Count
Source
312
386k
  Mergeable() {}
clang::Mergeable<clang::UnresolvedUsingTypenameDecl>::Mergeable()
Line
Count
Source
312
125
  Mergeable() {}
clang::Mergeable<clang::FieldDecl>::Mergeable()
Line
Count
Source
312
2.24M
  Mergeable() {}
clang::Mergeable<clang::UsingDecl>::Mergeable()
Line
Count
Source
312
2.41k
  Mergeable() {}
clang::Mergeable<clang::UnresolvedUsingValueDecl>::Mergeable()
Line
Count
Source
312
526
  Mergeable() {}
clang::Mergeable<clang::UsingPackDecl>::Mergeable()
Line
Count
Source
312
45
  Mergeable() {}
313
314
  /// \brief Return the first declaration of this declaration or itself if this
315
  /// is the only declaration.
316
4.80M
  decl_type *getFirstDecl() {
317
4.80M
    decl_type *D = static_cast<decl_type*>(this);
318
4.80M
    if (!D->isFromASTFile())
319
4.79M
      return D;
320
11.2k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
321
4.80M
  }
clang::Mergeable<clang::FieldDecl>::getFirstDecl()
Line
Count
Source
316
4.56M
  decl_type *getFirstDecl() {
317
4.56M
    decl_type *D = static_cast<decl_type*>(this);
318
4.56M
    if (!D->isFromASTFile())
319
4.55M
      return D;
320
9.73k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
321
4.56M
  }
clang::Mergeable<clang::UnresolvedUsingTypenameDecl>::getFirstDecl()
Line
Count
Source
316
330
  decl_type *getFirstDecl() {
317
330
    decl_type *D = static_cast<decl_type*>(this);
318
330
    if (!D->isFromASTFile())
319
236
      return D;
320
94
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
321
330
  }
clang::Mergeable<clang::UsingDecl>::getFirstDecl()
Line
Count
Source
316
3.46k
  decl_type *getFirstDecl() {
317
3.46k
    decl_type *D = static_cast<decl_type*>(this);
318
3.46k
    if (!D->isFromASTFile())
319
3.01k
      return D;
320
453
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
321
3.46k
  }
clang::Mergeable<clang::UsingPackDecl>::getFirstDecl()
Line
Count
Source
316
3
  decl_type *getFirstDecl() {
317
3
    decl_type *D = static_cast<decl_type*>(this);
318
3
    if (!D->isFromASTFile())
319
2
      return D;
320
1
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
321
3
  }
clang::Mergeable<clang::UnresolvedUsingValueDecl>::getFirstDecl()
Line
Count
Source
316
962
  decl_type *getFirstDecl() {
317
962
    decl_type *D = static_cast<decl_type*>(this);
318
962
    if (!D->isFromASTFile())
319
853
      return D;
320
109
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
321
962
  }
clang::Mergeable<clang::EnumConstantDecl>::getFirstDecl()
Line
Count
Source
316
220k
  decl_type *getFirstDecl() {
317
220k
    decl_type *D = static_cast<decl_type*>(this);
318
220k
    if (!D->isFromASTFile())
319
220k
      return D;
320
715
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
321
220k
  }
clang::Mergeable<clang::IndirectFieldDecl>::getFirstDecl()
Line
Count
Source
316
17.4k
  decl_type *getFirstDecl() {
317
17.4k
    decl_type *D = static_cast<decl_type*>(this);
318
17.4k
    if (!D->isFromASTFile())
319
17.3k
      return D;
320
161
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
321
17.4k
  }
322
323
  /// \brief Return the first declaration of this declaration or itself if this
324
  /// is the only declaration.
325
2.21M
  const decl_type *getFirstDecl() const {
326
2.21M
    const decl_type *D = static_cast<const decl_type*>(this);
327
2.21M
    if (!D->isFromASTFile())
328
2.20M
      return D;
329
6.24k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
330
2.21M
  }
clang::Mergeable<clang::UsingDecl>::getFirstDecl() const
Line
Count
Source
325
6
  const decl_type *getFirstDecl() const {
326
6
    const decl_type *D = static_cast<const decl_type*>(this);
327
6
    if (!D->isFromASTFile())
328
6
      return D;
329
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
330
6
  }
Unexecuted instantiation: clang::Mergeable<clang::UsingPackDecl>::getFirstDecl() const
clang::Mergeable<clang::UnresolvedUsingValueDecl>::getFirstDecl() const
Line
Count
Source
325
2
  const decl_type *getFirstDecl() const {
326
2
    const decl_type *D = static_cast<const decl_type*>(this);
327
2
    if (!D->isFromASTFile())
328
2
      return D;
329
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
330
2
  }
clang::Mergeable<clang::UnresolvedUsingTypenameDecl>::getFirstDecl() const
Line
Count
Source
325
2
  const decl_type *getFirstDecl() const {
326
2
    const decl_type *D = static_cast<const decl_type*>(this);
327
2
    if (!D->isFromASTFile())
328
2
      return D;
329
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
330
2
  }
clang::Mergeable<clang::FieldDecl>::getFirstDecl() const
Line
Count
Source
325
2.21M
  const decl_type *getFirstDecl() const {
326
2.21M
    const decl_type *D = static_cast<const decl_type*>(this);
327
2.21M
    if (!D->isFromASTFile())
328
2.20M
      return D;
329
6.24k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
330
2.21M
  }
clang::Mergeable<clang::EnumConstantDecl>::getFirstDecl() const
Line
Count
Source
325
61
  const decl_type *getFirstDecl() const {
326
61
    const decl_type *D = static_cast<const decl_type*>(this);
327
61
    if (!D->isFromASTFile())
328
61
      return D;
329
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
330
61
  }
clang::Mergeable<clang::IndirectFieldDecl>::getFirstDecl() const
Line
Count
Source
325
8
  const decl_type *getFirstDecl() const {
326
8
    const decl_type *D = static_cast<const decl_type*>(this);
327
8
    if (!D->isFromASTFile())
328
8
      return D;
329
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
330
8
  }
331
332
  /// \brief Returns true if this is the first declaration.
333
  bool isFirstDecl() const { return getFirstDecl() == this; }
334
};
335
336
/// A wrapper class around a pointer that always points to its canonical
337
/// declaration.
338
///
339
/// CanonicalDeclPtr<decl_type> behaves just like decl_type*, except we call
340
/// decl_type::getCanonicalDecl() on construction.
341
///
342
/// This is useful for hashtables that you want to be keyed on a declaration's
343
/// canonical decl -- if you use CanonicalDeclPtr as the key, you don't need to
344
/// remember to call getCanonicalDecl() everywhere.
345
template <typename decl_type> class CanonicalDeclPtr {
346
public:
347
15.9k
  CanonicalDeclPtr() : Ptr(nullptr) {}
clang::CanonicalDeclPtr<clang::FunctionDecl>::CanonicalDeclPtr()
Line
Count
Source
347
15.3k
  CanonicalDeclPtr() : Ptr(nullptr) {}
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::CanonicalDeclPtr()
Line
Count
Source
347
609
  CanonicalDeclPtr() : Ptr(nullptr) {}
348
  CanonicalDeclPtr(decl_type *Ptr)
349
9.69k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::CanonicalDeclPtr(clang::CXXRecordDecl const*)
Line
Count
Source
349
109
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::FunctionDecl>::CanonicalDeclPtr(clang::FunctionDecl*)
Line
Count
Source
349
9.58k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
350
  CanonicalDeclPtr(const CanonicalDeclPtr &) = default;
351
  CanonicalDeclPtr &operator=(const CanonicalDeclPtr &) = default;
352
353
161
  operator decl_type *() { return Ptr; }
354
110k
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::FunctionDecl>::operator clang::FunctionDecl const*() const
Line
Count
Source
354
97.7k
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::operator clang::CXXRecordDecl const*() const
Line
Count
Source
354
13.1k
  operator const decl_type *() const { return Ptr; }
355
356
  decl_type *operator->() { return Ptr; }
357
  const decl_type *operator->() const { return Ptr; }
358
359
  decl_type &operator*() { return *Ptr; }
360
  const decl_type &operator*() const { return *Ptr; }
361
362
private:
363
  friend struct llvm::DenseMapInfo<CanonicalDeclPtr<decl_type>>;
364
365
  decl_type *Ptr;
366
};
367
} // namespace clang
368
369
namespace llvm {
370
template <typename decl_type>
371
struct DenseMapInfo<clang::CanonicalDeclPtr<decl_type>> {
372
  using CanonicalDeclPtr = clang::CanonicalDeclPtr<decl_type>;
373
  using BaseInfo = DenseMapInfo<decl_type *>;
374
375
8.61k
  static CanonicalDeclPtr getEmptyKey() {
376
8.61k
    // Construct our CanonicalDeclPtr this way because the regular constructor
377
8.61k
    // would dereference P.Ptr, which is not allowed.
378
8.61k
    CanonicalDeclPtr P;
379
8.61k
    P.Ptr = BaseInfo::getEmptyKey();
380
8.61k
    return P;
381
8.61k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::getEmptyKey()
Line
Count
Source
375
8.21k
  static CanonicalDeclPtr getEmptyKey() {
376
8.21k
    // Construct our CanonicalDeclPtr this way because the regular constructor
377
8.21k
    // would dereference P.Ptr, which is not allowed.
378
8.21k
    CanonicalDeclPtr P;
379
8.21k
    P.Ptr = BaseInfo::getEmptyKey();
380
8.21k
    return P;
381
8.21k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::getEmptyKey()
Line
Count
Source
375
405
  static CanonicalDeclPtr getEmptyKey() {
376
405
    // Construct our CanonicalDeclPtr this way because the regular constructor
377
405
    // would dereference P.Ptr, which is not allowed.
378
405
    CanonicalDeclPtr P;
379
405
    P.Ptr = BaseInfo::getEmptyKey();
380
405
    return P;
381
405
  }
382
383
6.20k
  static CanonicalDeclPtr getTombstoneKey() {
384
6.20k
    CanonicalDeclPtr P;
385
6.20k
    P.Ptr = BaseInfo::getTombstoneKey();
386
6.20k
    return P;
387
6.20k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::getTombstoneKey()
Line
Count
Source
383
6.00k
  static CanonicalDeclPtr getTombstoneKey() {
384
6.00k
    CanonicalDeclPtr P;
385
6.00k
    P.Ptr = BaseInfo::getTombstoneKey();
386
6.00k
    return P;
387
6.00k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::getTombstoneKey()
Line
Count
Source
383
204
  static CanonicalDeclPtr getTombstoneKey() {
384
204
    CanonicalDeclPtr P;
385
204
    P.Ptr = BaseInfo::getTombstoneKey();
386
204
    return P;
387
204
  }
388
389
5.61k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
390
5.61k
    return BaseInfo::getHashValue(P);
391
5.61k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::getHashValue(clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&)
Line
Count
Source
389
109
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
390
109
    return BaseInfo::getHashValue(P);
391
109
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::getHashValue(clang::CanonicalDeclPtr<clang::FunctionDecl> const&)
Line
Count
Source
389
5.51k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
390
5.51k
    return BaseInfo::getHashValue(P);
391
5.51k
  }
392
393
  static bool isEqual(const CanonicalDeclPtr &LHS,
394
50.6k
                      const CanonicalDeclPtr &RHS) {
395
50.6k
    return BaseInfo::isEqual(LHS, RHS);
396
50.6k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::isEqual(clang::CanonicalDeclPtr<clang::FunctionDecl> const&, clang::CanonicalDeclPtr<clang::FunctionDecl> const&)
Line
Count
Source
394
44.1k
                      const CanonicalDeclPtr &RHS) {
395
44.1k
    return BaseInfo::isEqual(LHS, RHS);
396
44.1k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::isEqual(clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&, clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&)
Line
Count
Source
394
6.50k
                      const CanonicalDeclPtr &RHS) {
395
6.50k
    return BaseInfo::isEqual(LHS, RHS);
396
6.50k
  }
397
};
398
} // namespace llvm
399
400
#endif