Coverage Report

Created: 2018-07-22 10:17

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/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/ADT/DenseMapInfo.h"
19
#include "llvm/ADT/PointerUnion.h"
20
#include "llvm/ADT/iterator_range.h"
21
#include "llvm/Support/Casting.h"
22
#include <cassert>
23
#include <cstddef>
24
#include <iterator>
25
26
namespace clang {
27
28
class ASTContext;
29
class Decl;
30
31
// Some notes on redeclarables:
32
//
33
//  - Every redeclarable is on a circular linked list.
34
//
35
//  - Every decl has a pointer to the first element of the chain _and_ a
36
//    DeclLink that may point to one of 3 possible states:
37
//      - the "previous" (temporal) element in the chain
38
//      - the "latest" (temporal) element in the chain
39
//      - the "uninitialized-latest" value (when newly-constructed)
40
//
41
//  - The first element is also often called the canonical element. Every
42
//    element has a pointer to it so that "getCanonical" can be fast.
43
//
44
//  - Most links in the chain point to previous, except the link out of
45
//    the first; it points to latest.
46
//
47
//  - Elements are called "first", "previous", "latest" or
48
//    "most-recent" when referring to temporal order: order of addition
49
//    to the chain.
50
//
51
//  - It's easiest to just ignore the implementation of DeclLink when making
52
//    sense of the redeclaration chain.
53
//
54
//  - There's also a "definition" link for several types of
55
//    redeclarable, where only one definition should exist at any given
56
//    time (and the defn pointer is stored in the decl's "data" which
57
//    is copied to every element on the chain when it's changed).
58
//
59
//    Here is some ASCII art:
60
//
61
//      "first"                                     "latest"
62
//      "canonical"                                 "most recent"
63
//      +------------+         first                +--------------+
64
//      |            | <--------------------------- |              |
65
//      |            |                              |              |
66
//      |            |                              |              |
67
//      |            |       +--------------+       |              |
68
//      |            | first |              |       |              |
69
//      |            | <---- |              |       |              |
70
//      |            |       |              |       |              |
71
//      | @class A   |  link | @interface A |  link | @class A     |
72
//      | seen first | <---- | seen second  | <---- | seen third   |
73
//      |            |       |              |       |              |
74
//      +------------+       +--------------+       +--------------+
75
//      | data       | defn  | data         |  defn | data         |
76
//      |            | ----> |              | <---- |              |
77
//      +------------+       +--------------+       +--------------+
78
//        |                     |     ^                  ^
79
//        |                     |defn |                  |
80
//        | link                +-----+                  |
81
//        +-->-------------------------------------------+
82
83
/// Provides common interface for the Decls that can be redeclared.
84
template<typename decl_type>
85
class Redeclarable {
86
protected:
87
0
  class DeclLink {
88
    /// A pointer to a known latest declaration, either statically known or
89
    /// generationally updated as decls are added by an external source.
90
    using KnownLatest =
91
        LazyGenerationalUpdatePtr<const Decl *, Decl *,
92
                                  &ExternalASTSource::CompleteRedeclChain>;
93
94
    /// We store a pointer to the ASTContext in the UninitializedLatest
95
    /// pointer, but to avoid circular type dependencies when we steal the low
96
    /// bits of this pointer, we use a raw void* here.
97
    using UninitializedLatest = const void *;
98
99
    using Previous = Decl *;
100
101
    /// A pointer to either an uninitialized latest declaration (where either
102
    /// we've not yet set the previous decl or there isn't one), or to a known
103
    /// previous declaration.
104
    using NotKnownLatest = llvm::PointerUnion<Previous, UninitializedLatest>;
105
106
    mutable llvm::PointerUnion<NotKnownLatest, KnownLatest> Link;
107
108
  public:
109
    enum PreviousTag { PreviousLink };
110
    enum LatestTag { LatestLink };
111
112
    DeclLink(LatestTag, const ASTContext &Ctx)
113
32.1M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::TagDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::TagDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
113
3.91M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::FunctionDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::FunctionDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
113
7.76M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
113
2.24M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::VarDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::VarDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
113
16.9M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
113
237
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::NamespaceDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
113
113k
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
113
150k
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
113
29.7k
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
113
3.79k
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
113
991k
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
114
1.62M
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::PreviousTag, clang::TypedefNameDecl*)
Line
Count
Source
114
8.88k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::TagDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::TagDecl>::DeclLink::PreviousTag, clang::TagDecl*)
Line
Count
Source
114
870k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::FunctionDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::FunctionDecl>::DeclLink::PreviousTag, clang::FunctionDecl*)
Line
Count
Source
114
512k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::PreviousTag, clang::ObjCInterfaceDecl*)
Line
Count
Source
114
6.86k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::PreviousTag, clang::ObjCProtocolDecl*)
Line
Count
Source
114
423
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::VarDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::VarDecl>::DeclLink::PreviousTag, clang::VarDecl*)
Line
Count
Source
114
73.8k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::NamespaceDecl>::DeclLink::PreviousTag, clang::NamespaceDecl*)
Line
Count
Source
114
68.4k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::PreviousTag, clang::NamespaceAliasDecl*)
Line
Count
Source
114
15
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::PreviousTag, clang::UsingShadowDecl*)
Line
Count
Source
114
2.84k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::PreviousTag, clang::RedeclarableTemplateDecl*)
Line
Count
Source
114
78.4k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
115
116
411M
    bool isFirst() const {
117
411M
      return Link.is<KnownLatest>() ||
118
411M
             // FIXME: 'template' is required on the next line due to an
119
411M
             // apparent clang bug.
120
411M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()261M
;
121
411M
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::isFirst() const
Line
Count
Source
116
9.98M
    bool isFirst() const {
117
9.98M
      return Link.is<KnownLatest>() ||
118
9.98M
             // FIXME: 'template' is required on the next line due to an
119
9.98M
             // apparent clang bug.
120
9.98M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()4.71M
;
121
9.98M
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::isFirst() const
Line
Count
Source
116
23.8M
    bool isFirst() const {
117
23.8M
      return Link.is<KnownLatest>() ||
118
23.8M
             // FIXME: 'template' is required on the next line due to an
119
23.8M
             // apparent clang bug.
120
23.8M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()7.36M
;
121
23.8M
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::isFirst() const
Line
Count
Source
116
23.0M
    bool isFirst() const {
117
23.0M
      return Link.is<KnownLatest>() ||
118
23.0M
             // FIXME: 'template' is required on the next line due to an
119
23.0M
             // apparent clang bug.
120
23.0M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()1.68M
;
121
23.0M
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::isFirst() const
Line
Count
Source
116
666k
    bool isFirst() const {
117
666k
      return Link.is<KnownLatest>() ||
118
666k
             // FIXME: 'template' is required on the next line due to an
119
666k
             // apparent clang bug.
120
666k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()260k
;
121
666k
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::isFirst() const
Line
Count
Source
116
18.3k
    bool isFirst() const {
117
18.3k
      return Link.is<KnownLatest>() ||
118
18.3k
             // FIXME: 'template' is required on the next line due to an
119
18.3k
             // apparent clang bug.
120
18.3k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()3.69k
;
121
18.3k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::isFirst() const
Line
Count
Source
116
3.81k
    bool isFirst() const {
117
3.81k
      return Link.is<KnownLatest>() ||
118
3.81k
             // FIXME: 'template' is required on the next line due to an
119
3.81k
             // apparent clang bug.
120
3.81k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()485
;
121
3.81k
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::isFirst() const
Line
Count
Source
116
352M
    bool isFirst() const {
117
352M
      return Link.is<KnownLatest>() ||
118
352M
             // FIXME: 'template' is required on the next line due to an
119
352M
             // apparent clang bug.
120
352M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()246M
;
121
352M
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::isFirst() const
Line
Count
Source
116
20
    bool isFirst() const {
117
20
      return Link.is<KnownLatest>() ||
118
20
             // FIXME: 'template' is required on the next line due to an
119
20
             // apparent clang bug.
120
20
             Link.get<NotKnownLatest>().template is<UninitializedLatest>();
121
20
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::isFirst() const
Line
Count
Source
116
1.03k
    bool isFirst() const {
117
1.03k
      return Link.is<KnownLatest>() ||
118
1.03k
             // FIXME: 'template' is required on the next line due to an
119
1.03k
             // apparent clang bug.
120
1.03k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()368
;
121
1.03k
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::isFirst() const
Line
Count
Source
116
1.13M
    bool isFirst() const {
117
1.13M
      return Link.is<KnownLatest>() ||
118
1.13M
             // FIXME: 'template' is required on the next line due to an
119
1.13M
             // apparent clang bug.
120
1.13M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()800k
;
121
1.13M
    }
122
123
420M
    decl_type *getPrevious(const decl_type *D) const {
124
420M
      if (Link.is<NotKnownLatest>()) {
125
22.9M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
22.9M
        if (NKL.is<Previous>())
127
6.07M
          return static_cast<decl_type*>(NKL.get<Previous>());
128
16.9M
129
16.9M
        // Allocate the generational 'most recent' cache now, if needed.
130
16.9M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
16.9M
                               NKL.get<UninitializedLatest>()),
132
16.9M
                           const_cast<decl_type *>(D));
133
16.9M
      }
134
420M
135
420M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))414M
;
136
420M
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::getPrevious(clang::TagDecl const*) const
Line
Count
Source
123
307M
    decl_type *getPrevious(const decl_type *D) const {
124
307M
      if (Link.is<NotKnownLatest>()) {
125
1.70M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
1.70M
        if (NKL.is<Previous>())
127
1.70M
          return static_cast<decl_type*>(NKL.get<Previous>());
128
0
129
0
        // Allocate the generational 'most recent' cache now, if needed.
130
0
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
0
                               NKL.get<UninitializedLatest>()),
132
0
                           const_cast<decl_type *>(D));
133
0
      }
134
307M
135
307M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))305M
;
136
307M
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::getPrevious(clang::VarDecl const*) const
Line
Count
Source
123
54.4M
    decl_type *getPrevious(const decl_type *D) const {
124
54.4M
      if (Link.is<NotKnownLatest>()) {
125
12.4M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
12.4M
        if (NKL.is<Previous>())
127
2.69M
          return static_cast<decl_type*>(NKL.get<Previous>());
128
9.78M
129
9.78M
        // Allocate the generational 'most recent' cache now, if needed.
130
9.78M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
9.78M
                               NKL.get<UninitializedLatest>()),
132
9.78M
                           const_cast<decl_type *>(D));
133
9.78M
      }
134
54.4M
135
54.4M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))51.7M
;
136
54.4M
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::getPrevious(clang::ObjCInterfaceDecl const*) const
Line
Count
Source
123
31.7k
    decl_type *getPrevious(const decl_type *D) const {
124
31.7k
      if (Link.is<NotKnownLatest>()) {
125
3.86k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
3.86k
        if (NKL.is<Previous>())
127
3.86k
          return static_cast<decl_type*>(NKL.get<Previous>());
128
0
129
0
        // Allocate the generational 'most recent' cache now, if needed.
130
0
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
0
                               NKL.get<UninitializedLatest>()),
132
0
                           const_cast<decl_type *>(D));
133
0
      }
134
31.7k
135
31.7k
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))27.8k
;
136
31.7k
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::getPrevious(clang::FunctionDecl const*) const
Line
Count
Source
123
44.1M
    decl_type *getPrevious(const decl_type *D) const {
124
44.1M
      if (Link.is<NotKnownLatest>()) {
125
7.54M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
7.54M
        if (NKL.is<Previous>())
127
1.19M
          return static_cast<decl_type*>(NKL.get<Previous>());
128
6.35M
129
6.35M
        // Allocate the generational 'most recent' cache now, if needed.
130
6.35M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
6.35M
                               NKL.get<UninitializedLatest>()),
132
6.35M
                           const_cast<decl_type *>(D));
133
6.35M
      }
134
44.1M
135
44.1M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))42.9M
;
136
44.1M
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::getPrevious(clang::ObjCProtocolDecl const*) const
Line
Count
Source
123
5.36k
    decl_type *getPrevious(const decl_type *D) const {
124
5.36k
      if (Link.is<NotKnownLatest>()) {
125
565
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
565
        if (NKL.is<Previous>())
127
565
          return static_cast<decl_type*>(NKL.get<Previous>());
128
0
129
0
        // Allocate the generational 'most recent' cache now, if needed.
130
0
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
0
                               NKL.get<UninitializedLatest>()),
132
0
                           const_cast<decl_type *>(D));
133
0
      }
134
5.36k
135
5.36k
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))4.79k
;
136
5.36k
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::getPrevious(clang::TypedefNameDecl const*) const
Line
Count
Source
123
922k
    decl_type *getPrevious(const decl_type *D) const {
124
922k
      if (Link.is<NotKnownLatest>()) {
125
303k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
303k
        if (NKL.is<Previous>())
127
9.61k
          return static_cast<decl_type*>(NKL.get<Previous>());
128
294k
129
294k
        // Allocate the generational 'most recent' cache now, if needed.
130
294k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
294k
                               NKL.get<UninitializedLatest>()),
132
294k
                           const_cast<decl_type *>(D));
133
294k
      }
134
922k
135
922k
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))912k
;
136
922k
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::getPrevious(clang::UsingShadowDecl const*) const
Line
Count
Source
123
452k
    decl_type *getPrevious(const decl_type *D) const {
124
452k
      if (Link.is<NotKnownLatest>()) {
125
5.39k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
5.39k
        if (NKL.is<Previous>())
127
5.39k
          return static_cast<decl_type*>(NKL.get<Previous>());
128
4
129
4
        // Allocate the generational 'most recent' cache now, if needed.
130
4
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
4
                               NKL.get<UninitializedLatest>()),
132
4
                           const_cast<decl_type *>(D));
133
4
      }
134
452k
135
452k
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))447k
;
136
452k
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::getPrevious(clang::RedeclarableTemplateDecl const*) const
Line
Count
Source
123
12.4M
    decl_type *getPrevious(const decl_type *D) const {
124
12.4M
      if (Link.is<NotKnownLatest>()) {
125
639k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
639k
        if (NKL.is<Previous>())
127
153k
          return static_cast<decl_type*>(NKL.get<Previous>());
128
485k
129
485k
        // Allocate the generational 'most recent' cache now, if needed.
130
485k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
485k
                               NKL.get<UninitializedLatest>()),
132
485k
                           const_cast<decl_type *>(D));
133
485k
      }
134
12.4M
135
12.4M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))12.2M
;
136
12.4M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::getPrevious(clang::NamespaceDecl const*) const
Line
Count
Source
123
496k
    decl_type *getPrevious(const decl_type *D) const {
124
496k
      if (Link.is<NotKnownLatest>()) {
125
306k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
306k
        if (NKL.is<Previous>())
127
306k
          return static_cast<decl_type*>(NKL.get<Previous>());
128
0
129
0
        // Allocate the generational 'most recent' cache now, if needed.
130
0
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
0
                               NKL.get<UninitializedLatest>()),
132
0
                           const_cast<decl_type *>(D));
133
0
      }
134
496k
135
496k
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))190k
;
136
496k
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::getPrevious(clang::NamespaceAliasDecl const*) const
Line
Count
Source
123
200
    decl_type *getPrevious(const decl_type *D) const {
124
200
      if (Link.is<NotKnownLatest>()) {
125
63
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
63
        if (NKL.is<Previous>())
127
1
          return static_cast<decl_type*>(NKL.get<Previous>());
128
62
129
62
        // Allocate the generational 'most recent' cache now, if needed.
130
62
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
62
                               NKL.get<UninitializedLatest>()),
132
62
                           const_cast<decl_type *>(D));
133
62
      }
134
200
135
200
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))199
;
136
200
    }
137
138
9.13k
    void setPrevious(decl_type *D) {
139
9.13k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
140
9.13k
      Link = Previous(D);
141
9.13k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::setPrevious(clang::VarDecl*)
Line
Count
Source
138
1.03k
    void setPrevious(decl_type *D) {
139
1.03k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
140
1.03k
      Link = Previous(D);
141
1.03k
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::setPrevious(clang::FunctionDecl*)
Line
Count
Source
138
1.62k
    void setPrevious(decl_type *D) {
139
1.62k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
140
1.62k
      Link = Previous(D);
141
1.62k
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::setPrevious(clang::NamespaceDecl*)
Line
Count
Source
138
347
    void setPrevious(decl_type *D) {
139
347
      assert(!isFirst() && "decl became non-canonical unexpectedly");
140
347
      Link = Previous(D);
141
347
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::setPrevious(clang::NamespaceAliasDecl*)
Line
Count
Source
138
3
    void setPrevious(decl_type *D) {
139
3
      assert(!isFirst() && "decl became non-canonical unexpectedly");
140
3
      Link = Previous(D);
141
3
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::setPrevious(clang::ObjCInterfaceDecl*)
Line
Count
Source
138
104
    void setPrevious(decl_type *D) {
139
104
      assert(!isFirst() && "decl became non-canonical unexpectedly");
140
104
      Link = Previous(D);
141
104
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::setPrevious(clang::ObjCProtocolDecl*)
Line
Count
Source
138
37
    void setPrevious(decl_type *D) {
139
37
      assert(!isFirst() && "decl became non-canonical unexpectedly");
140
37
      Link = Previous(D);
141
37
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::setPrevious(clang::RedeclarableTemplateDecl*)
Line
Count
Source
138
646
    void setPrevious(decl_type *D) {
139
646
      assert(!isFirst() && "decl became non-canonical unexpectedly");
140
646
      Link = Previous(D);
141
646
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::setPrevious(clang::TagDecl*)
Line
Count
Source
138
3.11k
    void setPrevious(decl_type *D) {
139
3.11k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
140
3.11k
      Link = Previous(D);
141
3.11k
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::setPrevious(clang::TypedefNameDecl*)
Line
Count
Source
138
2.20k
    void setPrevious(decl_type *D) {
139
2.20k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
140
2.20k
      Link = Previous(D);
141
2.20k
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::setPrevious(clang::UsingShadowDecl*)
Line
Count
Source
138
11
    void setPrevious(decl_type *D) {
139
11
      assert(!isFirst() && "decl became non-canonical unexpectedly");
140
11
      Link = Previous(D);
141
11
    }
142
143
5.31M
    void setLatest(decl_type *D) {
144
5.31M
      assert(isFirst() && "decl became canonical unexpectedly");
145
5.31M
      if (Link.is<NotKnownLatest>()) {
146
3.66M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
3.66M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
3.66M
                               NKL.get<UninitializedLatest>()),
149
3.66M
                           D);
150
3.66M
      } else {
151
1.64M
        auto Latest = Link.get<KnownLatest>();
152
1.64M
        Latest.set(D);
153
1.64M
        Link = Latest;
154
1.64M
      }
155
5.31M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::setLatest(clang::NamespaceDecl*)
Line
Count
Source
143
114k
    void setLatest(decl_type *D) {
144
114k
      assert(isFirst() && "decl became canonical unexpectedly");
145
114k
      if (Link.is<NotKnownLatest>()) {
146
45.4k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
45.4k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
45.4k
                               NKL.get<UninitializedLatest>()),
149
45.4k
                           D);
150
68.8k
      } else {
151
68.8k
        auto Latest = Link.get<KnownLatest>();
152
68.8k
        Latest.set(D);
153
68.8k
        Link = Latest;
154
68.8k
      }
155
114k
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::setLatest(clang::NamespaceAliasDecl*)
Line
Count
Source
143
32
    void setLatest(decl_type *D) {
144
32
      assert(isFirst() && "decl became canonical unexpectedly");
145
32
      if (Link.is<NotKnownLatest>()) {
146
17
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
17
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
17
                               NKL.get<UninitializedLatest>()),
149
17
                           D);
150
17
      } else {
151
15
        auto Latest = Link.get<KnownLatest>();
152
15
        Latest.set(D);
153
15
        Link = Latest;
154
15
      }
155
32
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::setLatest(clang::ObjCInterfaceDecl*)
Line
Count
Source
143
30.0k
    void setLatest(decl_type *D) {
144
30.0k
      assert(isFirst() && "decl became canonical unexpectedly");
145
30.0k
      if (Link.is<NotKnownLatest>()) {
146
22.9k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
22.9k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
22.9k
                               NKL.get<UninitializedLatest>()),
149
22.9k
                           D);
150
22.9k
      } else {
151
7.11k
        auto Latest = Link.get<KnownLatest>();
152
7.11k
        Latest.set(D);
153
7.11k
        Link = Latest;
154
7.11k
      }
155
30.0k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::setLatest(clang::ObjCProtocolDecl*)
Line
Count
Source
143
3.89k
    void setLatest(decl_type *D) {
144
3.89k
      assert(isFirst() && "decl became canonical unexpectedly");
145
3.89k
      if (Link.is<NotKnownLatest>()) {
146
3.40k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
3.40k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
3.40k
                               NKL.get<UninitializedLatest>()),
149
3.40k
                           D);
150
3.40k
      } else {
151
484
        auto Latest = Link.get<KnownLatest>();
152
484
        Latest.set(D);
153
484
        Link = Latest;
154
484
      }
155
3.89k
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::setLatest(clang::RedeclarableTemplateDecl*)
Line
Count
Source
143
323k
    void setLatest(decl_type *D) {
144
323k
      assert(isFirst() && "decl became canonical unexpectedly");
145
323k
      if (Link.is<NotKnownLatest>()) {
146
245k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
245k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
245k
                               NKL.get<UninitializedLatest>()),
149
245k
                           D);
150
245k
      } else {
151
78.3k
        auto Latest = Link.get<KnownLatest>();
152
78.3k
        Latest.set(D);
153
78.3k
        Link = Latest;
154
78.3k
      }
155
323k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::setLatest(clang::TagDecl*)
Line
Count
Source
143
3.94M
    void setLatest(decl_type *D) {
144
3.94M
      assert(isFirst() && "decl became canonical unexpectedly");
145
3.94M
      if (Link.is<NotKnownLatest>()) {
146
3.04M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
3.04M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
3.04M
                               NKL.get<UninitializedLatest>()),
149
3.04M
                           D);
150
3.04M
      } else {
151
898k
        auto Latest = Link.get<KnownLatest>();
152
898k
        Latest.set(D);
153
898k
        Link = Latest;
154
898k
      }
155
3.94M
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::setLatest(clang::TypedefNameDecl*)
Line
Count
Source
143
12.2k
    void setLatest(decl_type *D) {
144
12.2k
      assert(isFirst() && "decl became canonical unexpectedly");
145
12.2k
      if (Link.is<NotKnownLatest>()) {
146
5.44k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
5.44k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
5.44k
                               NKL.get<UninitializedLatest>()),
149
5.44k
                           D);
150
6.76k
      } else {
151
6.76k
        auto Latest = Link.get<KnownLatest>();
152
6.76k
        Latest.set(D);
153
6.76k
        Link = Latest;
154
6.76k
      }
155
12.2k
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::setLatest(clang::UsingShadowDecl*)
Line
Count
Source
143
150k
    void setLatest(decl_type *D) {
144
150k
      assert(isFirst() && "decl became canonical unexpectedly");
145
150k
      if (Link.is<NotKnownLatest>()) {
146
147k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
147k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
147k
                               NKL.get<UninitializedLatest>()),
149
147k
                           D);
150
147k
      } else {
151
2.83k
        auto Latest = Link.get<KnownLatest>();
152
2.83k
        Latest.set(D);
153
2.83k
        Link = Latest;
154
2.83k
      }
155
150k
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::setLatest(clang::FunctionDecl*)
Line
Count
Source
143
531k
    void setLatest(decl_type *D) {
144
531k
      assert(isFirst() && "decl became canonical unexpectedly");
145
531k
      if (Link.is<NotKnownLatest>()) {
146
20.0k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
20.0k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
20.0k
                               NKL.get<UninitializedLatest>()),
149
20.0k
                           D);
150
511k
      } else {
151
511k
        auto Latest = Link.get<KnownLatest>();
152
511k
        Latest.set(D);
153
511k
        Link = Latest;
154
511k
      }
155
531k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::setLatest(clang::VarDecl*)
Line
Count
Source
143
202k
    void setLatest(decl_type *D) {
144
202k
      assert(isFirst() && "decl became canonical unexpectedly");
145
202k
      if (Link.is<NotKnownLatest>()) {
146
128k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
128k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
128k
                               NKL.get<UninitializedLatest>()),
149
128k
                           D);
150
128k
      } else {
151
73.6k
        auto Latest = Link.get<KnownLatest>();
152
73.6k
        Latest.set(D);
153
73.6k
        Link = Latest;
154
73.6k
      }
155
202k
    }
156
157
5.35k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::markIncomplete()
Line
Count
Source
157
2
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
Unexecuted instantiation: clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::markIncomplete()
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::markIncomplete()
Line
Count
Source
157
121
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::markIncomplete()
Line
Count
Source
157
1
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
Unexecuted instantiation: clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::markIncomplete()
clang::Redeclarable<clang::TagDecl>::DeclLink::markIncomplete()
Line
Count
Source
157
3.95k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
Unexecuted instantiation: clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::markIncomplete()
Unexecuted instantiation: clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::markIncomplete()
clang::Redeclarable<clang::FunctionDecl>::DeclLink::markIncomplete()
Line
Count
Source
157
1.25k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::VarDecl>::DeclLink::markIncomplete()
Line
Count
Source
157
25
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
158
159
8.38k
    Decl *getLatestNotUpdated() const {
160
8.38k
      assert(isFirst() && "expected a canonical decl");
161
8.38k
      if (Link.is<NotKnownLatest>())
162
77
        return nullptr;
163
8.30k
      return Link.get<KnownLatest>().getNotUpdated();
164
8.30k
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
159
233
    Decl *getLatestNotUpdated() const {
160
233
      assert(isFirst() && "expected a canonical decl");
161
233
      if (Link.is<NotKnownLatest>())
162
0
        return nullptr;
163
233
      return Link.get<KnownLatest>().getNotUpdated();
164
233
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
159
3
    Decl *getLatestNotUpdated() const {
160
3
      assert(isFirst() && "expected a canonical decl");
161
3
      if (Link.is<NotKnownLatest>())
162
0
        return nullptr;
163
3
      return Link.get<KnownLatest>().getNotUpdated();
164
3
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
159
331
    Decl *getLatestNotUpdated() const {
160
331
      assert(isFirst() && "expected a canonical decl");
161
331
      if (Link.is<NotKnownLatest>())
162
0
        return nullptr;
163
331
      return Link.get<KnownLatest>().getNotUpdated();
164
331
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
159
74
    Decl *getLatestNotUpdated() const {
160
74
      assert(isFirst() && "expected a canonical decl");
161
74
      if (Link.is<NotKnownLatest>())
162
0
        return nullptr;
163
74
      return Link.get<KnownLatest>().getNotUpdated();
164
74
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
159
4.07k
    Decl *getLatestNotUpdated() const {
160
4.07k
      assert(isFirst() && "expected a canonical decl");
161
4.07k
      if (Link.is<NotKnownLatest>())
162
9
        return nullptr;
163
4.07k
      return Link.get<KnownLatest>().getNotUpdated();
164
4.07k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
159
1.56k
    Decl *getLatestNotUpdated() const {
160
1.56k
      assert(isFirst() && "expected a canonical decl");
161
1.56k
      if (Link.is<NotKnownLatest>())
162
0
        return nullptr;
163
1.56k
      return Link.get<KnownLatest>().getNotUpdated();
164
1.56k
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
159
107
    Decl *getLatestNotUpdated() const {
160
107
      assert(isFirst() && "expected a canonical decl");
161
107
      if (Link.is<NotKnownLatest>())
162
17
        return nullptr;
163
90
      return Link.get<KnownLatest>().getNotUpdated();
164
90
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
159
1
    Decl *getLatestNotUpdated() const {
160
1
      assert(isFirst() && "expected a canonical decl");
161
1
      if (Link.is<NotKnownLatest>())
162
0
        return nullptr;
163
1
      return Link.get<KnownLatest>().getNotUpdated();
164
1
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
159
1.13k
    Decl *getLatestNotUpdated() const {
160
1.13k
      assert(isFirst() && "expected a canonical decl");
161
1.13k
      if (Link.is<NotKnownLatest>())
162
51
        return nullptr;
163
1.08k
      return Link.get<KnownLatest>().getNotUpdated();
164
1.08k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
159
855
    Decl *getLatestNotUpdated() const {
160
855
      assert(isFirst() && "expected a canonical decl");
161
855
      if (Link.is<NotKnownLatest>())
162
0
        return nullptr;
163
855
      return Link.get<KnownLatest>().getNotUpdated();
164
855
    }
165
  };
166
167
1.62M
  static DeclLink PreviousDeclLink(decl_type *D) {
168
1.62M
    return DeclLink(DeclLink::PreviousLink, D);
169
1.62M
  }
clang::Redeclarable<clang::TypedefNameDecl>::PreviousDeclLink(clang::TypedefNameDecl*)
Line
Count
Source
167
8.88k
  static DeclLink PreviousDeclLink(decl_type *D) {
168
8.88k
    return DeclLink(DeclLink::PreviousLink, D);
169
8.88k
  }
clang::Redeclarable<clang::TagDecl>::PreviousDeclLink(clang::TagDecl*)
Line
Count
Source
167
870k
  static DeclLink PreviousDeclLink(decl_type *D) {
168
870k
    return DeclLink(DeclLink::PreviousLink, D);
169
870k
  }
clang::Redeclarable<clang::FunctionDecl>::PreviousDeclLink(clang::FunctionDecl*)
Line
Count
Source
167
512k
  static DeclLink PreviousDeclLink(decl_type *D) {
168
512k
    return DeclLink(DeclLink::PreviousLink, D);
169
512k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::PreviousDeclLink(clang::ObjCInterfaceDecl*)
Line
Count
Source
167
6.86k
  static DeclLink PreviousDeclLink(decl_type *D) {
168
6.86k
    return DeclLink(DeclLink::PreviousLink, D);
169
6.86k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::PreviousDeclLink(clang::ObjCProtocolDecl*)
Line
Count
Source
167
423
  static DeclLink PreviousDeclLink(decl_type *D) {
168
423
    return DeclLink(DeclLink::PreviousLink, D);
169
423
  }
clang::Redeclarable<clang::VarDecl>::PreviousDeclLink(clang::VarDecl*)
Line
Count
Source
167
73.8k
  static DeclLink PreviousDeclLink(decl_type *D) {
168
73.8k
    return DeclLink(DeclLink::PreviousLink, D);
169
73.8k
  }
clang::Redeclarable<clang::NamespaceDecl>::PreviousDeclLink(clang::NamespaceDecl*)
Line
Count
Source
167
68.4k
  static DeclLink PreviousDeclLink(decl_type *D) {
168
68.4k
    return DeclLink(DeclLink::PreviousLink, D);
169
68.4k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::PreviousDeclLink(clang::NamespaceAliasDecl*)
Line
Count
Source
167
15
  static DeclLink PreviousDeclLink(decl_type *D) {
168
15
    return DeclLink(DeclLink::PreviousLink, D);
169
15
  }
clang::Redeclarable<clang::UsingShadowDecl>::PreviousDeclLink(clang::UsingShadowDecl*)
Line
Count
Source
167
2.84k
  static DeclLink PreviousDeclLink(decl_type *D) {
168
2.84k
    return DeclLink(DeclLink::PreviousLink, D);
169
2.84k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::PreviousDeclLink(clang::RedeclarableTemplateDecl*)
Line
Count
Source
167
78.4k
  static DeclLink PreviousDeclLink(decl_type *D) {
168
78.4k
    return DeclLink(DeclLink::PreviousLink, D);
169
78.4k
  }
170
171
32.1M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
32.1M
    return DeclLink(DeclLink::LatestLink, Ctx);
173
32.1M
  }
clang::Redeclarable<clang::TagDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
3.91M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
3.91M
    return DeclLink(DeclLink::LatestLink, Ctx);
173
3.91M
  }
clang::Redeclarable<clang::FunctionDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
7.76M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
7.76M
    return DeclLink(DeclLink::LatestLink, Ctx);
173
7.76M
  }
clang::Redeclarable<clang::TypedefNameDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
2.24M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
2.24M
    return DeclLink(DeclLink::LatestLink, Ctx);
173
2.24M
  }
clang::Redeclarable<clang::VarDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
16.9M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
16.9M
    return DeclLink(DeclLink::LatestLink, Ctx);
173
16.9M
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
237
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
237
    return DeclLink(DeclLink::LatestLink, Ctx);
173
237
  }
clang::Redeclarable<clang::NamespaceDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
113k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
113k
    return DeclLink(DeclLink::LatestLink, Ctx);
173
113k
  }
clang::Redeclarable<clang::UsingShadowDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
150k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
150k
    return DeclLink(DeclLink::LatestLink, Ctx);
173
150k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
29.7k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
29.7k
    return DeclLink(DeclLink::LatestLink, Ctx);
173
29.7k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
3.79k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
3.79k
    return DeclLink(DeclLink::LatestLink, Ctx);
173
3.79k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
991k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
991k
    return DeclLink(DeclLink::LatestLink, Ctx);
173
991k
  }
174
175
  /// Points to the next redeclaration in the chain.
176
  ///
177
  /// If isFirst() is false, this is a link to the previous declaration
178
  /// of this same Decl. If isFirst() is true, this is the first
179
  /// declaration and Link points to the latest declaration. For example:
180
  ///
181
  ///  #1 int f(int x, int y = 1); // <pointer to #3, true>
182
  ///  #2 int f(int x = 0, int y); // <pointer to #1, false>
183
  ///  #3 int f(int x, int y) { return x + y; } // <pointer to #2, false>
184
  ///
185
  /// If there is only one declaration, it is <pointer to self, true>
186
  DeclLink RedeclLink;
187
188
  decl_type *First;
189
190
420M
  decl_type *getNextRedeclaration() const {
191
420M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
420M
  }
clang::Redeclarable<clang::TagDecl>::getNextRedeclaration() const
Line
Count
Source
190
307M
  decl_type *getNextRedeclaration() const {
191
307M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
307M
  }
clang::Redeclarable<clang::VarDecl>::getNextRedeclaration() const
Line
Count
Source
190
54.4M
  decl_type *getNextRedeclaration() const {
191
54.4M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
54.4M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getNextRedeclaration() const
Line
Count
Source
190
31.7k
  decl_type *getNextRedeclaration() const {
191
31.7k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
31.7k
  }
clang::Redeclarable<clang::FunctionDecl>::getNextRedeclaration() const
Line
Count
Source
190
44.1M
  decl_type *getNextRedeclaration() const {
191
44.1M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
44.1M
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getNextRedeclaration() const
Line
Count
Source
190
5.36k
  decl_type *getNextRedeclaration() const {
191
5.36k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
5.36k
  }
clang::Redeclarable<clang::NamespaceDecl>::getNextRedeclaration() const
Line
Count
Source
190
496k
  decl_type *getNextRedeclaration() const {
191
496k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
496k
  }
clang::Redeclarable<clang::TypedefNameDecl>::getNextRedeclaration() const
Line
Count
Source
190
922k
  decl_type *getNextRedeclaration() const {
191
922k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
922k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getNextRedeclaration() const
Line
Count
Source
190
200
  decl_type *getNextRedeclaration() const {
191
200
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
200
  }
clang::Redeclarable<clang::UsingShadowDecl>::getNextRedeclaration() const
Line
Count
Source
190
452k
  decl_type *getNextRedeclaration() const {
191
452k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
452k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getNextRedeclaration() const
Line
Count
Source
190
12.4M
  decl_type *getNextRedeclaration() const {
191
12.4M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
12.4M
  }
193
194
public:
195
  friend class ASTDeclReader;
196
  friend class ASTDeclWriter;
197
198
  Redeclarable(const ASTContext &Ctx)
199
      : RedeclLink(LatestDeclLink(Ctx)),
200
32.1M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::TagDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
3.91M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::FunctionDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
7.76M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::TypedefNameDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
2.24M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::VarDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
16.9M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::NamespaceAliasDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
237
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::NamespaceDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
113k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::UsingShadowDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
150k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
29.7k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
3.79k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::RedeclarableTemplateDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
991k
        First(static_cast<decl_type *>(this)) {}
201
202
  /// Return the previous declaration of this declaration or NULL if this
203
  /// is the first declaration.
204
11.2M
  decl_type *getPreviousDecl() {
205
11.2M
    if (!RedeclLink.isFirst())
206
1.44M
      return getNextRedeclaration();
207
9.84M
    return nullptr;
208
9.84M
  }
clang::Redeclarable<clang::VarDecl>::getPreviousDecl()
Line
Count
Source
204
496k
  decl_type *getPreviousDecl() {
205
496k
    if (!RedeclLink.isFirst())
206
30.0k
      return getNextRedeclaration();
207
466k
    return nullptr;
208
466k
  }
clang::Redeclarable<clang::FunctionDecl>::getPreviousDecl()
Line
Count
Source
204
5.11M
  decl_type *getPreviousDecl() {
205
5.11M
    if (!RedeclLink.isFirst())
206
309k
      return getNextRedeclaration();
207
4.80M
    return nullptr;
208
4.80M
  }
clang::Redeclarable<clang::TagDecl>::getPreviousDecl()
Line
Count
Source
204
3.84M
  decl_type *getPreviousDecl() {
205
3.84M
    if (!RedeclLink.isFirst())
206
958k
      return getNextRedeclaration();
207
2.88M
    return nullptr;
208
2.88M
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getPreviousDecl()
Line
Count
Source
204
1.12M
  decl_type *getPreviousDecl() {
205
1.12M
    if (!RedeclLink.isFirst())
206
128k
      return getNextRedeclaration();
207
1.00M
    return nullptr;
208
1.00M
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getPreviousDecl()
Line
Count
Source
204
310
  decl_type *getPreviousDecl() {
205
310
    if (!RedeclLink.isFirst())
206
170
      return getNextRedeclaration();
207
140
    return nullptr;
208
140
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getPreviousDecl()
Line
Count
Source
204
3.08k
  decl_type *getPreviousDecl() {
205
3.08k
    if (!RedeclLink.isFirst())
206
1.36k
      return getNextRedeclaration();
207
1.72k
    return nullptr;
208
1.72k
  }
clang::Redeclarable<clang::TypedefNameDecl>::getPreviousDecl()
Line
Count
Source
204
659k
  decl_type *getPreviousDecl() {
205
659k
    if (!RedeclLink.isFirst())
206
8.81k
      return getNextRedeclaration();
207
650k
    return nullptr;
208
650k
  }
clang::Redeclarable<clang::UsingShadowDecl>::getPreviousDecl()
Line
Count
Source
204
132
  decl_type *getPreviousDecl() {
205
132
    if (!RedeclLink.isFirst())
206
33
      return getNextRedeclaration();
207
99
    return nullptr;
208
99
  }
clang::Redeclarable<clang::NamespaceDecl>::getPreviousDecl()
Line
Count
Source
204
28.2k
  decl_type *getPreviousDecl() {
205
28.2k
    if (!RedeclLink.isFirst())
206
3.35k
      return getNextRedeclaration();
207
24.8k
    return nullptr;
208
24.8k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getPreviousDecl()
Line
Count
Source
204
4
  decl_type *getPreviousDecl() {
205
4
    if (!RedeclLink.isFirst())
206
0
      return getNextRedeclaration();
207
4
    return nullptr;
208
4
  }
209
2.37M
  const decl_type *getPreviousDecl() const {
210
2.37M
    return const_cast<decl_type *>(
211
2.37M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
2.37M
  }
clang::Redeclarable<clang::FunctionDecl>::getPreviousDecl() const
Line
Count
Source
209
1.35M
  const decl_type *getPreviousDecl() const {
210
1.35M
    return const_cast<decl_type *>(
211
1.35M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
1.35M
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getPreviousDecl() const
Line
Count
Source
209
556k
  const decl_type *getPreviousDecl() const {
210
556k
    return const_cast<decl_type *>(
211
556k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
556k
  }
clang::Redeclarable<clang::TagDecl>::getPreviousDecl() const
Line
Count
Source
209
1.71k
  const decl_type *getPreviousDecl() const {
210
1.71k
    return const_cast<decl_type *>(
211
1.71k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
1.71k
  }
clang::Redeclarable<clang::NamespaceDecl>::getPreviousDecl() const
Line
Count
Source
209
113
  const decl_type *getPreviousDecl() const {
210
113
    return const_cast<decl_type *>(
211
113
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
113
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getPreviousDecl() const
Line
Count
Source
209
4
  const decl_type *getPreviousDecl() const {
210
4
    return const_cast<decl_type *>(
211
4
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
4
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getPreviousDecl() const
Line
Count
Source
209
2.30k
  const decl_type *getPreviousDecl() const {
210
2.30k
    return const_cast<decl_type *>(
211
2.30k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
2.30k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getPreviousDecl() const
Line
Count
Source
209
19
  const decl_type *getPreviousDecl() const {
210
19
    return const_cast<decl_type *>(
211
19
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
19
  }
clang::Redeclarable<clang::TypedefNameDecl>::getPreviousDecl() const
Line
Count
Source
209
476
  const decl_type *getPreviousDecl() const {
210
476
    return const_cast<decl_type *>(
211
476
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
476
  }
clang::Redeclarable<clang::UsingShadowDecl>::getPreviousDecl() const
Line
Count
Source
209
19
  const decl_type *getPreviousDecl() const {
210
19
    return const_cast<decl_type *>(
211
19
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
19
  }
clang::Redeclarable<clang::VarDecl>::getPreviousDecl() const
Line
Count
Source
209
462k
  const decl_type *getPreviousDecl() const {
210
462k
    return const_cast<decl_type *>(
211
462k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
462k
  }
213
214
  /// Return the first declaration of this declaration or itself if this
215
  /// is the only declaration.
216
748M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::TagDecl>::getFirstDecl()
Line
Count
Source
216
321M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::VarDecl>::getFirstDecl()
Line
Count
Source
216
99.7M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getFirstDecl()
Line
Count
Source
216
168k
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::ObjCProtocolDecl>::getFirstDecl()
Line
Count
Source
216
13.5k
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::FunctionDecl>::getFirstDecl()
Line
Count
Source
216
250M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getFirstDecl()
Line
Count
Source
216
64.9M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::NamespaceDecl>::getFirstDecl()
Line
Count
Source
216
168k
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::NamespaceAliasDecl>::getFirstDecl()
Line
Count
Source
216
386
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::UsingShadowDecl>::getFirstDecl()
Line
Count
Source
216
1.21M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::TypedefNameDecl>::getFirstDecl()
Line
Count
Source
216
10.8M
  decl_type *getFirstDecl() { return First; }
217
218
  /// Return the first declaration of this declaration or itself if this
219
  /// is the only declaration.
220
36.2M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::TagDecl>::getFirstDecl() const
Line
Count
Source
220
166k
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::VarDecl>::getFirstDecl() const
Line
Count
Source
220
12.5M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getFirstDecl() const
Line
Count
Source
220
3.25k
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::ObjCProtocolDecl>::getFirstDecl() const
Line
Count
Source
220
773
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::FunctionDecl>::getFirstDecl() const
Line
Count
Source
220
18.6M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getFirstDecl() const
Line
Count
Source
220
4.83M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::TypedefNameDecl>::getFirstDecl() const
Line
Count
Source
220
67
  const decl_type *getFirstDecl() const { return First; }
Unexecuted instantiation: clang::Redeclarable<clang::NamespaceAliasDecl>::getFirstDecl() const
Unexecuted instantiation: clang::Redeclarable<clang::UsingShadowDecl>::getFirstDecl() const
221
222
  /// True if this is the first declaration in its redeclaration chain.
223
400M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::VarDecl>::isFirstDecl() const
Line
Count
Source
223
9.48M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::FunctionDecl>::isFirstDecl() const
Line
Count
Source
223
18.6M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::TagDecl>::isFirstDecl() const
Line
Count
Source
223
19.1M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::TypedefNameDecl>::isFirstDecl() const
Line
Count
Source
223
7.11k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::ObjCInterfaceDecl>::isFirstDecl() const
Line
Count
Source
223
15.2k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::ObjCProtocolDecl>::isFirstDecl() const
Line
Count
Source
223
3.50k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::NamespaceDecl>::isFirstDecl() const
Line
Count
Source
223
352M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::NamespaceAliasDecl>::isFirstDecl() const
Line
Count
Source
223
16
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::UsingShadowDecl>::isFirstDecl() const
Line
Count
Source
223
898
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::isFirstDecl() const
Line
Count
Source
223
8.42k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
224
225
  /// Returns the most recent (re)declaration of this declaration.
226
357M
  decl_type *getMostRecentDecl() {
227
357M
    return getFirstDecl()->getNextRedeclaration();
228
357M
  }
clang::Redeclarable<clang::TagDecl>::getMostRecentDecl()
Line
Count
Source
226
285M
  decl_type *getMostRecentDecl() {
227
285M
    return getFirstDecl()->getNextRedeclaration();
228
285M
  }
clang::Redeclarable<clang::VarDecl>::getMostRecentDecl()
Line
Count
Source
226
36.7M
  decl_type *getMostRecentDecl() {
227
36.7M
    return getFirstDecl()->getNextRedeclaration();
228
36.7M
  }
clang::Redeclarable<clang::FunctionDecl>::getMostRecentDecl()
Line
Count
Source
226
27.2M
  decl_type *getMostRecentDecl() {
227
27.2M
    return getFirstDecl()->getNextRedeclaration();
228
27.2M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getMostRecentDecl()
Line
Count
Source
226
4.40k
  decl_type *getMostRecentDecl() {
227
4.40k
    return getFirstDecl()->getNextRedeclaration();
228
4.40k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getMostRecentDecl()
Line
Count
Source
226
971
  decl_type *getMostRecentDecl() {
227
971
    return getFirstDecl()->getNextRedeclaration();
228
971
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getMostRecentDecl()
Line
Count
Source
226
6.74M
  decl_type *getMostRecentDecl() {
227
6.74M
    return getFirstDecl()->getNextRedeclaration();
228
6.74M
  }
clang::Redeclarable<clang::TypedefNameDecl>::getMostRecentDecl()
Line
Count
Source
226
613k
  decl_type *getMostRecentDecl() {
227
613k
    return getFirstDecl()->getNextRedeclaration();
228
613k
  }
clang::Redeclarable<clang::UsingShadowDecl>::getMostRecentDecl()
Line
Count
Source
226
295k
  decl_type *getMostRecentDecl() {
227
295k
    return getFirstDecl()->getNextRedeclaration();
228
295k
  }
clang::Redeclarable<clang::NamespaceDecl>::getMostRecentDecl()
Line
Count
Source
226
99.9k
  decl_type *getMostRecentDecl() {
227
99.9k
    return getFirstDecl()->getNextRedeclaration();
228
99.9k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getMostRecentDecl()
Line
Count
Source
226
120
  decl_type *getMostRecentDecl() {
227
120
    return getFirstDecl()->getNextRedeclaration();
228
120
  }
229
230
  /// Returns the most recent (re)declaration of this declaration.
231
5.63M
  const decl_type *getMostRecentDecl() const {
232
5.63M
    return getFirstDecl()->getNextRedeclaration();
233
5.63M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getMostRecentDecl() const
Line
Count
Source
231
3.25k
  const decl_type *getMostRecentDecl() const {
232
3.25k
    return getFirstDecl()->getNextRedeclaration();
233
3.25k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getMostRecentDecl() const
Line
Count
Source
231
152
  const decl_type *getMostRecentDecl() const {
232
152
    return getFirstDecl()->getNextRedeclaration();
233
152
  }
clang::Redeclarable<clang::FunctionDecl>::getMostRecentDecl() const
Line
Count
Source
231
799k
  const decl_type *getMostRecentDecl() const {
232
799k
    return getFirstDecl()->getNextRedeclaration();
233
799k
  }
clang::Redeclarable<clang::VarDecl>::getMostRecentDecl() const
Line
Count
Source
231
354
  const decl_type *getMostRecentDecl() const {
232
354
    return getFirstDecl()->getNextRedeclaration();
233
354
  }
clang::Redeclarable<clang::TagDecl>::getMostRecentDecl() const
Line
Count
Source
231
122
  const decl_type *getMostRecentDecl() const {
232
122
    return getFirstDecl()->getNextRedeclaration();
233
122
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getMostRecentDecl() const
Line
Count
Source
231
4.83M
  const decl_type *getMostRecentDecl() const {
232
4.83M
    return getFirstDecl()->getNextRedeclaration();
233
4.83M
  }
234
235
  /// Set the previous declaration. If PrevDecl is NULL, set this as the
236
  /// first and only declaration.
237
  void setPreviousDecl(decl_type *PrevDecl);
238
239
  /// Iterates through all the redeclarations of the same decl.
240
  class redecl_iterator {
241
    /// Current - The current declaration.
242
    decl_type *Current = nullptr;
243
    decl_type *Starter;
244
    bool PassedFirst = false;
245
246
  public:
247
    using value_type = decl_type *;
248
    using reference = decl_type *;
249
    using pointer = decl_type *;
250
    using iterator_category = std::forward_iterator_tag;
251
    using difference_type = std::ptrdiff_t;
252
253
273M
    redecl_iterator() = default;
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
23.2M
    redecl_iterator() = default;
clang::Redeclarable<clang::VarDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
24.1M
    redecl_iterator() = default;
clang::Redeclarable<clang::TagDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
226M
    redecl_iterator() = default;
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
567
    redecl_iterator() = default;
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
12.7k
    redecl_iterator() = default;
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
3.12k
    redecl_iterator() = default;
254
273M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::redecl_iterator(clang::FunctionDecl*)
Line
Count
Source
254
23.2M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::VarDecl>::redecl_iterator::redecl_iterator(clang::VarDecl*)
Line
Count
Source
254
24.1M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::TagDecl>::redecl_iterator::redecl_iterator(clang::TagDecl*)
Line
Count
Source
254
226M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::redecl_iterator(clang::UsingShadowDecl*)
Line
Count
Source
254
567
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::redecl_iterator(clang::ObjCInterfaceDecl*)
Line
Count
Source
254
12.7k
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::redecl_iterator(clang::ObjCProtocolDecl*)
Line
Count
Source
254
3.12k
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
255
256
289M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
25.0M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::VarDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
27.9M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::TagDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
236M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
575
    reference operator*() const { return Current; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
15.0k
    reference operator*() const { return Current; }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
3.41k
    reference operator*() const { return Current; }
257
    pointer operator->() const { return Current; }
258
259
39.8M
    redecl_iterator& operator++() {
260
39.8M
      assert(Current && "Advancing while iterator has reached end");
261
39.8M
      // Sanity check to avoid infinite loop on invalid redecl chain.
262
39.8M
      if (Current->isFirstDecl()) {
263
36.6M
        if (PassedFirst) {
264
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
265
0
          Current = nullptr;
266
0
          return *this;
267
0
        }
268
36.6M
        PassedFirst = true;
269
36.6M
      }
270
39.8M
271
39.8M
      // Get either previous decl or latest decl.
272
39.8M
      decl_type *Next = Current->getNextRedeclaration();
273
39.8M
      Current = (Next != Starter) ? 
Next16.3M
:
nullptr23.4M
;
274
39.8M
      return *this;
275
39.8M
    }
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::operator++()
Line
Count
Source
259
13.4M
    redecl_iterator& operator++() {
260
13.4M
      assert(Current && "Advancing while iterator has reached end");
261
13.4M
      // Sanity check to avoid infinite loop on invalid redecl chain.
262
13.4M
      if (Current->isFirstDecl()) {
263
12.5M
        if (PassedFirst) {
264
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
265
0
          Current = nullptr;
266
0
          return *this;
267
0
        }
268
12.5M
        PassedFirst = true;
269
12.5M
      }
270
13.4M
271
13.4M
      // Get either previous decl or latest decl.
272
13.4M
      decl_type *Next = Current->getNextRedeclaration();
273
13.4M
      Current = (Next != Starter) ? 
Next1.82M
:
nullptr11.5M
;
274
13.4M
      return *this;
275
13.4M
    }
clang::Redeclarable<clang::VarDecl>::redecl_iterator::operator++()
Line
Count
Source
259
7.22M
    redecl_iterator& operator++() {
260
7.22M
      assert(Current && "Advancing while iterator has reached end");
261
7.22M
      // Sanity check to avoid infinite loop on invalid redecl chain.
262
7.22M
      if (Current->isFirstDecl()) {
263
5.63M
        if (PassedFirst) {
264
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
265
0
          Current = nullptr;
266
0
          return *this;
267
0
        }
268
5.63M
        PassedFirst = true;
269
5.63M
      }
270
7.22M
271
7.22M
      // Get either previous decl or latest decl.
272
7.22M
      decl_type *Next = Current->getNextRedeclaration();
273
7.22M
      Current = (Next != Starter) ? 
Next3.81M
:
nullptr3.40M
;
274
7.22M
      return *this;
275
7.22M
    }
clang::Redeclarable<clang::TagDecl>::redecl_iterator::operator++()
Line
Count
Source
259
19.1M
    redecl_iterator& operator++() {
260
19.1M
      assert(Current && "Advancing while iterator has reached end");
261
19.1M
      // Sanity check to avoid infinite loop on invalid redecl chain.
262
19.1M
      if (Current->isFirstDecl()) {
263
18.4M
        if (PassedFirst) {
264
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
265
0
          Current = nullptr;
266
0
          return *this;
267
0
        }
268
18.4M
        PassedFirst = true;
269
18.4M
      }
270
19.1M
271
19.1M
      // Get either previous decl or latest decl.
272
19.1M
      decl_type *Next = Current->getNextRedeclaration();
273
19.1M
      Current = (Next != Starter) ? 
Next10.7M
:
nullptr8.47M
;
274
19.1M
      return *this;
275
19.1M
    }
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::operator++()
Line
Count
Source
259
575
    redecl_iterator& operator++() {
260
575
      assert(Current && "Advancing while iterator has reached end");
261
575
      // Sanity check to avoid infinite loop on invalid redecl chain.
262
575
      if (Current->isFirstDecl()) {
263
567
        if (PassedFirst) {
264
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
265
0
          Current = nullptr;
266
0
          return *this;
267
0
        }
268
567
        PassedFirst = true;
269
567
      }
270
575
271
575
      // Get either previous decl or latest decl.
272
575
      decl_type *Next = Current->getNextRedeclaration();
273
575
      Current = (Next != Starter) ? 
Next8
:
nullptr567
;
274
575
      return *this;
275
575
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::operator++()
Line
Count
Source
259
15.0k
    redecl_iterator& operator++() {
260
15.0k
      assert(Current && "Advancing while iterator has reached end");
261
15.0k
      // Sanity check to avoid infinite loop on invalid redecl chain.
262
15.0k
      if (Current->isFirstDecl()) {
263
12.7k
        if (PassedFirst) {
264
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
265
0
          Current = nullptr;
266
0
          return *this;
267
0
        }
268
12.7k
        PassedFirst = true;
269
12.7k
      }
270
15.0k
271
15.0k
      // Get either previous decl or latest decl.
272
15.0k
      decl_type *Next = Current->getNextRedeclaration();
273
15.0k
      Current = (Next != Starter) ? 
Next2.26k
:
nullptr12.7k
;
274
15.0k
      return *this;
275
15.0k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::operator++()
Line
Count
Source
259
3.41k
    redecl_iterator& operator++() {
260
3.41k
      assert(Current && "Advancing while iterator has reached end");
261
3.41k
      // Sanity check to avoid infinite loop on invalid redecl chain.
262
3.41k
      if (Current->isFirstDecl()) {
263
3.12k
        if (PassedFirst) {
264
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
265
0
          Current = nullptr;
266
0
          return *this;
267
0
        }
268
3.12k
        PassedFirst = true;
269
3.12k
      }
270
3.41k
271
3.41k
      // Get either previous decl or latest decl.
272
3.41k
      decl_type *Next = Current->getNextRedeclaration();
273
3.41k
      Current = (Next != Starter) ? 
Next283
:
nullptr3.12k
;
274
3.41k
      return *this;
275
3.41k
    }
276
277
    redecl_iterator operator++(int) {
278
      redecl_iterator tmp(*this);
279
      ++(*this);
280
      return tmp;
281
    }
282
283
11
    friend bool operator==(redecl_iterator x, redecl_iterator y) {
284
11
      return x.Current == y.Current;
285
11
    }
286
313M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
287
313M
      return x.Current != y.Current;
288
313M
    }
clang::operator!=(clang::Redeclarable<clang::TagDecl>::redecl_iterator, clang::Redeclarable<clang::TagDecl>::redecl_iterator)
Line
Count
Source
286
245M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
287
245M
      return x.Current != y.Current;
288
245M
    }
clang::operator!=(clang::Redeclarable<clang::VarDecl>::redecl_iterator, clang::Redeclarable<clang::VarDecl>::redecl_iterator)
Line
Count
Source
286
31.3M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
287
31.3M
      return x.Current != y.Current;
288
31.3M
    }
clang::operator!=(clang::Redeclarable<clang::FunctionDecl>::redecl_iterator, clang::Redeclarable<clang::FunctionDecl>::redecl_iterator)
Line
Count
Source
286
36.6M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
287
36.6M
      return x.Current != y.Current;
288
36.6M
    }
clang::operator!=(clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator, clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator)
Line
Count
Source
286
1.14k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
287
1.14k
      return x.Current != y.Current;
288
1.14k
    }
clang::operator!=(clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator, clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator)
Line
Count
Source
286
27.7k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
287
27.7k
      return x.Current != y.Current;
288
27.7k
    }
clang::operator!=(clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator, clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator)
Line
Count
Source
286
6.54k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
287
6.54k
      return x.Current != y.Current;
288
6.54k
    }
289
  };
290
291
  using redecl_range = llvm::iterator_range<redecl_iterator>;
292
293
  /// Returns an iterator range for all the redeclarations of the same
294
  /// decl. It will iterate at least once (when this decl is the only one).
295
273M
  redecl_range redecls() const {
296
273M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
297
273M
                            static_cast<const decl_type *>(this))),
298
273M
                        redecl_iterator());
299
273M
  }
clang::Redeclarable<clang::VarDecl>::redecls() const
Line
Count
Source
295
24.1M
  redecl_range redecls() const {
296
24.1M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
297
24.1M
                            static_cast<const decl_type *>(this))),
298
24.1M
                        redecl_iterator());
299
24.1M
  }
clang::Redeclarable<clang::FunctionDecl>::redecls() const
Line
Count
Source
295
23.2M
  redecl_range redecls() const {
296
23.2M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
297
23.2M
                            static_cast<const decl_type *>(this))),
298
23.2M
                        redecl_iterator());
299
23.2M
  }
clang::Redeclarable<clang::TagDecl>::redecls() const
Line
Count
Source
295
226M
  redecl_range redecls() const {
296
226M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
297
226M
                            static_cast<const decl_type *>(this))),
298
226M
                        redecl_iterator());
299
226M
  }
clang::Redeclarable<clang::UsingShadowDecl>::redecls() const
Line
Count
Source
295
567
  redecl_range redecls() const {
296
567
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
297
567
                            static_cast<const decl_type *>(this))),
298
567
                        redecl_iterator());
299
567
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecls() const
Line
Count
Source
295
12.7k
  redecl_range redecls() const {
296
12.7k
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
297
12.7k
                            static_cast<const decl_type *>(this))),
298
12.7k
                        redecl_iterator());
299
12.7k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecls() const
Line
Count
Source
295
3.12k
  redecl_range redecls() const {
296
3.12k
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
297
3.12k
                            static_cast<const decl_type *>(this))),
298
3.12k
                        redecl_iterator());
299
3.12k
  }
300
301
  redecl_iterator redecls_begin() const { return redecls().begin(); }
302
11
  redecl_iterator redecls_end() const { return redecls().end(); }
303
};
304
305
/// Get the primary declaration for a declaration from an AST file. That
306
/// will be the first-loaded declaration.
307
Decl *getPrimaryMergedDecl(Decl *D);
308
309
/// Provides common interface for the Decls that cannot be redeclared,
310
/// but can be merged if the same declaration is brought in from multiple
311
/// modules.
312
template<typename decl_type>
313
class Mergeable {
314
public:
315
  Mergeable() = default;
316
317
  /// Return the first declaration of this declaration or itself if this
318
  /// is the only declaration.
319
6.24M
  decl_type *getFirstDecl() {
320
6.24M
    auto *D = static_cast<decl_type *>(this);
321
6.24M
    if (!D->isFromASTFile())
322
6.21M
      return D;
323
21.9k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
324
21.9k
  }
clang::Mergeable<clang::FieldDecl>::getFirstDecl()
Line
Count
Source
319
5.39M
  decl_type *getFirstDecl() {
320
5.39M
    auto *D = static_cast<decl_type *>(this);
321
5.39M
    if (!D->isFromASTFile())
322
5.37M
      return D;
323
20.3k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
324
20.3k
  }
clang::Mergeable<clang::UsingPackDecl>::getFirstDecl()
Line
Count
Source
319
3
  decl_type *getFirstDecl() {
320
3
    auto *D = static_cast<decl_type *>(this);
321
3
    if (!D->isFromASTFile())
322
2
      return D;
323
1
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
324
1
  }
clang::Mergeable<clang::UnresolvedUsingTypenameDecl>::getFirstDecl()
Line
Count
Source
319
332
  decl_type *getFirstDecl() {
320
332
    auto *D = static_cast<decl_type *>(this);
321
332
    if (!D->isFromASTFile())
322
238
      return D;
323
94
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
324
94
  }
clang::Mergeable<clang::UsingDecl>::getFirstDecl()
Line
Count
Source
319
209k
  decl_type *getFirstDecl() {
320
209k
    auto *D = static_cast<decl_type *>(this);
321
209k
    if (!D->isFromASTFile())
322
208k
      return D;
323
447
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
324
447
  }
clang::Mergeable<clang::EnumConstantDecl>::getFirstDecl()
Line
Count
Source
319
610k
  decl_type *getFirstDecl() {
320
610k
    auto *D = static_cast<decl_type *>(this);
321
610k
    if (!D->isFromASTFile())
322
609k
      return D;
323
715
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
324
715
  }
clang::Mergeable<clang::IndirectFieldDecl>::getFirstDecl()
Line
Count
Source
319
21.9k
  decl_type *getFirstDecl() {
320
21.9k
    auto *D = static_cast<decl_type *>(this);
321
21.9k
    if (!D->isFromASTFile())
322
21.8k
      return D;
323
163
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
324
163
  }
clang::Mergeable<clang::UnresolvedUsingValueDecl>::getFirstDecl()
Line
Count
Source
319
657
  decl_type *getFirstDecl() {
320
657
    auto *D = static_cast<decl_type *>(this);
321
657
    if (!D->isFromASTFile())
322
557
      return D;
323
100
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
324
100
  }
325
326
  /// Return the first declaration of this declaration or itself if this
327
  /// is the only declaration.
328
3.03M
  const decl_type *getFirstDecl() const {
329
3.03M
    const auto *D = static_cast<const decl_type *>(this);
330
3.03M
    if (!D->isFromASTFile())
331
3.01M
      return D;
332
24.8k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
333
24.8k
  }
clang::Mergeable<clang::FieldDecl>::getFirstDecl() const
Line
Count
Source
328
3.03M
  const decl_type *getFirstDecl() const {
329
3.03M
    const auto *D = static_cast<const decl_type *>(this);
330
3.03M
    if (!D->isFromASTFile())
331
3.01M
      return D;
332
24.8k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
333
24.8k
  }
Unexecuted instantiation: clang::Mergeable<clang::UsingPackDecl>::getFirstDecl() const
clang::Mergeable<clang::UnresolvedUsingTypenameDecl>::getFirstDecl() const
Line
Count
Source
328
2
  const decl_type *getFirstDecl() const {
329
2
    const auto *D = static_cast<const decl_type *>(this);
330
2
    if (!D->isFromASTFile())
331
2
      return D;
332
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
333
0
  }
clang::Mergeable<clang::UsingDecl>::getFirstDecl() const
Line
Count
Source
328
14
  const decl_type *getFirstDecl() const {
329
14
    const auto *D = static_cast<const decl_type *>(this);
330
14
    if (!D->isFromASTFile())
331
14
      return D;
332
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
333
0
  }
clang::Mergeable<clang::EnumConstantDecl>::getFirstDecl() const
Line
Count
Source
328
62
  const decl_type *getFirstDecl() const {
329
62
    const auto *D = static_cast<const decl_type *>(this);
330
62
    if (!D->isFromASTFile())
331
62
      return D;
332
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
333
0
  }
clang::Mergeable<clang::IndirectFieldDecl>::getFirstDecl() const
Line
Count
Source
328
9
  const decl_type *getFirstDecl() const {
329
9
    const auto *D = static_cast<const decl_type *>(this);
330
9
    if (!D->isFromASTFile())
331
9
      return D;
332
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
333
0
  }
clang::Mergeable<clang::UnresolvedUsingValueDecl>::getFirstDecl() const
Line
Count
Source
328
2
  const decl_type *getFirstDecl() const {
329
2
    const auto *D = static_cast<const decl_type *>(this);
330
2
    if (!D->isFromASTFile())
331
2
      return D;
332
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
333
0
  }
334
335
  /// Returns true if this is the first declaration.
336
  bool isFirstDecl() const { return getFirstDecl() == this; }
337
};
338
339
/// A wrapper class around a pointer that always points to its canonical
340
/// declaration.
341
///
342
/// CanonicalDeclPtr<decl_type> behaves just like decl_type*, except we call
343
/// decl_type::getCanonicalDecl() on construction.
344
///
345
/// This is useful for hashtables that you want to be keyed on a declaration's
346
/// canonical decl -- if you use CanonicalDeclPtr as the key, you don't need to
347
/// remember to call getCanonicalDecl() everywhere.
348
template <typename decl_type> class CanonicalDeclPtr {
349
public:
350
19.9k
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::CanonicalDeclPtr()
Line
Count
Source
350
732
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::FunctionDecl>::CanonicalDeclPtr()
Line
Count
Source
350
19.1k
  CanonicalDeclPtr() = default;
351
  CanonicalDeclPtr(decl_type *Ptr)
352
12.3k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::CanonicalDeclPtr(clang::CXXRecordDecl const*)
Line
Count
Source
352
134
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::FunctionDecl>::CanonicalDeclPtr(clang::FunctionDecl*)
Line
Count
Source
352
12.2k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
353
  CanonicalDeclPtr(const CanonicalDeclPtr &) = default;
354
  CanonicalDeclPtr &operator=(const CanonicalDeclPtr &) = default;
355
356
179
  operator decl_type *() { return Ptr; }
357
131k
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::operator clang::CXXRecordDecl const*() const
Line
Count
Source
357
15.3k
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::FunctionDecl>::operator clang::FunctionDecl const*() const
Line
Count
Source
357
115k
  operator const decl_type *() const { return Ptr; }
358
359
  decl_type *operator->() { return Ptr; }
360
  const decl_type *operator->() const { return Ptr; }
361
362
  decl_type &operator*() { return *Ptr; }
363
  const decl_type &operator*() const { return *Ptr; }
364
365
private:
366
  friend struct llvm::DenseMapInfo<CanonicalDeclPtr<decl_type>>;
367
368
  decl_type *Ptr = nullptr;
369
};
370
371
} // namespace clang
372
373
namespace llvm {
374
375
template <typename decl_type>
376
struct DenseMapInfo<clang::CanonicalDeclPtr<decl_type>> {
377
  using CanonicalDeclPtr = clang::CanonicalDeclPtr<decl_type>;
378
  using BaseInfo = DenseMapInfo<decl_type *>;
379
380
10.6k
  static CanonicalDeclPtr getEmptyKey() {
381
10.6k
    // Construct our CanonicalDeclPtr this way because the regular constructor
382
10.6k
    // would dereference P.Ptr, which is not allowed.
383
10.6k
    CanonicalDeclPtr P;
384
10.6k
    P.Ptr = BaseInfo::getEmptyKey();
385
10.6k
    return P;
386
10.6k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::getEmptyKey()
Line
Count
Source
380
487
  static CanonicalDeclPtr getEmptyKey() {
381
487
    // Construct our CanonicalDeclPtr this way because the regular constructor
382
487
    // would dereference P.Ptr, which is not allowed.
383
487
    CanonicalDeclPtr P;
384
487
    P.Ptr = BaseInfo::getEmptyKey();
385
487
    return P;
386
487
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::getEmptyKey()
Line
Count
Source
380
10.1k
  static CanonicalDeclPtr getEmptyKey() {
381
10.1k
    // Construct our CanonicalDeclPtr this way because the regular constructor
382
10.1k
    // would dereference P.Ptr, which is not allowed.
383
10.1k
    CanonicalDeclPtr P;
384
10.1k
    P.Ptr = BaseInfo::getEmptyKey();
385
10.1k
    return P;
386
10.1k
  }
387
388
7.77k
  static CanonicalDeclPtr getTombstoneKey() {
389
7.77k
    CanonicalDeclPtr P;
390
7.77k
    P.Ptr = BaseInfo::getTombstoneKey();
391
7.77k
    return P;
392
7.77k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::getTombstoneKey()
Line
Count
Source
388
245
  static CanonicalDeclPtr getTombstoneKey() {
389
245
    CanonicalDeclPtr P;
390
245
    P.Ptr = BaseInfo::getTombstoneKey();
391
245
    return P;
392
245
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::getTombstoneKey()
Line
Count
Source
388
7.52k
  static CanonicalDeclPtr getTombstoneKey() {
389
7.52k
    CanonicalDeclPtr P;
390
7.52k
    P.Ptr = BaseInfo::getTombstoneKey();
391
7.52k
    return P;
392
7.52k
  }
393
394
7.10k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
395
7.10k
    return BaseInfo::getHashValue(P);
396
7.10k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::getHashValue(clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&)
Line
Count
Source
394
134
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
395
134
    return BaseInfo::getHashValue(P);
396
134
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::getHashValue(clang::CanonicalDeclPtr<clang::FunctionDecl> const&)
Line
Count
Source
394
6.97k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
395
6.97k
    return BaseInfo::getHashValue(P);
396
6.97k
  }
397
398
  static bool isEqual(const CanonicalDeclPtr &LHS,
399
60.1k
                      const CanonicalDeclPtr &RHS) {
400
60.1k
    return BaseInfo::isEqual(LHS, RHS);
401
60.1k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::isEqual(clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&, clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&)
Line
Count
Source
399
7.63k
                      const CanonicalDeclPtr &RHS) {
400
7.63k
    return BaseInfo::isEqual(LHS, RHS);
401
7.63k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::isEqual(clang::CanonicalDeclPtr<clang::FunctionDecl> const&, clang::CanonicalDeclPtr<clang::FunctionDecl> const&)
Line
Count
Source
399
52.5k
                      const CanonicalDeclPtr &RHS) {
400
52.5k
    return BaseInfo::isEqual(LHS, RHS);
401
52.5k
  }
402
};
403
404
} // namespace llvm
405
406
#endif // LLVM_CLANG_AST_REDECLARABLE_H