Coverage Report

Created: 2019-02-23 12:57

/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
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
//  This file defines the Redeclarable interface.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_CLANG_AST_REDECLARABLE_H
14
#define LLVM_CLANG_AST_REDECLARABLE_H
15
16
#include "clang/AST/ExternalASTSource.h"
17
#include "llvm/ADT/DenseMapInfo.h"
18
#include "llvm/ADT/PointerUnion.h"
19
#include "llvm/ADT/iterator_range.h"
20
#include "llvm/Support/Casting.h"
21
#include <cassert>
22
#include <cstddef>
23
#include <iterator>
24
25
namespace clang {
26
27
class ASTContext;
28
class Decl;
29
30
// Some notes on redeclarables:
31
//
32
//  - Every redeclarable is on a circular linked list.
33
//
34
//  - Every decl has a pointer to the first element of the chain _and_ a
35
//    DeclLink that may point to one of 3 possible states:
36
//      - the "previous" (temporal) element in the chain
37
//      - the "latest" (temporal) element in the chain
38
//      - the "uninitialized-latest" value (when newly-constructed)
39
//
40
//  - The first element is also often called the canonical element. Every
41
//    element has a pointer to it so that "getCanonical" can be fast.
42
//
43
//  - Most links in the chain point to previous, except the link out of
44
//    the first; it points to latest.
45
//
46
//  - Elements are called "first", "previous", "latest" or
47
//    "most-recent" when referring to temporal order: order of addition
48
//    to the chain.
49
//
50
//  - It's easiest to just ignore the implementation of DeclLink when making
51
//    sense of the redeclaration chain.
52
//
53
//  - There's also a "definition" link for several types of
54
//    redeclarable, where only one definition should exist at any given
55
//    time (and the defn pointer is stored in the decl's "data" which
56
//    is copied to every element on the chain when it's changed).
57
//
58
//    Here is some ASCII art:
59
//
60
//      "first"                                     "latest"
61
//      "canonical"                                 "most recent"
62
//      +------------+         first                +--------------+
63
//      |            | <--------------------------- |              |
64
//      |            |                              |              |
65
//      |            |                              |              |
66
//      |            |       +--------------+       |              |
67
//      |            | first |              |       |              |
68
//      |            | <---- |              |       |              |
69
//      |            |       |              |       |              |
70
//      | @class A   |  link | @interface A |  link | @class A     |
71
//      | seen first | <---- | seen second  | <---- | seen third   |
72
//      |            |       |              |       |              |
73
//      +------------+       +--------------+       +--------------+
74
//      | data       | defn  | data         |  defn | data         |
75
//      |            | ----> |              | <---- |              |
76
//      +------------+       +--------------+       +--------------+
77
//        |                     |     ^                  ^
78
//        |                     |defn |                  |
79
//        | link                +-----+                  |
80
//        +-->-------------------------------------------+
81
82
/// Provides common interface for the Decls that can be redeclared.
83
template<typename decl_type>
84
class Redeclarable {
85
protected:
86
  class DeclLink {
87
    /// A pointer to a known latest declaration, either statically known or
88
    /// generationally updated as decls are added by an external source.
89
    using KnownLatest =
90
        LazyGenerationalUpdatePtr<const Decl *, Decl *,
91
                                  &ExternalASTSource::CompleteRedeclChain>;
92
93
    /// We store a pointer to the ASTContext in the UninitializedLatest
94
    /// pointer, but to avoid circular type dependencies when we steal the low
95
    /// bits of this pointer, we use a raw void* here.
96
    using UninitializedLatest = const void *;
97
98
    using Previous = Decl *;
99
100
    /// A pointer to either an uninitialized latest declaration (where either
101
    /// we've not yet set the previous decl or there isn't one), or to a known
102
    /// previous declaration.
103
    using NotKnownLatest = llvm::PointerUnion<Previous, UninitializedLatest>;
104
105
    mutable llvm::PointerUnion<NotKnownLatest, KnownLatest> Link;
106
107
  public:
108
    enum PreviousTag { PreviousLink };
109
    enum LatestTag { LatestLink };
110
111
    DeclLink(LatestTag, const ASTContext &Ctx)
112
34.9M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
112
2.42M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::VarDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::VarDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
112
18.2M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::FunctionDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::FunctionDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
112
8.40M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::TagDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::TagDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
112
4.42M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
112
263
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::NamespaceDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
112
119k
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
112
161k
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
112
30.4k
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
112
4.00k
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
112
1.11M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
113
1.89M
    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
113
8.97k
    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
113
1.09M
    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
113
544k
    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
113
6.88k
    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
113
424
    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
113
75.9k
    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
113
74.6k
    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
113
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
113
3.11k
    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
113
90.2k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
114
115
447M
    bool isFirst() const {
116
447M
      return Link.is<KnownLatest>() ||
117
447M
             // FIXME: 'template' is required on the next line due to an
118
447M
             // apparent clang bug.
119
447M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()285M
;
120
447M
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::isFirst() const
Line
Count
Source
115
11.8M
    bool isFirst() const {
116
11.8M
      return Link.is<KnownLatest>() ||
117
11.8M
             // FIXME: 'template' is required on the next line due to an
118
11.8M
             // apparent clang bug.
119
11.8M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()5.46M
;
120
11.8M
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::isFirst() const
Line
Count
Source
115
25.9M
    bool isFirst() const {
116
25.9M
      return Link.is<KnownLatest>() ||
117
25.9M
             // FIXME: 'template' is required on the next line due to an
118
25.9M
             // apparent clang bug.
119
25.9M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()7.77M
;
120
25.9M
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::isFirst() const
Line
Count
Source
115
25.3M
    bool isFirst() const {
116
25.3M
      return Link.is<KnownLatest>() ||
117
25.3M
             // FIXME: 'template' is required on the next line due to an
118
25.3M
             // apparent clang bug.
119
25.3M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()2.99M
;
120
25.3M
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::isFirst() const
Line
Count
Source
115
823k
    bool isFirst() const {
116
823k
      return Link.is<KnownLatest>() ||
117
823k
             // FIXME: 'template' is required on the next line due to an
118
823k
             // apparent clang bug.
119
823k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()317k
;
120
823k
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::isFirst() const
Line
Count
Source
115
18.6k
    bool isFirst() const {
116
18.6k
      return Link.is<KnownLatest>() ||
117
18.6k
             // FIXME: 'template' is required on the next line due to an
118
18.6k
             // apparent clang bug.
119
18.6k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()3.70k
;
120
18.6k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::isFirst() const
Line
Count
Source
115
4.03k
    bool isFirst() const {
116
4.03k
      return Link.is<KnownLatest>() ||
117
4.03k
             // FIXME: 'template' is required on the next line due to an
118
4.03k
             // apparent clang bug.
119
4.03k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()486
;
120
4.03k
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::isFirst() const
Line
Count
Source
115
381M
    bool isFirst() const {
116
381M
      return Link.is<KnownLatest>() ||
117
381M
             // FIXME: 'template' is required on the next line due to an
118
381M
             // apparent clang bug.
119
381M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()267M
;
120
381M
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::isFirst() const
Line
Count
Source
115
20
    bool isFirst() const {
116
20
      return Link.is<KnownLatest>() ||
117
20
             // FIXME: 'template' is required on the next line due to an
118
20
             // apparent clang bug.
119
20
             Link.get<NotKnownLatest>().template is<UninitializedLatest>();
120
20
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::isFirst() const
Line
Count
Source
115
1.05k
    bool isFirst() const {
116
1.05k
      return Link.is<KnownLatest>() ||
117
1.05k
             // FIXME: 'template' is required on the next line due to an
118
1.05k
             // apparent clang bug.
119
1.05k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()371
;
120
1.05k
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::isFirst() const
Line
Count
Source
115
1.79M
    bool isFirst() const {
116
1.79M
      return Link.is<KnownLatest>() ||
117
1.79M
             // FIXME: 'template' is required on the next line due to an
118
1.79M
             // apparent clang bug.
119
1.79M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()1.35M
;
120
1.79M
    }
121
122
470M
    decl_type *getPrevious(const decl_type *D) const {
123
470M
      if (Link.is<NotKnownLatest>()) {
124
25.2M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
25.2M
        if (NKL.is<Previous>())
126
7.14M
          return static_cast<decl_type*>(NKL.get<Previous>());
127
18.1M
128
18.1M
        // Allocate the generational 'most recent' cache now, if needed.
129
18.1M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
18.1M
                               NKL.get<UninitializedLatest>()),
131
18.1M
                           const_cast<decl_type *>(D));
132
18.1M
      }
133
470M
134
470M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))463M
;
135
470M
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::getPrevious(clang::TagDecl const*) const
Line
Count
Source
122
346M
    decl_type *getPrevious(const decl_type *D) const {
123
346M
      if (Link.is<NotKnownLatest>()) {
124
3.00M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
3.00M
        if (NKL.is<Previous>())
126
3.00M
          return static_cast<decl_type*>(NKL.get<Previous>());
127
0
128
0
        // Allocate the generational 'most recent' cache now, if needed.
129
0
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
0
                               NKL.get<UninitializedLatest>()),
131
0
                           const_cast<decl_type *>(D));
132
0
      }
133
346M
134
346M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))343M
;
135
346M
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::getPrevious(clang::VarDecl const*) const
Line
Count
Source
122
56.7M
    decl_type *getPrevious(const decl_type *D) const {
123
56.7M
      if (Link.is<NotKnownLatest>()) {
124
12.7M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
12.7M
        if (NKL.is<Previous>())
126
2.22M
          return static_cast<decl_type*>(NKL.get<Previous>());
127
10.5M
128
10.5M
        // Allocate the generational 'most recent' cache now, if needed.
129
10.5M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
10.5M
                               NKL.get<UninitializedLatest>()),
131
10.5M
                           const_cast<decl_type *>(D));
132
10.5M
      }
133
56.7M
134
56.7M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))54.5M
;
135
56.7M
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::getPrevious(clang::ObjCInterfaceDecl const*) const
Line
Count
Source
122
32.5k
    decl_type *getPrevious(const decl_type *D) const {
123
32.5k
      if (Link.is<NotKnownLatest>()) {
124
3.87k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
3.87k
        if (NKL.is<Previous>())
126
3.87k
          return static_cast<decl_type*>(NKL.get<Previous>());
127
0
128
0
        // Allocate the generational 'most recent' cache now, if needed.
129
0
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
0
                               NKL.get<UninitializedLatest>()),
131
0
                           const_cast<decl_type *>(D));
132
0
      }
133
32.5k
134
32.5k
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))28.6k
;
135
32.5k
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::getPrevious(clang::FunctionDecl const*) const
Line
Count
Source
122
48.5M
    decl_type *getPrevious(const decl_type *D) const {
123
48.5M
      if (Link.is<NotKnownLatest>()) {
124
8.00M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
8.00M
        if (NKL.is<Previous>())
126
1.24M
          return static_cast<decl_type*>(NKL.get<Previous>());
127
6.75M
128
6.75M
        // Allocate the generational 'most recent' cache now, if needed.
129
6.75M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
6.75M
                               NKL.get<UninitializedLatest>()),
131
6.75M
                           const_cast<decl_type *>(D));
132
6.75M
      }
133
48.5M
134
48.5M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))47.3M
;
135
48.5M
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::getPrevious(clang::ObjCProtocolDecl const*) const
Line
Count
Source
122
5.63k
    decl_type *getPrevious(const decl_type *D) const {
123
5.63k
      if (Link.is<NotKnownLatest>()) {
124
566
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
566
        if (NKL.is<Previous>())
126
566
          return static_cast<decl_type*>(NKL.get<Previous>());
127
0
128
0
        // Allocate the generational 'most recent' cache now, if needed.
129
0
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
0
                               NKL.get<UninitializedLatest>()),
131
0
                           const_cast<decl_type *>(D));
132
0
      }
133
5.63k
134
5.63k
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))5.06k
;
135
5.63k
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::getPrevious(clang::TypedefNameDecl const*) const
Line
Count
Source
122
962k
    decl_type *getPrevious(const decl_type *D) const {
123
962k
      if (Link.is<NotKnownLatest>()) {
124
316k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
316k
        if (NKL.is<Previous>())
126
9.62k
          return static_cast<decl_type*>(NKL.get<Previous>());
127
306k
128
306k
        // Allocate the generational 'most recent' cache now, if needed.
129
306k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
306k
                               NKL.get<UninitializedLatest>()),
131
306k
                           const_cast<decl_type *>(D));
132
306k
      }
133
962k
134
962k
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))952k
;
135
962k
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::getPrevious(clang::UsingShadowDecl const*) const
Line
Count
Source
122
485k
    decl_type *getPrevious(const decl_type *D) const {
123
485k
      if (Link.is<NotKnownLatest>()) {
124
6.12k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
6.12k
        if (NKL.is<Previous>())
126
6.11k
          return static_cast<decl_type*>(NKL.get<Previous>());
127
10
128
10
        // Allocate the generational 'most recent' cache now, if needed.
129
10
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
10
                               NKL.get<UninitializedLatest>()),
131
10
                           const_cast<decl_type *>(D));
132
10
      }
133
485k
134
485k
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))479k
;
135
485k
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::getPrevious(clang::RedeclarableTemplateDecl const*) const
Line
Count
Source
122
16.6M
    decl_type *getPrevious(const decl_type *D) const {
123
16.6M
      if (Link.is<NotKnownLatest>()) {
124
818k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
818k
        if (NKL.is<Previous>())
126
252k
          return static_cast<decl_type*>(NKL.get<Previous>());
127
566k
128
566k
        // Allocate the generational 'most recent' cache now, if needed.
129
566k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
566k
                               NKL.get<UninitializedLatest>()),
131
566k
                           const_cast<decl_type *>(D));
132
566k
      }
133
16.6M
134
16.6M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))16.4M
;
135
16.6M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::getPrevious(clang::NamespaceDecl const*) const
Line
Count
Source
122
610k
    decl_type *getPrevious(const decl_type *D) const {
123
610k
      if (Link.is<NotKnownLatest>()) {
124
395k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
395k
        if (NKL.is<Previous>())
126
395k
          return static_cast<decl_type*>(NKL.get<Previous>());
127
0
128
0
        // Allocate the generational 'most recent' cache now, if needed.
129
0
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
0
                               NKL.get<UninitializedLatest>()),
131
0
                           const_cast<decl_type *>(D));
132
0
      }
133
610k
134
610k
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))215k
;
135
610k
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::getPrevious(clang::NamespaceAliasDecl const*) const
Line
Count
Source
122
212
    decl_type *getPrevious(const decl_type *D) const {
123
212
      if (Link.is<NotKnownLatest>()) {
124
66
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
66
        if (NKL.is<Previous>())
126
1
          return static_cast<decl_type*>(NKL.get<Previous>());
127
65
128
65
        // Allocate the generational 'most recent' cache now, if needed.
129
65
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
65
                               NKL.get<UninitializedLatest>()),
131
65
                           const_cast<decl_type *>(D));
132
65
      }
133
212
134
212
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))211
;
135
212
    }
136
137
10.9k
    void setPrevious(decl_type *D) {
138
10.9k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
10.9k
      Link = Previous(D);
140
10.9k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::setPrevious(clang::VarDecl*)
Line
Count
Source
137
1.08k
    void setPrevious(decl_type *D) {
138
1.08k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
1.08k
      Link = Previous(D);
140
1.08k
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::setPrevious(clang::FunctionDecl*)
Line
Count
Source
137
1.71k
    void setPrevious(decl_type *D) {
138
1.71k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
1.71k
      Link = Previous(D);
140
1.71k
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::setPrevious(clang::NamespaceDecl*)
Line
Count
Source
137
376
    void setPrevious(decl_type *D) {
138
376
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
376
      Link = Previous(D);
140
376
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::setPrevious(clang::NamespaceAliasDecl*)
Line
Count
Source
137
3
    void setPrevious(decl_type *D) {
138
3
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
3
      Link = Previous(D);
140
3
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::setPrevious(clang::ObjCInterfaceDecl*)
Line
Count
Source
137
111
    void setPrevious(decl_type *D) {
138
111
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
111
      Link = Previous(D);
140
111
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::setPrevious(clang::ObjCProtocolDecl*)
Line
Count
Source
137
38
    void setPrevious(decl_type *D) {
138
38
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
38
      Link = Previous(D);
140
38
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::setPrevious(clang::RedeclarableTemplateDecl*)
Line
Count
Source
137
1.41k
    void setPrevious(decl_type *D) {
138
1.41k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
1.41k
      Link = Previous(D);
140
1.41k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::setPrevious(clang::TagDecl*)
Line
Count
Source
137
3.96k
    void setPrevious(decl_type *D) {
138
3.96k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
3.96k
      Link = Previous(D);
140
3.96k
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::setPrevious(clang::TypedefNameDecl*)
Line
Count
Source
137
2.25k
    void setPrevious(decl_type *D) {
138
2.25k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
2.25k
      Link = Previous(D);
140
2.25k
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::setPrevious(clang::UsingShadowDecl*)
Line
Count
Source
137
11
    void setPrevious(decl_type *D) {
138
11
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
11
      Link = Previous(D);
140
11
    }
141
142
5.90M
    void setLatest(decl_type *D) {
143
5.90M
      assert(isFirst() && "decl became canonical unexpectedly");
144
5.90M
      if (Link.is<NotKnownLatest>()) {
145
3.98M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
3.98M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
3.98M
                               NKL.get<UninitializedLatest>()),
148
3.98M
                           D);
149
3.98M
      } else {
150
1.92M
        auto Latest = Link.get<KnownLatest>();
151
1.92M
        Latest.set(D);
152
1.92M
        Link = Latest;
153
1.92M
      }
154
5.90M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::setLatest(clang::NamespaceDecl*)
Line
Count
Source
142
120k
    void setLatest(decl_type *D) {
143
120k
      assert(isFirst() && "decl became canonical unexpectedly");
144
120k
      if (Link.is<NotKnownLatest>()) {
145
45.3k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
45.3k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
45.3k
                               NKL.get<UninitializedLatest>()),
148
45.3k
                           D);
149
75.0k
      } else {
150
75.0k
        auto Latest = Link.get<KnownLatest>();
151
75.0k
        Latest.set(D);
152
75.0k
        Link = Latest;
153
75.0k
      }
154
120k
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::setLatest(clang::NamespaceAliasDecl*)
Line
Count
Source
142
32
    void setLatest(decl_type *D) {
143
32
      assert(isFirst() && "decl became canonical unexpectedly");
144
32
      if (Link.is<NotKnownLatest>()) {
145
17
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
17
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
17
                               NKL.get<UninitializedLatest>()),
148
17
                           D);
149
17
      } else {
150
15
        auto Latest = Link.get<KnownLatest>();
151
15
        Latest.set(D);
152
15
        Link = Latest;
153
15
      }
154
32
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::setLatest(clang::ObjCInterfaceDecl*)
Line
Count
Source
142
30.8k
    void setLatest(decl_type *D) {
143
30.8k
      assert(isFirst() && "decl became canonical unexpectedly");
144
30.8k
      if (Link.is<NotKnownLatest>()) {
145
23.7k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
23.7k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
23.7k
                               NKL.get<UninitializedLatest>()),
148
23.7k
                           D);
149
23.7k
      } else {
150
7.14k
        auto Latest = Link.get<KnownLatest>();
151
7.14k
        Latest.set(D);
152
7.14k
        Link = Latest;
153
7.14k
      }
154
30.8k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::setLatest(clang::ObjCProtocolDecl*)
Line
Count
Source
142
4.10k
    void setLatest(decl_type *D) {
143
4.10k
      assert(isFirst() && "decl became canonical unexpectedly");
144
4.10k
      if (Link.is<NotKnownLatest>()) {
145
3.61k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
3.61k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
3.61k
                               NKL.get<UninitializedLatest>()),
148
3.61k
                           D);
149
3.61k
      } else {
150
488
        auto Latest = Link.get<KnownLatest>();
151
488
        Latest.set(D);
152
488
        Link = Latest;
153
488
      }
154
4.10k
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::setLatest(clang::RedeclarableTemplateDecl*)
Line
Count
Source
142
350k
    void setLatest(decl_type *D) {
143
350k
      assert(isFirst() && "decl became canonical unexpectedly");
144
350k
      if (Link.is<NotKnownLatest>()) {
145
260k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
260k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
260k
                               NKL.get<UninitializedLatest>()),
148
260k
                           D);
149
260k
      } else {
150
90.0k
        auto Latest = Link.get<KnownLatest>();
151
90.0k
        Latest.set(D);
152
90.0k
        Link = Latest;
153
90.0k
      }
154
350k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::setLatest(clang::TagDecl*)
Line
Count
Source
142
4.45M
    void setLatest(decl_type *D) {
143
4.45M
      assert(isFirst() && "decl became canonical unexpectedly");
144
4.45M
      if (Link.is<NotKnownLatest>()) {
145
3.33M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
3.33M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
3.33M
                               NKL.get<UninitializedLatest>()),
148
3.33M
                           D);
149
3.33M
      } else {
150
1.11M
        auto Latest = Link.get<KnownLatest>();
151
1.11M
        Latest.set(D);
152
1.11M
        Link = Latest;
153
1.11M
      }
154
4.45M
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::setLatest(clang::TypedefNameDecl*)
Line
Count
Source
142
12.4k
    void setLatest(decl_type *D) {
143
12.4k
      assert(isFirst() && "decl became canonical unexpectedly");
144
12.4k
      if (Link.is<NotKnownLatest>()) {
145
5.61k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
5.61k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
5.61k
                               NKL.get<UninitializedLatest>()),
148
5.61k
                           D);
149
6.80k
      } else {
150
6.80k
        auto Latest = Link.get<KnownLatest>();
151
6.80k
        Latest.set(D);
152
6.80k
        Link = Latest;
153
6.80k
      }
154
12.4k
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::setLatest(clang::UsingShadowDecl*)
Line
Count
Source
142
161k
    void setLatest(decl_type *D) {
143
161k
      assert(isFirst() && "decl became canonical unexpectedly");
144
161k
      if (Link.is<NotKnownLatest>()) {
145
158k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
158k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
158k
                               NKL.get<UninitializedLatest>()),
148
158k
                           D);
149
158k
      } else {
150
3.10k
        auto Latest = Link.get<KnownLatest>();
151
3.10k
        Latest.set(D);
152
3.10k
        Link = Latest;
153
3.10k
      }
154
161k
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::setLatest(clang::FunctionDecl*)
Line
Count
Source
142
564k
    void setLatest(decl_type *D) {
143
564k
      assert(isFirst() && "decl became canonical unexpectedly");
144
564k
      if (Link.is<NotKnownLatest>()) {
145
21.0k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
21.0k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
21.0k
                               NKL.get<UninitializedLatest>()),
148
21.0k
                           D);
149
543k
      } else {
150
543k
        auto Latest = Link.get<KnownLatest>();
151
543k
        Latest.set(D);
152
543k
        Link = Latest;
153
543k
      }
154
564k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::setLatest(clang::VarDecl*)
Line
Count
Source
142
210k
    void setLatest(decl_type *D) {
143
210k
      assert(isFirst() && "decl became canonical unexpectedly");
144
210k
      if (Link.is<NotKnownLatest>()) {
145
134k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
134k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
134k
                               NKL.get<UninitializedLatest>()),
148
134k
                           D);
149
134k
      } else {
150
75.7k
        auto Latest = Link.get<KnownLatest>();
151
75.7k
        Latest.set(D);
152
75.7k
        Link = Latest;
153
75.7k
      }
154
210k
    }
155
156
5.53k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
2
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
Unexecuted instantiation: clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::markIncomplete()
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
125
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
1
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
Unexecuted instantiation: clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::markIncomplete()
clang::Redeclarable<clang::TagDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
4.06k
    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
156
1.31k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::VarDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
25
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
157
158
10.2k
    Decl *getLatestNotUpdated() const {
159
10.2k
      assert(isFirst() && "expected a canonical decl");
160
10.2k
      if (Link.is<NotKnownLatest>())
161
128
        return nullptr;
162
10.1k
      return Link.get<KnownLatest>().getNotUpdated();
163
10.1k
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
260
    Decl *getLatestNotUpdated() const {
159
260
      assert(isFirst() && "expected a canonical decl");
160
260
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
260
      return Link.get<KnownLatest>().getNotUpdated();
163
260
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
3
    Decl *getLatestNotUpdated() const {
159
3
      assert(isFirst() && "expected a canonical decl");
160
3
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
3
      return Link.get<KnownLatest>().getNotUpdated();
163
3
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
353
    Decl *getLatestNotUpdated() const {
159
353
      assert(isFirst() && "expected a canonical decl");
160
353
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
353
      return Link.get<KnownLatest>().getNotUpdated();
163
353
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
79
    Decl *getLatestNotUpdated() const {
159
79
      assert(isFirst() && "expected a canonical decl");
160
79
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
79
      return Link.get<KnownLatest>().getNotUpdated();
163
79
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
4.99k
    Decl *getLatestNotUpdated() const {
159
4.99k
      assert(isFirst() && "expected a canonical decl");
160
4.99k
      if (Link.is<NotKnownLatest>())
161
7
        return nullptr;
162
4.98k
      return Link.get<KnownLatest>().getNotUpdated();
163
4.98k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
2.37k
    Decl *getLatestNotUpdated() const {
159
2.37k
      assert(isFirst() && "expected a canonical decl");
160
2.37k
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
2.37k
      return Link.get<KnownLatest>().getNotUpdated();
163
2.37k
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
160
    Decl *getLatestNotUpdated() const {
159
160
      assert(isFirst() && "expected a canonical decl");
160
160
      if (Link.is<NotKnownLatest>())
161
69
        return nullptr;
162
91
      return Link.get<KnownLatest>().getNotUpdated();
163
91
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
1
    Decl *getLatestNotUpdated() const {
159
1
      assert(isFirst() && "expected a canonical decl");
160
1
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
1
      return Link.get<KnownLatest>().getNotUpdated();
163
1
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
1.19k
    Decl *getLatestNotUpdated() const {
159
1.19k
      assert(isFirst() && "expected a canonical decl");
160
1.19k
      if (Link.is<NotKnownLatest>())
161
52
        return nullptr;
162
1.14k
      return Link.get<KnownLatest>().getNotUpdated();
163
1.14k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
854
    Decl *getLatestNotUpdated() const {
159
854
      assert(isFirst() && "expected a canonical decl");
160
854
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
854
      return Link.get<KnownLatest>().getNotUpdated();
163
854
    }
164
  };
165
166
1.89M
  static DeclLink PreviousDeclLink(decl_type *D) {
167
1.89M
    return DeclLink(DeclLink::PreviousLink, D);
168
1.89M
  }
clang::Redeclarable<clang::TypedefNameDecl>::PreviousDeclLink(clang::TypedefNameDecl*)
Line
Count
Source
166
8.97k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
8.97k
    return DeclLink(DeclLink::PreviousLink, D);
168
8.97k
  }
clang::Redeclarable<clang::TagDecl>::PreviousDeclLink(clang::TagDecl*)
Line
Count
Source
166
1.09M
  static DeclLink PreviousDeclLink(decl_type *D) {
167
1.09M
    return DeclLink(DeclLink::PreviousLink, D);
168
1.09M
  }
clang::Redeclarable<clang::FunctionDecl>::PreviousDeclLink(clang::FunctionDecl*)
Line
Count
Source
166
544k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
544k
    return DeclLink(DeclLink::PreviousLink, D);
168
544k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::PreviousDeclLink(clang::ObjCInterfaceDecl*)
Line
Count
Source
166
6.88k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
6.88k
    return DeclLink(DeclLink::PreviousLink, D);
168
6.88k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::PreviousDeclLink(clang::ObjCProtocolDecl*)
Line
Count
Source
166
424
  static DeclLink PreviousDeclLink(decl_type *D) {
167
424
    return DeclLink(DeclLink::PreviousLink, D);
168
424
  }
clang::Redeclarable<clang::VarDecl>::PreviousDeclLink(clang::VarDecl*)
Line
Count
Source
166
75.9k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
75.9k
    return DeclLink(DeclLink::PreviousLink, D);
168
75.9k
  }
clang::Redeclarable<clang::NamespaceDecl>::PreviousDeclLink(clang::NamespaceDecl*)
Line
Count
Source
166
74.6k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
74.6k
    return DeclLink(DeclLink::PreviousLink, D);
168
74.6k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::PreviousDeclLink(clang::NamespaceAliasDecl*)
Line
Count
Source
166
15
  static DeclLink PreviousDeclLink(decl_type *D) {
167
15
    return DeclLink(DeclLink::PreviousLink, D);
168
15
  }
clang::Redeclarable<clang::UsingShadowDecl>::PreviousDeclLink(clang::UsingShadowDecl*)
Line
Count
Source
166
3.11k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
3.11k
    return DeclLink(DeclLink::PreviousLink, D);
168
3.11k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::PreviousDeclLink(clang::RedeclarableTemplateDecl*)
Line
Count
Source
166
90.2k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
90.2k
    return DeclLink(DeclLink::PreviousLink, D);
168
90.2k
  }
169
170
34.9M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
34.9M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
34.9M
  }
clang::Redeclarable<clang::TypedefNameDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
2.42M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
2.42M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
2.42M
  }
clang::Redeclarable<clang::VarDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
18.2M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
18.2M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
18.2M
  }
clang::Redeclarable<clang::FunctionDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
8.40M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
8.40M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
8.40M
  }
clang::Redeclarable<clang::TagDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
4.42M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
4.42M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
4.42M
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
263
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
263
    return DeclLink(DeclLink::LatestLink, Ctx);
172
263
  }
clang::Redeclarable<clang::NamespaceDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
119k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
119k
    return DeclLink(DeclLink::LatestLink, Ctx);
172
119k
  }
clang::Redeclarable<clang::UsingShadowDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
161k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
161k
    return DeclLink(DeclLink::LatestLink, Ctx);
172
161k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
30.4k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
30.4k
    return DeclLink(DeclLink::LatestLink, Ctx);
172
30.4k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
4.00k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
4.00k
    return DeclLink(DeclLink::LatestLink, Ctx);
172
4.00k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
1.11M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
1.11M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
1.11M
  }
173
174
  /// Points to the next redeclaration in the chain.
175
  ///
176
  /// If isFirst() is false, this is a link to the previous declaration
177
  /// of this same Decl. If isFirst() is true, this is the first
178
  /// declaration and Link points to the latest declaration. For example:
179
  ///
180
  ///  #1 int f(int x, int y = 1); // <pointer to #3, true>
181
  ///  #2 int f(int x = 0, int y); // <pointer to #1, false>
182
  ///  #3 int f(int x, int y) { return x + y; } // <pointer to #2, false>
183
  ///
184
  /// If there is only one declaration, it is <pointer to self, true>
185
  DeclLink RedeclLink;
186
187
  decl_type *First;
188
189
470M
  decl_type *getNextRedeclaration() const {
190
470M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
470M
  }
clang::Redeclarable<clang::TagDecl>::getNextRedeclaration() const
Line
Count
Source
189
346M
  decl_type *getNextRedeclaration() const {
190
346M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
346M
  }
clang::Redeclarable<clang::VarDecl>::getNextRedeclaration() const
Line
Count
Source
189
56.7M
  decl_type *getNextRedeclaration() const {
190
56.7M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
56.7M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getNextRedeclaration() const
Line
Count
Source
189
32.5k
  decl_type *getNextRedeclaration() const {
190
32.5k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
32.5k
  }
clang::Redeclarable<clang::FunctionDecl>::getNextRedeclaration() const
Line
Count
Source
189
48.5M
  decl_type *getNextRedeclaration() const {
190
48.5M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
48.5M
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getNextRedeclaration() const
Line
Count
Source
189
5.63k
  decl_type *getNextRedeclaration() const {
190
5.63k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
5.63k
  }
clang::Redeclarable<clang::NamespaceDecl>::getNextRedeclaration() const
Line
Count
Source
189
610k
  decl_type *getNextRedeclaration() const {
190
610k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
610k
  }
clang::Redeclarable<clang::TypedefNameDecl>::getNextRedeclaration() const
Line
Count
Source
189
962k
  decl_type *getNextRedeclaration() const {
190
962k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
962k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getNextRedeclaration() const
Line
Count
Source
189
212
  decl_type *getNextRedeclaration() const {
190
212
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
212
  }
clang::Redeclarable<clang::UsingShadowDecl>::getNextRedeclaration() const
Line
Count
Source
189
485k
  decl_type *getNextRedeclaration() const {
190
485k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
485k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getNextRedeclaration() const
Line
Count
Source
189
16.6M
  decl_type *getNextRedeclaration() const {
190
16.6M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
16.6M
  }
192
193
public:
194
  friend class ASTDeclReader;
195
  friend class ASTDeclWriter;
196
197
  Redeclarable(const ASTContext &Ctx)
198
      : RedeclLink(LatestDeclLink(Ctx)),
199
34.9M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::TypedefNameDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
2.42M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::VarDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
18.2M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::FunctionDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
8.40M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::TagDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
4.42M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::NamespaceAliasDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
263
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::NamespaceDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
119k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::UsingShadowDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
161k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
30.4k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
4.00k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::RedeclarableTemplateDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
1.11M
        First(static_cast<decl_type *>(this)) {}
200
201
  /// Return the previous declaration of this declaration or NULL if this
202
  /// is the first declaration.
203
13.2M
  decl_type *getPreviousDecl() {
204
13.2M
    if (!RedeclLink.isFirst())
205
2.35M
      return getNextRedeclaration();
206
10.8M
    return nullptr;
207
10.8M
  }
clang::Redeclarable<clang::VarDecl>::getPreviousDecl()
Line
Count
Source
203
491k
  decl_type *getPreviousDecl() {
204
491k
    if (!RedeclLink.isFirst())
205
29.7k
      return getNextRedeclaration();
206
461k
    return nullptr;
207
461k
  }
clang::Redeclarable<clang::FunctionDecl>::getPreviousDecl()
Line
Count
Source
203
5.33M
  decl_type *getPreviousDecl() {
204
5.33M
    if (!RedeclLink.isFirst())
205
335k
      return getNextRedeclaration();
206
5.00M
    return nullptr;
207
5.00M
  }
clang::Redeclarable<clang::TagDecl>::getPreviousDecl()
Line
Count
Source
203
5.24M
  decl_type *getPreviousDecl() {
204
5.24M
    if (!RedeclLink.isFirst())
205
1.81M
      return getNextRedeclaration();
206
3.42M
    return nullptr;
207
3.42M
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getPreviousDecl()
Line
Count
Source
203
1.30M
  decl_type *getPreviousDecl() {
204
1.30M
    if (!RedeclLink.isFirst())
205
164k
      return getNextRedeclaration();
206
1.13M
    return nullptr;
207
1.13M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getPreviousDecl()
Line
Count
Source
203
3.12k
  decl_type *getPreviousDecl() {
204
3.12k
    if (!RedeclLink.isFirst())
205
1.36k
      return getNextRedeclaration();
206
1.75k
    return nullptr;
207
1.75k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getPreviousDecl()
Line
Count
Source
203
317
  decl_type *getPreviousDecl() {
204
317
    if (!RedeclLink.isFirst())
205
171
      return getNextRedeclaration();
206
146
    return nullptr;
207
146
  }
clang::Redeclarable<clang::TypedefNameDecl>::getPreviousDecl()
Line
Count
Source
203
816k
  decl_type *getPreviousDecl() {
204
816k
    if (!RedeclLink.isFirst())
205
8.81k
      return getNextRedeclaration();
206
807k
    return nullptr;
207
807k
  }
clang::Redeclarable<clang::UsingShadowDecl>::getPreviousDecl()
Line
Count
Source
203
140
  decl_type *getPreviousDecl() {
204
140
    if (!RedeclLink.isFirst())
205
33
      return getNextRedeclaration();
206
107
    return nullptr;
207
107
  }
clang::Redeclarable<clang::NamespaceDecl>::getPreviousDecl()
Line
Count
Source
203
32.4k
  decl_type *getPreviousDecl() {
204
32.4k
    if (!RedeclLink.isFirst())
205
4.99k
      return getNextRedeclaration();
206
27.4k
    return nullptr;
207
27.4k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getPreviousDecl()
Line
Count
Source
203
4
  decl_type *getPreviousDecl() {
204
4
    if (!RedeclLink.isFirst())
205
0
      return getNextRedeclaration();
206
4
    return nullptr;
207
4
  }
208
2.44M
  const decl_type *getPreviousDecl() const {
209
2.44M
    return const_cast<decl_type *>(
210
2.44M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
2.44M
  }
clang::Redeclarable<clang::FunctionDecl>::getPreviousDecl() const
Line
Count
Source
208
1.33M
  const decl_type *getPreviousDecl() const {
209
1.33M
    return const_cast<decl_type *>(
210
1.33M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
1.33M
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getPreviousDecl() const
Line
Count
Source
208
647k
  const decl_type *getPreviousDecl() const {
209
647k
    return const_cast<decl_type *>(
210
647k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
647k
  }
clang::Redeclarable<clang::TagDecl>::getPreviousDecl() const
Line
Count
Source
208
3.92k
  const decl_type *getPreviousDecl() const {
209
3.92k
    return const_cast<decl_type *>(
210
3.92k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
3.92k
  }
clang::Redeclarable<clang::VarDecl>::getPreviousDecl() const
Line
Count
Source
208
453k
  const decl_type *getPreviousDecl() const {
209
453k
    return const_cast<decl_type *>(
210
453k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
453k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getPreviousDecl() const
Line
Count
Source
208
2.32k
  const decl_type *getPreviousDecl() const {
209
2.32k
    return const_cast<decl_type *>(
210
2.32k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
2.32k
  }
clang::Redeclarable<clang::NamespaceDecl>::getPreviousDecl() const
Line
Count
Source
208
133
  const decl_type *getPreviousDecl() const {
209
133
    return const_cast<decl_type *>(
210
133
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
133
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getPreviousDecl() const
Line
Count
Source
208
4
  const decl_type *getPreviousDecl() const {
209
4
    return const_cast<decl_type *>(
210
4
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
4
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getPreviousDecl() const
Line
Count
Source
208
21
  const decl_type *getPreviousDecl() const {
209
21
    return const_cast<decl_type *>(
210
21
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
21
  }
clang::Redeclarable<clang::TypedefNameDecl>::getPreviousDecl() const
Line
Count
Source
208
750
  const decl_type *getPreviousDecl() const {
209
750
    return const_cast<decl_type *>(
210
750
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
750
  }
clang::Redeclarable<clang::UsingShadowDecl>::getPreviousDecl() const
Line
Count
Source
208
24
  const decl_type *getPreviousDecl() const {
209
24
    return const_cast<decl_type *>(
210
24
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
24
  }
212
213
  /// Return the first declaration of this declaration or itself if this
214
  /// is the only declaration.
215
837M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::TagDecl>::getFirstDecl()
Line
Count
Source
215
362M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::VarDecl>::getFirstDecl()
Line
Count
Source
215
115M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getFirstDecl()
Line
Count
Source
215
174k
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::ObjCProtocolDecl>::getFirstDecl()
Line
Count
Source
215
14.7k
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::FunctionDecl>::getFirstDecl()
Line
Count
Source
215
267M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getFirstDecl()
Line
Count
Source
215
78.6M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::NamespaceDecl>::getFirstDecl()
Line
Count
Source
215
191k
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::NamespaceAliasDecl>::getFirstDecl()
Line
Count
Source
215
421
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::UsingShadowDecl>::getFirstDecl()
Line
Count
Source
215
1.35M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::TypedefNameDecl>::getFirstDecl()
Line
Count
Source
215
11.2M
  decl_type *getFirstDecl() { return First; }
216
217
  /// Return the first declaration of this declaration or itself if this
218
  /// is the only declaration.
219
41.1M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::TagDecl>::getFirstDecl() const
Line
Count
Source
219
223k
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::VarDecl>::getFirstDecl() const
Line
Count
Source
219
15.1M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getFirstDecl() const
Line
Count
Source
219
3.32k
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::ObjCProtocolDecl>::getFirstDecl() const
Line
Count
Source
219
773
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::FunctionDecl>::getFirstDecl() const
Line
Count
Source
219
19.5M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getFirstDecl() const
Line
Count
Source
219
6.14M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::TypedefNameDecl>::getFirstDecl() const
Line
Count
Source
219
67
  const decl_type *getFirstDecl() const { return First; }
Unexecuted instantiation: clang::Redeclarable<clang::NamespaceAliasDecl>::getFirstDecl() const
Unexecuted instantiation: clang::Redeclarable<clang::UsingShadowDecl>::getFirstDecl() const
220
221
  /// True if this is the first declaration in its redeclaration chain.
222
434M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::VarDecl>::isFirstDecl() const
Line
Count
Source
222
11.3M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::FunctionDecl>::isFirstDecl() const
Line
Count
Source
222
20.6M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::TagDecl>::isFirstDecl() const
Line
Count
Source
222
20.1M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::TypedefNameDecl>::isFirstDecl() const
Line
Count
Source
222
7.20k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::ObjCInterfaceDecl>::isFirstDecl() const
Line
Count
Source
222
15.5k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::ObjCProtocolDecl>::isFirstDecl() const
Line
Count
Source
222
3.71k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::NamespaceDecl>::isFirstDecl() const
Line
Count
Source
222
381M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::NamespaceAliasDecl>::isFirstDecl() const
Line
Count
Source
222
16
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::UsingShadowDecl>::isFirstDecl() const
Line
Count
Source
222
917
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::isFirstDecl() const
Line
Count
Source
222
488k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
223
224
  /// Returns the most recent (re)declaration of this declaration.
225
401M
  decl_type *getMostRecentDecl() {
226
401M
    return getFirstDecl()->getNextRedeclaration();
227
401M
  }
clang::Redeclarable<clang::TagDecl>::getMostRecentDecl()
Line
Count
Source
225
322M
  decl_type *getMostRecentDecl() {
226
322M
    return getFirstDecl()->getNextRedeclaration();
227
322M
  }
clang::Redeclarable<clang::VarDecl>::getMostRecentDecl()
Line
Count
Source
225
39.1M
  decl_type *getMostRecentDecl() {
226
39.1M
    return getFirstDecl()->getNextRedeclaration();
227
39.1M
  }
clang::Redeclarable<clang::FunctionDecl>::getMostRecentDecl()
Line
Count
Source
225
29.7M
  decl_type *getMostRecentDecl() {
226
29.7M
    return getFirstDecl()->getNextRedeclaration();
227
29.7M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getMostRecentDecl()
Line
Count
Source
225
4.75k
  decl_type *getMostRecentDecl() {
226
4.75k
    return getFirstDecl()->getNextRedeclaration();
227
4.75k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getMostRecentDecl()
Line
Count
Source
225
1.01k
  decl_type *getMostRecentDecl() {
226
1.01k
    return getFirstDecl()->getNextRedeclaration();
227
1.01k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getMostRecentDecl()
Line
Count
Source
225
9.07M
  decl_type *getMostRecentDecl() {
226
9.07M
    return getFirstDecl()->getNextRedeclaration();
227
9.07M
  }
clang::Redeclarable<clang::TypedefNameDecl>::getMostRecentDecl()
Line
Count
Source
225
641k
  decl_type *getMostRecentDecl() {
226
641k
    return getFirstDecl()->getNextRedeclaration();
227
641k
  }
clang::Redeclarable<clang::UsingShadowDecl>::getMostRecentDecl()
Line
Count
Source
225
317k
  decl_type *getMostRecentDecl() {
226
317k
    return getFirstDecl()->getNextRedeclaration();
227
317k
  }
clang::Redeclarable<clang::NamespaceDecl>::getMostRecentDecl()
Line
Count
Source
225
116k
  decl_type *getMostRecentDecl() {
226
116k
    return getFirstDecl()->getNextRedeclaration();
227
116k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getMostRecentDecl()
Line
Count
Source
225
129
  decl_type *getMostRecentDecl() {
226
129
    return getFirstDecl()->getNextRedeclaration();
227
129
  }
228
229
  /// Returns the most recent (re)declaration of this declaration.
230
7.01M
  const decl_type *getMostRecentDecl() const {
231
7.01M
    return getFirstDecl()->getNextRedeclaration();
232
7.01M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getMostRecentDecl() const
Line
Count
Source
230
3.32k
  const decl_type *getMostRecentDecl() const {
231
3.32k
    return getFirstDecl()->getNextRedeclaration();
232
3.32k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getMostRecentDecl() const
Line
Count
Source
230
152
  const decl_type *getMostRecentDecl() const {
231
152
    return getFirstDecl()->getNextRedeclaration();
232
152
  }
clang::Redeclarable<clang::FunctionDecl>::getMostRecentDecl() const
Line
Count
Source
230
867k
  const decl_type *getMostRecentDecl() const {
231
867k
    return getFirstDecl()->getNextRedeclaration();
232
867k
  }
clang::Redeclarable<clang::VarDecl>::getMostRecentDecl() const
Line
Count
Source
230
464
  const decl_type *getMostRecentDecl() const {
231
464
    return getFirstDecl()->getNextRedeclaration();
232
464
  }
clang::Redeclarable<clang::TagDecl>::getMostRecentDecl() const
Line
Count
Source
230
129
  const decl_type *getMostRecentDecl() const {
231
129
    return getFirstDecl()->getNextRedeclaration();
232
129
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getMostRecentDecl() const
Line
Count
Source
230
6.13M
  const decl_type *getMostRecentDecl() const {
231
6.13M
    return getFirstDecl()->getNextRedeclaration();
232
6.13M
  }
233
234
  /// Set the previous declaration. If PrevDecl is NULL, set this as the
235
  /// first and only declaration.
236
  void setPreviousDecl(decl_type *PrevDecl);
237
238
  /// Iterates through all the redeclarations of the same decl.
239
  class redecl_iterator {
240
    /// Current - The current declaration.
241
    decl_type *Current = nullptr;
242
    decl_type *Starter;
243
    bool PassedFirst = false;
244
245
  public:
246
    using value_type = decl_type *;
247
    using reference = decl_type *;
248
    using pointer = decl_type *;
249
    using iterator_category = std::forward_iterator_tag;
250
    using difference_type = std::ptrdiff_t;
251
252
302M
    redecl_iterator() = default;
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
252
26.3M
    redecl_iterator() = default;
clang::Redeclarable<clang::TagDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
252
248M
    redecl_iterator() = default;
clang::Redeclarable<clang::VarDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
252
26.9M
    redecl_iterator() = default;
clang::Redeclarable<clang::RedeclarableTemplateDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
252
428k
    redecl_iterator() = default;
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
252
586
    redecl_iterator() = default;
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
252
13.0k
    redecl_iterator() = default;
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
252
3.34k
    redecl_iterator() = default;
253
302M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::redecl_iterator(clang::FunctionDecl*)
Line
Count
Source
253
26.3M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::TagDecl>::redecl_iterator::redecl_iterator(clang::TagDecl*)
Line
Count
Source
253
248M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::VarDecl>::redecl_iterator::redecl_iterator(clang::VarDecl*)
Line
Count
Source
253
26.9M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::RedeclarableTemplateDecl>::redecl_iterator::redecl_iterator(clang::RedeclarableTemplateDecl*)
Line
Count
Source
253
428k
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::redecl_iterator(clang::UsingShadowDecl*)
Line
Count
Source
253
586
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::redecl_iterator(clang::ObjCInterfaceDecl*)
Line
Count
Source
253
13.0k
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::redecl_iterator(clang::ObjCProtocolDecl*)
Line
Count
Source
253
3.34k
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
254
255
321M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::operator*() const
Line
Count
Source
255
28.4M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::TagDecl>::redecl_iterator::operator*() const
Line
Count
Source
255
260M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::VarDecl>::redecl_iterator::operator*() const
Line
Count
Source
255
32.2M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::redecl_iterator::operator*() const
Line
Count
Source
255
478k
    reference operator*() const { return Current; }
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::operator*() const
Line
Count
Source
255
594
    reference operator*() const { return Current; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::operator*() const
Line
Count
Source
255
15.3k
    reference operator*() const { return Current; }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::operator*() const
Line
Count
Source
255
3.62k
    reference operator*() const { return Current; }
256
    pointer operator->() const { return Current; }
257
258
44.7M
    redecl_iterator& operator++() {
259
44.7M
      assert(Current && "Advancing while iterator has reached end");
260
44.7M
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
44.7M
      if (Current->isFirstDecl()) {
262
40.3M
        if (PassedFirst) {
263
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
264
0
          Current = nullptr;
265
0
          return *this;
266
0
        }
267
40.3M
        PassedFirst = true;
268
40.3M
      }
269
44.7M
270
44.7M
      // Get either previous decl or latest decl.
271
44.7M
      decl_type *Next = Current->getNextRedeclaration();
272
44.7M
      Current = (Next != Starter) ? 
Next19.8M
:
nullptr24.8M
;
273
44.7M
      return *this;
274
44.7M
    }
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::operator++()
Line
Count
Source
258
15.0M
    redecl_iterator& operator++() {
259
15.0M
      assert(Current && "Advancing while iterator has reached end");
260
15.0M
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
15.0M
      if (Current->isFirstDecl()) {
262
14.1M
        if (PassedFirst) {
263
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
264
0
          Current = nullptr;
265
0
          return *this;
266
0
        }
267
14.1M
        PassedFirst = true;
268
14.1M
      }
269
15.0M
270
15.0M
      // Get either previous decl or latest decl.
271
15.0M
      decl_type *Next = Current->getNextRedeclaration();
272
15.0M
      Current = (Next != Starter) ? 
Next2.05M
:
nullptr13.0M
;
273
15.0M
      return *this;
274
15.0M
    }
clang::Redeclarable<clang::TagDecl>::redecl_iterator::operator++()
Line
Count
Source
258
20.1M
    redecl_iterator& operator++() {
259
20.1M
      assert(Current && "Advancing while iterator has reached end");
260
20.1M
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
20.1M
      if (Current->isFirstDecl()) {
262
18.9M
        if (PassedFirst) {
263
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
264
0
          Current = nullptr;
265
0
          return *this;
266
0
        }
267
18.9M
        PassedFirst = true;
268
18.9M
      }
269
20.1M
270
20.1M
      // Get either previous decl or latest decl.
271
20.1M
      decl_type *Next = Current->getNextRedeclaration();
272
20.1M
      Current = (Next != Starter) ? 
Next12.4M
:
nullptr7.71M
;
273
20.1M
      return *this;
274
20.1M
    }
clang::Redeclarable<clang::VarDecl>::redecl_iterator::operator++()
Line
Count
Source
258
8.99M
    redecl_iterator& operator++() {
259
8.99M
      assert(Current && "Advancing while iterator has reached end");
260
8.99M
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
8.99M
      if (Current->isFirstDecl()) {
262
6.80M
        if (PassedFirst) {
263
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
264
0
          Current = nullptr;
265
0
          return *this;
266
0
        }
267
6.80M
        PassedFirst = true;
268
6.80M
      }
269
8.99M
270
8.99M
      // Get either previous decl or latest decl.
271
8.99M
      decl_type *Next = Current->getNextRedeclaration();
272
8.99M
      Current = (Next != Starter) ? 
Next5.31M
:
nullptr3.68M
;
273
8.99M
      return *this;
274
8.99M
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::redecl_iterator::operator++()
Line
Count
Source
258
478k
    redecl_iterator& operator++() {
259
478k
      assert(Current && "Advancing while iterator has reached end");
260
478k
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
478k
      if (Current->isFirstDecl()) {
262
428k
        if (PassedFirst) {
263
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
264
0
          Current = nullptr;
265
0
          return *this;
266
0
        }
267
428k
        PassedFirst = true;
268
428k
      }
269
478k
270
478k
      // Get either previous decl or latest decl.
271
478k
      decl_type *Next = Current->getNextRedeclaration();
272
478k
      Current = (Next != Starter) ? 
Next49.9k
:
nullptr428k
;
273
478k
      return *this;
274
478k
    }
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::operator++()
Line
Count
Source
258
594
    redecl_iterator& operator++() {
259
594
      assert(Current && "Advancing while iterator has reached end");
260
594
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
594
      if (Current->isFirstDecl()) {
262
586
        if (PassedFirst) {
263
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
264
0
          Current = nullptr;
265
0
          return *this;
266
0
        }
267
586
        PassedFirst = true;
268
586
      }
269
594
270
594
      // Get either previous decl or latest decl.
271
594
      decl_type *Next = Current->getNextRedeclaration();
272
594
      Current = (Next != Starter) ? 
Next8
:
nullptr586
;
273
594
      return *this;
274
594
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::operator++()
Line
Count
Source
258
15.3k
    redecl_iterator& operator++() {
259
15.3k
      assert(Current && "Advancing while iterator has reached end");
260
15.3k
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
15.3k
      if (Current->isFirstDecl()) {
262
13.0k
        if (PassedFirst) {
263
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
264
0
          Current = nullptr;
265
0
          return *this;
266
0
        }
267
13.0k
        PassedFirst = true;
268
13.0k
      }
269
15.3k
270
15.3k
      // Get either previous decl or latest decl.
271
15.3k
      decl_type *Next = Current->getNextRedeclaration();
272
15.3k
      Current = (Next != Starter) ? 
Next2.26k
:
nullptr13.0k
;
273
15.3k
      return *this;
274
15.3k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::operator++()
Line
Count
Source
258
3.62k
    redecl_iterator& operator++() {
259
3.62k
      assert(Current && "Advancing while iterator has reached end");
260
3.62k
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
3.62k
      if (Current->isFirstDecl()) {
262
3.34k
        if (PassedFirst) {
263
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
264
0
          Current = nullptr;
265
0
          return *this;
266
0
        }
267
3.34k
        PassedFirst = true;
268
3.34k
      }
269
3.62k
270
3.62k
      // Get either previous decl or latest decl.
271
3.62k
      decl_type *Next = Current->getNextRedeclaration();
272
3.62k
      Current = (Next != Starter) ? 
Next283
:
nullptr3.34k
;
273
3.62k
      return *this;
274
3.62k
    }
275
276
    redecl_iterator operator++(int) {
277
      redecl_iterator tmp(*this);
278
      ++(*this);
279
      return tmp;
280
    }
281
282
11
    friend bool operator==(redecl_iterator x, redecl_iterator y) {
283
11
      return x.Current == y.Current;
284
11
    }
285
346M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
286
346M
      return x.Current != y.Current;
287
346M
    }
clang::operator!=(clang::Redeclarable<clang::TagDecl>::redecl_iterator, clang::Redeclarable<clang::TagDecl>::redecl_iterator)
Line
Count
Source
285
268M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
286
268M
      return x.Current != y.Current;
287
268M
    }
clang::operator!=(clang::Redeclarable<clang::VarDecl>::redecl_iterator, clang::Redeclarable<clang::VarDecl>::redecl_iterator)
Line
Count
Source
285
35.9M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
286
35.9M
      return x.Current != y.Current;
287
35.9M
    }
clang::operator!=(clang::Redeclarable<clang::FunctionDecl>::redecl_iterator, clang::Redeclarable<clang::FunctionDecl>::redecl_iterator)
Line
Count
Source
285
41.4M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
286
41.4M
      return x.Current != y.Current;
287
41.4M
    }
clang::operator!=(clang::Redeclarable<clang::RedeclarableTemplateDecl>::redecl_iterator, clang::Redeclarable<clang::RedeclarableTemplateDecl>::redecl_iterator)
Line
Count
Source
285
907k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
286
907k
      return x.Current != y.Current;
287
907k
    }
clang::operator!=(clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator, clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator)
Line
Count
Source
285
1.18k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
286
1.18k
      return x.Current != y.Current;
287
1.18k
    }
clang::operator!=(clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator, clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator)
Line
Count
Source
285
28.3k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
286
28.3k
      return x.Current != y.Current;
287
28.3k
    }
clang::operator!=(clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator, clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator)
Line
Count
Source
285
6.97k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
286
6.97k
      return x.Current != y.Current;
287
6.97k
    }
288
  };
289
290
  using redecl_range = llvm::iterator_range<redecl_iterator>;
291
292
  /// Returns an iterator range for all the redeclarations of the same
293
  /// decl. It will iterate at least once (when this decl is the only one).
294
302M
  redecl_range redecls() const {
295
302M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
296
302M
                            static_cast<const decl_type *>(this))),
297
302M
                        redecl_iterator());
298
302M
  }
clang::Redeclarable<clang::VarDecl>::redecls() const
Line
Count
Source
294
26.9M
  redecl_range redecls() const {
295
26.9M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
296
26.9M
                            static_cast<const decl_type *>(this))),
297
26.9M
                        redecl_iterator());
298
26.9M
  }
clang::Redeclarable<clang::FunctionDecl>::redecls() const
Line
Count
Source
294
26.3M
  redecl_range redecls() const {
295
26.3M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
296
26.3M
                            static_cast<const decl_type *>(this))),
297
26.3M
                        redecl_iterator());
298
26.3M
  }
clang::Redeclarable<clang::TagDecl>::redecls() const
Line
Count
Source
294
248M
  redecl_range redecls() const {
295
248M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
296
248M
                            static_cast<const decl_type *>(this))),
297
248M
                        redecl_iterator());
298
248M
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::redecls() const
Line
Count
Source
294
428k
  redecl_range redecls() const {
295
428k
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
296
428k
                            static_cast<const decl_type *>(this))),
297
428k
                        redecl_iterator());
298
428k
  }
clang::Redeclarable<clang::UsingShadowDecl>::redecls() const
Line
Count
Source
294
586
  redecl_range redecls() const {
295
586
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
296
586
                            static_cast<const decl_type *>(this))),
297
586
                        redecl_iterator());
298
586
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecls() const
Line
Count
Source
294
13.0k
  redecl_range redecls() const {
295
13.0k
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
296
13.0k
                            static_cast<const decl_type *>(this))),
297
13.0k
                        redecl_iterator());
298
13.0k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecls() const
Line
Count
Source
294
3.34k
  redecl_range redecls() const {
295
3.34k
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
296
3.34k
                            static_cast<const decl_type *>(this))),
297
3.34k
                        redecl_iterator());
298
3.34k
  }
299
300
  redecl_iterator redecls_begin() const { return redecls().begin(); }
301
11
  redecl_iterator redecls_end() const { return redecls().end(); }
302
};
303
304
/// Get the primary declaration for a declaration from an AST file. That
305
/// will be the first-loaded declaration.
306
Decl *getPrimaryMergedDecl(Decl *D);
307
308
/// Provides common interface for the Decls that cannot be redeclared,
309
/// but can be merged if the same declaration is brought in from multiple
310
/// modules.
311
template<typename decl_type>
312
class Mergeable {
313
public:
314
  Mergeable() = default;
315
316
  /// Return the first declaration of this declaration or itself if this
317
  /// is the only declaration.
318
6.17M
  decl_type *getFirstDecl() {
319
6.17M
    auto *D = static_cast<decl_type *>(this);
320
6.17M
    if (!D->isFromASTFile())
321
6.15M
      return D;
322
23.0k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
323
23.0k
  }
clang::Mergeable<clang::FieldDecl>::getFirstDecl()
Line
Count
Source
318
5.30M
  decl_type *getFirstDecl() {
319
5.30M
    auto *D = static_cast<decl_type *>(this);
320
5.30M
    if (!D->isFromASTFile())
321
5.28M
      return D;
322
21.3k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
323
21.3k
  }
clang::Mergeable<clang::UsingPackDecl>::getFirstDecl()
Line
Count
Source
318
3
  decl_type *getFirstDecl() {
319
3
    auto *D = static_cast<decl_type *>(this);
320
3
    if (!D->isFromASTFile())
321
2
      return D;
322
1
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
323
1
  }
clang::Mergeable<clang::IndirectFieldDecl>::getFirstDecl()
Line
Count
Source
318
21.7k
  decl_type *getFirstDecl() {
319
21.7k
    auto *D = static_cast<decl_type *>(this);
320
21.7k
    if (!D->isFromASTFile())
321
21.5k
      return D;
322
165
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
323
165
  }
clang::Mergeable<clang::EnumConstantDecl>::getFirstDecl()
Line
Count
Source
318
627k
  decl_type *getFirstDecl() {
319
627k
    auto *D = static_cast<decl_type *>(this);
320
627k
    if (!D->isFromASTFile())
321
626k
      return D;
322
883
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
323
883
  }
clang::Mergeable<clang::UsingDecl>::getFirstDecl()
Line
Count
Source
318
221k
  decl_type *getFirstDecl() {
319
221k
    auto *D = static_cast<decl_type *>(this);
320
221k
    if (!D->isFromASTFile())
321
220k
      return D;
322
449
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
323
449
  }
clang::Mergeable<clang::UnresolvedUsingValueDecl>::getFirstDecl()
Line
Count
Source
318
915
  decl_type *getFirstDecl() {
319
915
    auto *D = static_cast<decl_type *>(this);
320
915
    if (!D->isFromASTFile())
321
813
      return D;
322
102
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
323
102
  }
clang::Mergeable<clang::UnresolvedUsingTypenameDecl>::getFirstDecl()
Line
Count
Source
318
377
  decl_type *getFirstDecl() {
319
377
    auto *D = static_cast<decl_type *>(this);
320
377
    if (!D->isFromASTFile())
321
273
      return D;
322
104
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
323
104
  }
324
325
  /// Return the first declaration of this declaration or itself if this
326
  /// is the only declaration.
327
2.73M
  const decl_type *getFirstDecl() const {
328
2.73M
    const auto *D = static_cast<const decl_type *>(this);
329
2.73M
    if (!D->isFromASTFile())
330
2.70M
      return D;
331
22.9k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
332
22.9k
  }
clang::Mergeable<clang::FieldDecl>::getFirstDecl() const
Line
Count
Source
327
2.73M
  const decl_type *getFirstDecl() const {
328
2.73M
    const auto *D = static_cast<const decl_type *>(this);
329
2.73M
    if (!D->isFromASTFile())
330
2.70M
      return D;
331
22.9k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
332
22.9k
  }
Unexecuted instantiation: clang::Mergeable<clang::UsingPackDecl>::getFirstDecl() const
clang::Mergeable<clang::IndirectFieldDecl>::getFirstDecl() const
Line
Count
Source
327
27
  const decl_type *getFirstDecl() const {
328
27
    const auto *D = static_cast<const decl_type *>(this);
329
27
    if (!D->isFromASTFile())
330
27
      return D;
331
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
332
0
  }
clang::Mergeable<clang::EnumConstantDecl>::getFirstDecl() const
Line
Count
Source
327
65
  const decl_type *getFirstDecl() const {
328
65
    const auto *D = static_cast<const decl_type *>(this);
329
65
    if (!D->isFromASTFile())
330
65
      return D;
331
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
332
0
  }
clang::Mergeable<clang::UsingDecl>::getFirstDecl() const
Line
Count
Source
327
18
  const decl_type *getFirstDecl() const {
328
18
    const auto *D = static_cast<const decl_type *>(this);
329
18
    if (!D->isFromASTFile())
330
18
      return D;
331
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
332
0
  }
clang::Mergeable<clang::UnresolvedUsingValueDecl>::getFirstDecl() const
Line
Count
Source
327
2
  const decl_type *getFirstDecl() const {
328
2
    const auto *D = static_cast<const decl_type *>(this);
329
2
    if (!D->isFromASTFile())
330
2
      return D;
331
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
332
0
  }
clang::Mergeable<clang::UnresolvedUsingTypenameDecl>::getFirstDecl() const
Line
Count
Source
327
2
  const decl_type *getFirstDecl() const {
328
2
    const auto *D = static_cast<const decl_type *>(this);
329
2
    if (!D->isFromASTFile())
330
2
      return D;
331
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
332
0
  }
333
334
  /// Returns true if this is the first declaration.
335
  bool isFirstDecl() const { return getFirstDecl() == this; }
336
};
337
338
/// A wrapper class around a pointer that always points to its canonical
339
/// declaration.
340
///
341
/// CanonicalDeclPtr<decl_type> behaves just like decl_type*, except we call
342
/// decl_type::getCanonicalDecl() on construction.
343
///
344
/// This is useful for hashtables that you want to be keyed on a declaration's
345
/// canonical decl -- if you use CanonicalDeclPtr as the key, you don't need to
346
/// remember to call getCanonicalDecl() everywhere.
347
template <typename decl_type> class CanonicalDeclPtr {
348
public:
349
33.7k
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::CanonicalDeclPtr()
Line
Count
Source
349
750
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::FunctionDecl>::CanonicalDeclPtr()
Line
Count
Source
349
33.0k
  CanonicalDeclPtr() = default;
350
  CanonicalDeclPtr(decl_type *Ptr)
351
19.0k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::CanonicalDeclPtr(clang::CXXRecordDecl const*)
Line
Count
Source
351
137
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::FunctionDecl>::CanonicalDeclPtr(clang::FunctionDecl*)
Line
Count
Source
351
18.9k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
352
  CanonicalDeclPtr(const CanonicalDeclPtr &) = default;
353
  CanonicalDeclPtr &operator=(const CanonicalDeclPtr &) = default;
354
355
291
  operator decl_type *() { return Ptr; }
356
273k
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::operator clang::CXXRecordDecl const*() const
Line
Count
Source
356
15.8k
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::FunctionDecl>::operator clang::FunctionDecl const*() const
Line
Count
Source
356
257k
  operator const decl_type *() const { return Ptr; }
357
358
  decl_type *operator->() { return Ptr; }
359
  const decl_type *operator->() const { return Ptr; }
360
361
  decl_type &operator*() { return *Ptr; }
362
  const decl_type &operator*() const { return *Ptr; }
363
364
private:
365
  friend struct llvm::DenseMapInfo<CanonicalDeclPtr<decl_type>>;
366
367
  decl_type *Ptr = nullptr;
368
};
369
370
} // namespace clang
371
372
namespace llvm {
373
374
template <typename decl_type>
375
struct DenseMapInfo<clang::CanonicalDeclPtr<decl_type>> {
376
  using CanonicalDeclPtr = clang::CanonicalDeclPtr<decl_type>;
377
  using BaseInfo = DenseMapInfo<decl_type *>;
378
379
18.8k
  static CanonicalDeclPtr getEmptyKey() {
380
18.8k
    // Construct our CanonicalDeclPtr this way because the regular constructor
381
18.8k
    // would dereference P.Ptr, which is not allowed.
382
18.8k
    CanonicalDeclPtr P;
383
18.8k
    P.Ptr = BaseInfo::getEmptyKey();
384
18.8k
    return P;
385
18.8k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::getEmptyKey()
Line
Count
Source
379
499
  static CanonicalDeclPtr getEmptyKey() {
380
499
    // Construct our CanonicalDeclPtr this way because the regular constructor
381
499
    // would dereference P.Ptr, which is not allowed.
382
499
    CanonicalDeclPtr P;
383
499
    P.Ptr = BaseInfo::getEmptyKey();
384
499
    return P;
385
499
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::getEmptyKey()
Line
Count
Source
379
18.3k
  static CanonicalDeclPtr getEmptyKey() {
380
18.3k
    // Construct our CanonicalDeclPtr this way because the regular constructor
381
18.3k
    // would dereference P.Ptr, which is not allowed.
382
18.3k
    CanonicalDeclPtr P;
383
18.3k
    P.Ptr = BaseInfo::getEmptyKey();
384
18.3k
    return P;
385
18.3k
  }
386
387
13.1k
  static CanonicalDeclPtr getTombstoneKey() {
388
13.1k
    CanonicalDeclPtr P;
389
13.1k
    P.Ptr = BaseInfo::getTombstoneKey();
390
13.1k
    return P;
391
13.1k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::getTombstoneKey()
Line
Count
Source
387
251
  static CanonicalDeclPtr getTombstoneKey() {
388
251
    CanonicalDeclPtr P;
389
251
    P.Ptr = BaseInfo::getTombstoneKey();
390
251
    return P;
391
251
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::getTombstoneKey()
Line
Count
Source
387
12.8k
  static CanonicalDeclPtr getTombstoneKey() {
388
12.8k
    CanonicalDeclPtr P;
389
12.8k
    P.Ptr = BaseInfo::getTombstoneKey();
390
12.8k
    return P;
391
12.8k
  }
392
393
11.4k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
394
11.4k
    return BaseInfo::getHashValue(P);
395
11.4k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::getHashValue(clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&)
Line
Count
Source
393
137
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
394
137
    return BaseInfo::getHashValue(P);
395
137
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::getHashValue(clang::CanonicalDeclPtr<clang::FunctionDecl> const&)
Line
Count
Source
393
11.3k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
394
11.3k
    return BaseInfo::getHashValue(P);
395
11.3k
  }
396
397
  static bool isEqual(const CanonicalDeclPtr &LHS,
398
128k
                      const CanonicalDeclPtr &RHS) {
399
128k
    return BaseInfo::isEqual(LHS, RHS);
400
128k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::isEqual(clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&, clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&)
Line
Count
Source
398
7.83k
                      const CanonicalDeclPtr &RHS) {
399
7.83k
    return BaseInfo::isEqual(LHS, RHS);
400
7.83k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::isEqual(clang::CanonicalDeclPtr<clang::FunctionDecl> const&, clang::CanonicalDeclPtr<clang::FunctionDecl> const&)
Line
Count
Source
398
120k
                      const CanonicalDeclPtr &RHS) {
399
120k
    return BaseInfo::isEqual(LHS, RHS);
400
120k
  }
401
};
402
403
} // namespace llvm
404
405
#endif // LLVM_CLANG_AST_REDECLARABLE_H