Coverage Report

Created: 2019-07-24 05:18

/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
37.6M
        : 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.62M
        : 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
19.5M
        : 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
9.16M
        : 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.72M
        : 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
275
        : 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
122k
        : 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
165k
        : 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.7k
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
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.25M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
113
2.00M
    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
9.50k
    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.16M
    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
554k
    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
92.8k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::NamespaceDecl>::DeclLink::PreviousTag, clang::NamespaceDecl*)
Line
Count
Source
113
77.5k
    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
4.07k
    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
93.7k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
114
115
486M
    bool isFirst() const {
116
486M
      return Link.is<KnownLatest>() ||
117
486M
             // FIXME: 'template' is required on the next line due to an
118
486M
             // apparent clang bug.
119
486M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()304M
;
120
486M
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::isFirst() const
Line
Count
Source
115
27.7M
    bool isFirst() const {
116
27.7M
      return Link.is<KnownLatest>() ||
117
27.7M
             // FIXME: 'template' is required on the next line due to an
118
27.7M
             // apparent clang bug.
119
27.7M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()8.12M
;
120
27.7M
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::isFirst() const
Line
Count
Source
115
27.6M
    bool isFirst() const {
116
27.6M
      return Link.is<KnownLatest>() ||
117
27.6M
             // FIXME: 'template' is required on the next line due to an
118
27.6M
             // apparent clang bug.
119
27.6M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()8.80M
;
120
27.6M
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::isFirst() const
Line
Count
Source
115
935k
    bool isFirst() const {
116
935k
      return Link.is<KnownLatest>() ||
117
935k
             // FIXME: 'template' is required on the next line due to an
118
935k
             // apparent clang bug.
119
935k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()360k
;
120
935k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::isFirst() const
Line
Count
Source
115
27.0M
    bool isFirst() const {
116
27.0M
      return Link.is<KnownLatest>() ||
117
27.0M
             // FIXME: 'template' is required on the next line due to an
118
27.0M
             // apparent clang bug.
119
27.0M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()3.23M
;
120
27.0M
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::isFirst() const
Line
Count
Source
115
1.06k
    bool isFirst() const {
116
1.06k
      return Link.is<KnownLatest>() ||
117
1.06k
             // FIXME: 'template' is required on the next line due to an
118
1.06k
             // apparent clang bug.
119
1.06k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()374
;
120
1.06k
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::isFirst() const
Line
Count
Source
115
18.8k
    bool isFirst() const {
116
18.8k
      return Link.is<KnownLatest>() ||
117
18.8k
             // FIXME: 'template' is required on the next line due to an
118
18.8k
             // apparent clang bug.
119
18.8k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()3.70k
;
120
18.8k
    }
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::RedeclarableTemplateDecl>::DeclLink::isFirst() const
Line
Count
Source
115
1.98M
    bool isFirst() const {
116
1.98M
      return Link.is<KnownLatest>() ||
117
1.98M
             // FIXME: 'template' is required on the next line due to an
118
1.98M
             // apparent clang bug.
119
1.98M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()1.49M
;
120
1.98M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::isFirst() const
Line
Count
Source
115
400M
    bool isFirst() const {
116
400M
      return Link.is<KnownLatest>() ||
117
400M
             // FIXME: 'template' is required on the next line due to an
118
400M
             // apparent clang bug.
119
400M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()282M
;
120
400M
    }
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
    }
121
122
511M
    decl_type *getPrevious(const decl_type *D) const {
123
511M
      if (Link.is<NotKnownLatest>()) {
124
28.6M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
28.6M
        if (NKL.is<Previous>())
126
9.07M
          return static_cast<decl_type*>(NKL.get<Previous>());
127
19.5M
128
19.5M
        // Allocate the generational 'most recent' cache now, if needed.
129
19.5M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
19.5M
                               NKL.get<UninitializedLatest>()),
131
19.5M
                           const_cast<decl_type *>(D));
132
19.5M
      }
133
511M
134
511M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))502M
;
135
511M
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::getPrevious(clang::VarDecl const*) const
Line
Count
Source
122
75.9M
    decl_type *getPrevious(const decl_type *D) const {
123
75.9M
      if (Link.is<NotKnownLatest>()) {
124
15.3M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
15.3M
        if (NKL.is<Previous>())
126
3.98M
          return static_cast<decl_type*>(NKL.get<Previous>());
127
11.3M
128
11.3M
        // Allocate the generational 'most recent' cache now, if needed.
129
11.3M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
11.3M
                               NKL.get<UninitializedLatest>()),
131
11.3M
                           const_cast<decl_type *>(D));
132
11.3M
      }
133
75.9M
134
75.9M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))72.0M
;
135
75.9M
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::getPrevious(clang::FunctionDecl const*) const
Line
Count
Source
122
48.4M
    decl_type *getPrevious(const decl_type *D) const {
123
48.4M
      if (Link.is<NotKnownLatest>()) {
124
8.41M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
8.41M
        if (NKL.is<Previous>())
126
1.16M
          return static_cast<decl_type*>(NKL.get<Previous>());
127
7.25M
128
7.25M
        // Allocate the generational 'most recent' cache now, if needed.
129
7.25M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
7.25M
                               NKL.get<UninitializedLatest>()),
131
7.25M
                           const_cast<decl_type *>(D));
132
7.25M
      }
133
48.4M
134
48.4M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))47.3M
;
135
48.4M
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::getPrevious(clang::TypedefNameDecl const*) const
Line
Count
Source
122
1.03M
    decl_type *getPrevious(const decl_type *D) const {
123
1.03M
      if (Link.is<NotKnownLatest>()) {
124
342k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
342k
        if (NKL.is<Previous>())
126
9.62k
          return static_cast<decl_type*>(NKL.get<Previous>());
127
332k
128
332k
        // Allocate the generational 'most recent' cache now, if needed.
129
332k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
332k
                               NKL.get<UninitializedLatest>()),
131
332k
                           const_cast<decl_type *>(D));
132
332k
      }
133
1.03M
134
1.03M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))1.02M
;
135
1.03M
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::getPrevious(clang::TagDecl const*) const
Line
Count
Source
122
366M
    decl_type *getPrevious(const decl_type *D) const {
123
366M
      if (Link.is<NotKnownLatest>()) {
124
3.24M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
3.24M
        if (NKL.is<Previous>())
126
3.24M
          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
366M
134
366M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))362M
;
135
366M
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::getPrevious(clang::UsingShadowDecl const*) const
Line
Count
Source
122
501k
    decl_type *getPrevious(const decl_type *D) const {
123
501k
      if (Link.is<NotKnownLatest>()) {
124
7.09k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
7.09k
        if (NKL.is<Previous>())
126
7.08k
          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
501k
134
501k
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))494k
;
135
501k
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::getPrevious(clang::ObjCInterfaceDecl const*) const
Line
Count
Source
122
32.7k
    decl_type *getPrevious(const decl_type *D) const {
123
32.7k
      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.7k
134
32.7k
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))28.9k
;
135
32.7k
    }
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::RedeclarableTemplateDecl>::DeclLink::getPrevious(clang::RedeclarableTemplateDecl const*) const
Line
Count
Source
122
18.4M
    decl_type *getPrevious(const decl_type *D) const {
123
18.4M
      if (Link.is<NotKnownLatest>()) {
124
909k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
909k
        if (NKL.is<Previous>())
126
260k
          return static_cast<decl_type*>(NKL.get<Previous>());
127
649k
128
649k
        // Allocate the generational 'most recent' cache now, if needed.
129
649k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
649k
                               NKL.get<UninitializedLatest>()),
131
649k
                           const_cast<decl_type *>(D));
132
649k
      }
133
18.4M
134
18.4M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))18.1M
;
135
18.4M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::getPrevious(clang::NamespaceDecl const*) const
Line
Count
Source
122
664k
    decl_type *getPrevious(const decl_type *D) const {
123
664k
      if (Link.is<NotKnownLatest>()) {
124
399k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
399k
        if (NKL.is<Previous>())
126
399k
          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
664k
134
664k
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))265k
;
135
664k
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::getPrevious(clang::NamespaceAliasDecl const*) const
Line
Count
Source
122
215
    decl_type *getPrevious(const decl_type *D) const {
123
215
      if (Link.is<NotKnownLatest>()) {
124
67
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
67
        if (NKL.is<Previous>())
126
1
          return static_cast<decl_type*>(NKL.get<Previous>());
127
66
128
66
        // Allocate the generational 'most recent' cache now, if needed.
129
66
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
66
                               NKL.get<UninitializedLatest>()),
131
66
                           const_cast<decl_type *>(D));
132
66
      }
133
215
134
215
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))214
;
135
215
    }
136
137
11.1k
    void setPrevious(decl_type *D) {
138
11.1k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
11.1k
      Link = Previous(D);
140
11.1k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::setPrevious(clang::VarDecl*)
Line
Count
Source
137
1.10k
    void setPrevious(decl_type *D) {
138
1.10k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
1.10k
      Link = Previous(D);
140
1.10k
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::setPrevious(clang::FunctionDecl*)
Line
Count
Source
137
1.79k
    void setPrevious(decl_type *D) {
138
1.79k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
1.79k
      Link = Previous(D);
140
1.79k
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::setPrevious(clang::NamespaceDecl*)
Line
Count
Source
137
383
    void setPrevious(decl_type *D) {
138
383
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
383
      Link = Previous(D);
140
383
    }
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
112
    void setPrevious(decl_type *D) {
138
112
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
112
      Link = Previous(D);
140
112
    }
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.42k
    void setPrevious(decl_type *D) {
138
1.42k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
1.42k
      Link = Previous(D);
140
1.42k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::setPrevious(clang::TagDecl*)
Line
Count
Source
137
4.03k
    void setPrevious(decl_type *D) {
138
4.03k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
4.03k
      Link = Previous(D);
140
4.03k
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::setPrevious(clang::TypedefNameDecl*)
Line
Count
Source
137
2.26k
    void setPrevious(decl_type *D) {
138
2.26k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
2.26k
      Link = Previous(D);
140
2.26k
    }
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
6.27M
    void setLatest(decl_type *D) {
143
6.27M
      assert(isFirst() && "decl became canonical unexpectedly");
144
6.27M
      if (Link.is<NotKnownLatest>()) {
145
4.25M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
4.25M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
4.25M
                               NKL.get<UninitializedLatest>()),
148
4.25M
                           D);
149
4.25M
      } else {
150
2.02M
        auto Latest = Link.get<KnownLatest>();
151
2.02M
        Latest.set(D);
152
2.02M
        Link = Latest;
153
2.02M
      }
154
6.27M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::setLatest(clang::NamespaceDecl*)
Line
Count
Source
142
123k
    void setLatest(decl_type *D) {
143
123k
      assert(isFirst() && "decl became canonical unexpectedly");
144
123k
      if (Link.is<NotKnownLatest>()) {
145
45.5k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
45.5k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
45.5k
                               NKL.get<UninitializedLatest>()),
148
45.5k
                           D);
149
78.0k
      } else {
150
78.0k
        auto Latest = Link.get<KnownLatest>();
151
78.0k
        Latest.set(D);
152
78.0k
        Link = Latest;
153
78.0k
      }
154
123k
    }
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
31.1k
    void setLatest(decl_type *D) {
143
31.1k
      assert(isFirst() && "decl became canonical unexpectedly");
144
31.1k
      if (Link.is<NotKnownLatest>()) {
145
23.9k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
23.9k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
23.9k
                               NKL.get<UninitializedLatest>()),
148
23.9k
                           D);
149
23.9k
      } else {
150
7.15k
        auto Latest = Link.get<KnownLatest>();
151
7.15k
        Latest.set(D);
152
7.15k
        Link = Latest;
153
7.15k
      }
154
31.1k
    }
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
384k
    void setLatest(decl_type *D) {
143
384k
      assert(isFirst() && "decl became canonical unexpectedly");
144
384k
      if (Link.is<NotKnownLatest>()) {
145
291k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
291k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
291k
                               NKL.get<UninitializedLatest>()),
148
291k
                           D);
149
291k
      } else {
150
93.5k
        auto Latest = Link.get<KnownLatest>();
151
93.5k
        Latest.set(D);
152
93.5k
        Link = Latest;
153
93.5k
      }
154
384k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::setLatest(clang::TagDecl*)
Line
Count
Source
142
4.75M
    void setLatest(decl_type *D) {
143
4.75M
      assert(isFirst() && "decl became canonical unexpectedly");
144
4.75M
      if (Link.is<NotKnownLatest>()) {
145
3.56M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
3.56M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
3.56M
                               NKL.get<UninitializedLatest>()),
148
3.56M
                           D);
149
3.56M
      } else {
150
1.19M
        auto Latest = Link.get<KnownLatest>();
151
1.19M
        Latest.set(D);
152
1.19M
        Link = Latest;
153
1.19M
      }
154
4.75M
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::setLatest(clang::TypedefNameDecl*)
Line
Count
Source
142
12.9k
    void setLatest(decl_type *D) {
143
12.9k
      assert(isFirst() && "decl became canonical unexpectedly");
144
12.9k
      if (Link.is<NotKnownLatest>()) {
145
5.65k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
5.65k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
5.65k
                               NKL.get<UninitializedLatest>()),
148
5.65k
                           D);
149
7.32k
      } else {
150
7.32k
        auto Latest = Link.get<KnownLatest>();
151
7.32k
        Latest.set(D);
152
7.32k
        Link = Latest;
153
7.32k
      }
154
12.9k
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::setLatest(clang::UsingShadowDecl*)
Line
Count
Source
142
165k
    void setLatest(decl_type *D) {
143
165k
      assert(isFirst() && "decl became canonical unexpectedly");
144
165k
      if (Link.is<NotKnownLatest>()) {
145
161k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
161k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
161k
                               NKL.get<UninitializedLatest>()),
148
161k
                           D);
149
161k
      } else {
150
4.06k
        auto Latest = Link.get<KnownLatest>();
151
4.06k
        Latest.set(D);
152
4.06k
        Link = Latest;
153
4.06k
      }
154
165k
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::setLatest(clang::FunctionDecl*)
Line
Count
Source
142
575k
    void setLatest(decl_type *D) {
143
575k
      assert(isFirst() && "decl became canonical unexpectedly");
144
575k
      if (Link.is<NotKnownLatest>()) {
145
21.5k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
21.5k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
21.5k
                               NKL.get<UninitializedLatest>()),
148
21.5k
                           D);
149
553k
      } else {
150
553k
        auto Latest = Link.get<KnownLatest>();
151
553k
        Latest.set(D);
152
553k
        Link = Latest;
153
553k
      }
154
575k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::setLatest(clang::VarDecl*)
Line
Count
Source
142
228k
    void setLatest(decl_type *D) {
143
228k
      assert(isFirst() && "decl became canonical unexpectedly");
144
228k
      if (Link.is<NotKnownLatest>()) {
145
135k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
135k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
135k
                               NKL.get<UninitializedLatest>()),
148
135k
                           D);
149
135k
      } else {
150
92.5k
        auto Latest = Link.get<KnownLatest>();
151
92.5k
        Latest.set(D);
152
92.5k
        Link = Latest;
153
92.5k
      }
154
228k
    }
155
156
5.69k
    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.15k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
4
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
Unexecuted instantiation: clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::markIncomplete()
clang::Redeclarable<clang::FunctionDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
1.38k
    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.4k
    Decl *getLatestNotUpdated() const {
159
10.4k
      assert(isFirst() && "expected a canonical decl");
160
10.4k
      if (Link.is<NotKnownLatest>())
161
132
        return nullptr;
162
10.3k
      return Link.get<KnownLatest>().getNotUpdated();
163
10.3k
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
263
    Decl *getLatestNotUpdated() const {
159
263
      assert(isFirst() && "expected a canonical decl");
160
263
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
263
      return Link.get<KnownLatest>().getNotUpdated();
163
263
    }
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
359
    Decl *getLatestNotUpdated() const {
159
359
      assert(isFirst() && "expected a canonical decl");
160
359
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
359
      return Link.get<KnownLatest>().getNotUpdated();
163
359
    }
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
5.10k
    Decl *getLatestNotUpdated() const {
159
5.10k
      assert(isFirst() && "expected a canonical decl");
160
5.10k
      if (Link.is<NotKnownLatest>())
161
7
        return nullptr;
162
5.09k
      return Link.get<KnownLatest>().getNotUpdated();
163
5.09k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
2.38k
    Decl *getLatestNotUpdated() const {
159
2.38k
      assert(isFirst() && "expected a canonical decl");
160
2.38k
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
2.38k
      return Link.get<KnownLatest>().getNotUpdated();
163
2.38k
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
164
    Decl *getLatestNotUpdated() const {
159
164
      assert(isFirst() && "expected a canonical decl");
160
164
      if (Link.is<NotKnownLatest>())
161
73
        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.23k
    Decl *getLatestNotUpdated() const {
159
1.23k
      assert(isFirst() && "expected a canonical decl");
160
1.23k
      if (Link.is<NotKnownLatest>())
161
52
        return nullptr;
162
1.18k
      return Link.get<KnownLatest>().getNotUpdated();
163
1.18k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
855
    Decl *getLatestNotUpdated() const {
159
855
      assert(isFirst() && "expected a canonical decl");
160
855
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
855
      return Link.get<KnownLatest>().getNotUpdated();
163
855
    }
164
  };
165
166
2.00M
  static DeclLink PreviousDeclLink(decl_type *D) {
167
2.00M
    return DeclLink(DeclLink::PreviousLink, D);
168
2.00M
  }
clang::Redeclarable<clang::TypedefNameDecl>::PreviousDeclLink(clang::TypedefNameDecl*)
Line
Count
Source
166
9.50k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
9.50k
    return DeclLink(DeclLink::PreviousLink, D);
168
9.50k
  }
clang::Redeclarable<clang::TagDecl>::PreviousDeclLink(clang::TagDecl*)
Line
Count
Source
166
1.16M
  static DeclLink PreviousDeclLink(decl_type *D) {
167
1.16M
    return DeclLink(DeclLink::PreviousLink, D);
168
1.16M
  }
clang::Redeclarable<clang::FunctionDecl>::PreviousDeclLink(clang::FunctionDecl*)
Line
Count
Source
166
554k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
554k
    return DeclLink(DeclLink::PreviousLink, D);
168
554k
  }
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
92.8k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
92.8k
    return DeclLink(DeclLink::PreviousLink, D);
168
92.8k
  }
clang::Redeclarable<clang::NamespaceDecl>::PreviousDeclLink(clang::NamespaceDecl*)
Line
Count
Source
166
77.5k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
77.5k
    return DeclLink(DeclLink::PreviousLink, D);
168
77.5k
  }
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
4.07k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
4.07k
    return DeclLink(DeclLink::PreviousLink, D);
168
4.07k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::PreviousDeclLink(clang::RedeclarableTemplateDecl*)
Line
Count
Source
166
93.7k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
93.7k
    return DeclLink(DeclLink::PreviousLink, D);
168
93.7k
  }
169
170
37.6M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
37.6M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
37.6M
  }
clang::Redeclarable<clang::TypedefNameDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
2.62M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
2.62M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
2.62M
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
275
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
275
    return DeclLink(DeclLink::LatestLink, Ctx);
172
275
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
1.25M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
1.25M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
1.25M
  }
clang::Redeclarable<clang::VarDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
19.5M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
19.5M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
19.5M
  }
clang::Redeclarable<clang::FunctionDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
9.16M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
9.16M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
9.16M
  }
clang::Redeclarable<clang::TagDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
4.72M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
4.72M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
4.72M
  }
clang::Redeclarable<clang::NamespaceDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
122k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
122k
    return DeclLink(DeclLink::LatestLink, Ctx);
172
122k
  }
clang::Redeclarable<clang::UsingShadowDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
165k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
165k
    return DeclLink(DeclLink::LatestLink, Ctx);
172
165k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
30.7k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
30.7k
    return DeclLink(DeclLink::LatestLink, Ctx);
172
30.7k
  }
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
  }
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
511M
  decl_type *getNextRedeclaration() const {
190
511M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
511M
  }
clang::Redeclarable<clang::VarDecl>::getNextRedeclaration() const
Line
Count
Source
189
75.9M
  decl_type *getNextRedeclaration() const {
190
75.9M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
75.9M
  }
clang::Redeclarable<clang::FunctionDecl>::getNextRedeclaration() const
Line
Count
Source
189
48.4M
  decl_type *getNextRedeclaration() const {
190
48.4M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
48.4M
  }
clang::Redeclarable<clang::TypedefNameDecl>::getNextRedeclaration() const
Line
Count
Source
189
1.03M
  decl_type *getNextRedeclaration() const {
190
1.03M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
1.03M
  }
clang::Redeclarable<clang::TagDecl>::getNextRedeclaration() const
Line
Count
Source
189
366M
  decl_type *getNextRedeclaration() const {
190
366M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
366M
  }
clang::Redeclarable<clang::UsingShadowDecl>::getNextRedeclaration() const
Line
Count
Source
189
501k
  decl_type *getNextRedeclaration() const {
190
501k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
501k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getNextRedeclaration() const
Line
Count
Source
189
32.7k
  decl_type *getNextRedeclaration() const {
190
32.7k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
32.7k
  }
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::RedeclarableTemplateDecl>::getNextRedeclaration() const
Line
Count
Source
189
18.4M
  decl_type *getNextRedeclaration() const {
190
18.4M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
18.4M
  }
clang::Redeclarable<clang::NamespaceDecl>::getNextRedeclaration() const
Line
Count
Source
189
664k
  decl_type *getNextRedeclaration() const {
190
664k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
664k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getNextRedeclaration() const
Line
Count
Source
189
215
  decl_type *getNextRedeclaration() const {
190
215
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
215
  }
192
193
public:
194
  friend class ASTDeclReader;
195
  friend class ASTDeclWriter;
196
197
  Redeclarable(const ASTContext &Ctx)
198
      : RedeclLink(LatestDeclLink(Ctx)),
199
37.6M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::TypedefNameDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
2.62M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::VarDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
19.5M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::FunctionDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
9.16M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::TagDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
4.72M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::NamespaceAliasDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
275
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::NamespaceDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
122k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::UsingShadowDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
165k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
30.7k
        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.25M
        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
14.4M
  decl_type *getPreviousDecl() {
204
14.4M
    if (!RedeclLink.isFirst())
205
2.55M
      return getNextRedeclaration();
206
11.9M
    return nullptr;
207
11.9M
  }
clang::Redeclarable<clang::VarDecl>::getPreviousDecl()
Line
Count
Source
203
513k
  decl_type *getPreviousDecl() {
204
513k
    if (!RedeclLink.isFirst())
205
30.0k
      return getNextRedeclaration();
206
483k
    return nullptr;
207
483k
  }
clang::Redeclarable<clang::FunctionDecl>::getPreviousDecl()
Line
Count
Source
203
5.92M
  decl_type *getPreviousDecl() {
204
5.92M
    if (!RedeclLink.isFirst())
205
348k
      return getNextRedeclaration();
206
5.57M
    return nullptr;
207
5.57M
  }
clang::Redeclarable<clang::TypedefNameDecl>::getPreviousDecl()
Line
Count
Source
203
928k
  decl_type *getPreviousDecl() {
204
928k
    if (!RedeclLink.isFirst())
205
8.81k
      return getNextRedeclaration();
206
919k
    return nullptr;
207
919k
  }
clang::Redeclarable<clang::TagDecl>::getPreviousDecl()
Line
Count
Source
203
5.61M
  decl_type *getPreviousDecl() {
204
5.61M
    if (!RedeclLink.isFirst())
205
1.99M
      return getNextRedeclaration();
206
3.62M
    return nullptr;
207
3.62M
  }
clang::Redeclarable<clang::UsingShadowDecl>::getPreviousDecl()
Line
Count
Source
203
142
  decl_type *getPreviousDecl() {
204
142
    if (!RedeclLink.isFirst())
205
33
      return getNextRedeclaration();
206
109
    return nullptr;
207
109
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getPreviousDecl()
Line
Count
Source
203
3.13k
  decl_type *getPreviousDecl() {
204
3.13k
    if (!RedeclLink.isFirst())
205
1.37k
      return getNextRedeclaration();
206
1.76k
    return nullptr;
207
1.76k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getPreviousDecl()
Line
Count
Source
203
318
  decl_type *getPreviousDecl() {
204
318
    if (!RedeclLink.isFirst())
205
171
      return getNextRedeclaration();
206
147
    return nullptr;
207
147
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getPreviousDecl()
Line
Count
Source
203
1.44M
  decl_type *getPreviousDecl() {
204
1.44M
    if (!RedeclLink.isFirst())
205
171k
      return getNextRedeclaration();
206
1.27M
    return nullptr;
207
1.27M
  }
clang::Redeclarable<clang::NamespaceDecl>::getPreviousDecl()
Line
Count
Source
203
34.0k
  decl_type *getPreviousDecl() {
204
34.0k
    if (!RedeclLink.isFirst())
205
5.25k
      return getNextRedeclaration();
206
28.7k
    return nullptr;
207
28.7k
  }
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.58M
  const decl_type *getPreviousDecl() const {
209
2.58M
    return const_cast<decl_type *>(
210
2.58M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
2.58M
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getPreviousDecl() const
Line
Count
Source
208
731k
  const decl_type *getPreviousDecl() const {
209
731k
    return const_cast<decl_type *>(
210
731k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
731k
  }
clang::Redeclarable<clang::FunctionDecl>::getPreviousDecl() const
Line
Count
Source
208
1.37M
  const decl_type *getPreviousDecl() const {
209
1.37M
    return const_cast<decl_type *>(
210
1.37M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
1.37M
  }
clang::Redeclarable<clang::TagDecl>::getPreviousDecl() const
Line
Count
Source
208
4.19k
  const decl_type *getPreviousDecl() const {
209
4.19k
    return const_cast<decl_type *>(
210
4.19k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
4.19k
  }
clang::Redeclarable<clang::VarDecl>::getPreviousDecl() const
Line
Count
Source
208
474k
  const decl_type *getPreviousDecl() const {
209
474k
    return const_cast<decl_type *>(
210
474k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
474k
  }
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
102
  const decl_type *getPreviousDecl() const {
209
102
    return const_cast<decl_type *>(
210
102
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
102
  }
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
22
  const decl_type *getPreviousDecl() const {
209
22
    return const_cast<decl_type *>(
210
22
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
22
  }
clang::Redeclarable<clang::TypedefNameDecl>::getPreviousDecl() const
Line
Count
Source
208
1.09k
  const decl_type *getPreviousDecl() const {
209
1.09k
    return const_cast<decl_type *>(
210
1.09k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
1.09k
  }
clang::Redeclarable<clang::UsingShadowDecl>::getPreviousDecl() const
Line
Count
Source
208
26
  const decl_type *getPreviousDecl() const {
209
26
    return const_cast<decl_type *>(
210
26
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
26
  }
212
213
  /// Return the first declaration of this declaration or itself if this
214
  /// is the only declaration.
215
888M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::VarDecl>::getFirstDecl()
Line
Count
Source
215
124M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::FunctionDecl>::getFirstDecl()
Line
Count
Source
215
281M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::TypedefNameDecl>::getFirstDecl()
Line
Count
Source
215
11.7M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::TagDecl>::getFirstDecl()
Line
Count
Source
215
385M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::NamespaceAliasDecl>::getFirstDecl()
Line
Count
Source
215
425
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::UsingShadowDecl>::getFirstDecl()
Line
Count
Source
215
1.42M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getFirstDecl()
Line
Count
Source
215
177k
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::ObjCProtocolDecl>::getFirstDecl()
Line
Count
Source
215
14.7k
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getFirstDecl()
Line
Count
Source
215
83.7M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::NamespaceDecl>::getFirstDecl()
Line
Count
Source
215
240k
  decl_type *getFirstDecl() { return First; }
216
217
  /// Return the first declaration of this declaration or itself if this
218
  /// is the only declaration.
219
46.3M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::TypedefNameDecl>::getFirstDecl() const
Line
Count
Source
219
103
  const decl_type *getFirstDecl() const { return First; }
Unexecuted instantiation: clang::Redeclarable<clang::NamespaceAliasDecl>::getFirstDecl() const
Unexecuted instantiation: clang::Redeclarable<clang::UsingShadowDecl>::getFirstDecl() const
clang::Redeclarable<clang::ObjCInterfaceDecl>::getFirstDecl() const
Line
Count
Source
219
3.40k
  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::RedeclarableTemplateDecl>::getFirstDecl() const
Line
Count
Source
219
6.66M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::TagDecl>::getFirstDecl() const
Line
Count
Source
219
242k
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::VarDecl>::getFirstDecl() const
Line
Count
Source
219
17.6M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::FunctionDecl>::getFirstDecl() const
Line
Count
Source
219
21.8M
  const decl_type *getFirstDecl() const { return First; }
220
221
  /// True if this is the first declaration in its redeclaration chain.
222
471M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::FunctionDecl>::isFirstDecl() const
Line
Count
Source
222
21.7M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::TagDecl>::isFirstDecl() const
Line
Count
Source
222
21.4M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::VarDecl>::isFirstDecl() const
Line
Count
Source
222
27.2M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::TypedefNameDecl>::isFirstDecl() const
Line
Count
Source
222
7.22k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::ObjCInterfaceDecl>::isFirstDecl() const
Line
Count
Source
222
15.6k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::ObjCProtocolDecl>::isFirstDecl() const
Line
Count
Source
222
3.72k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::NamespaceDecl>::isFirstDecl() const
Line
Count
Source
222
400M
  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
923
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::isFirstDecl() const
Line
Count
Source
222
536k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
223
224
  /// Returns the most recent (re)declaration of this declaration.
225
423M
  decl_type *getMostRecentDecl() {
226
423M
    return getFirstDecl()->getNextRedeclaration();
227
423M
  }
clang::Redeclarable<clang::VarDecl>::getMostRecentDecl()
Line
Count
Source
225
42.0M
  decl_type *getMostRecentDecl() {
226
42.0M
    return getFirstDecl()->getNextRedeclaration();
227
42.0M
  }
clang::Redeclarable<clang::FunctionDecl>::getMostRecentDecl()
Line
Count
Source
225
28.9M
  decl_type *getMostRecentDecl() {
226
28.9M
    return getFirstDecl()->getNextRedeclaration();
227
28.9M
  }
clang::Redeclarable<clang::TypedefNameDecl>::getMostRecentDecl()
Line
Count
Source
225
691k
  decl_type *getMostRecentDecl() {
226
691k
    return getFirstDecl()->getNextRedeclaration();
227
691k
  }
clang::Redeclarable<clang::TagDecl>::getMostRecentDecl()
Line
Count
Source
225
340M
  decl_type *getMostRecentDecl() {
226
340M
    return getFirstDecl()->getNextRedeclaration();
227
340M
  }
clang::Redeclarable<clang::UsingShadowDecl>::getMostRecentDecl()
Line
Count
Source
225
326k
  decl_type *getMostRecentDecl() {
226
326k
    return getFirstDecl()->getNextRedeclaration();
227
326k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getMostRecentDecl()
Line
Count
Source
225
4.83k
  decl_type *getMostRecentDecl() {
226
4.83k
    return getFirstDecl()->getNextRedeclaration();
227
4.83k
  }
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
10.1M
  decl_type *getMostRecentDecl() {
226
10.1M
    return getFirstDecl()->getNextRedeclaration();
227
10.1M
  }
clang::Redeclarable<clang::NamespaceDecl>::getMostRecentDecl()
Line
Count
Source
225
161k
  decl_type *getMostRecentDecl() {
226
161k
    return getFirstDecl()->getNextRedeclaration();
227
161k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getMostRecentDecl()
Line
Count
Source
225
131
  decl_type *getMostRecentDecl() {
226
131
    return getFirstDecl()->getNextRedeclaration();
227
131
  }
228
229
  /// Returns the most recent (re)declaration of this declaration.
230
7.55M
  const decl_type *getMostRecentDecl() const {
231
7.55M
    return getFirstDecl()->getNextRedeclaration();
232
7.55M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getMostRecentDecl() const
Line
Count
Source
230
3.39k
  const decl_type *getMostRecentDecl() const {
231
3.39k
    return getFirstDecl()->getNextRedeclaration();
232
3.39k
  }
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
895k
  const decl_type *getMostRecentDecl() const {
231
895k
    return getFirstDecl()->getNextRedeclaration();
232
895k
  }
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.65M
  const decl_type *getMostRecentDecl() const {
231
6.65M
    return getFirstDecl()->getNextRedeclaration();
232
6.65M
  }
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
335M
    redecl_iterator() = default;
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
252
28.5M
    redecl_iterator() = default;
clang::Redeclarable<clang::TagDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
252
257M
    redecl_iterator() = default;
clang::Redeclarable<clang::VarDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
252
48.7M
    redecl_iterator() = default;
clang::Redeclarable<clang::RedeclarableTemplateDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
252
475k
    redecl_iterator() = default;
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
252
589
    redecl_iterator() = default;
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
252
13.1k
    redecl_iterator() = default;
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
252
3.34k
    redecl_iterator() = default;
253
335M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::redecl_iterator(clang::FunctionDecl*)
Line
Count
Source
253
28.5M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::TagDecl>::redecl_iterator::redecl_iterator(clang::TagDecl*)
Line
Count
Source
253
257M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::VarDecl>::redecl_iterator::redecl_iterator(clang::VarDecl*)
Line
Count
Source
253
48.7M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::RedeclarableTemplateDecl>::redecl_iterator::redecl_iterator(clang::RedeclarableTemplateDecl*)
Line
Count
Source
253
475k
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::redecl_iterator(clang::UsingShadowDecl*)
Line
Count
Source
253
589
    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.1k
    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
358M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::operator*() const
Line
Count
Source
255
30.4M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::TagDecl>::redecl_iterator::operator*() const
Line
Count
Source
255
270M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::VarDecl>::redecl_iterator::operator*() const
Line
Count
Source
255
56.8M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::redecl_iterator::operator*() const
Line
Count
Source
255
526k
    reference operator*() const { return Current; }
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::operator*() const
Line
Count
Source
255
597
    reference operator*() const { return Current; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::operator*() const
Line
Count
Source
255
15.4k
    reference operator*() const { return Current; }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::operator*() const
Line
Count
Source
255
3.63k
    reference operator*() const { return Current; }
256
    pointer operator->() const { return Current; }
257
258
62.4M
    redecl_iterator& operator++() {
259
62.4M
      assert(Current && "Advancing while iterator has reached end");
260
62.4M
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
62.4M
      if (Current->isFirstDecl()) {
262
56.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
56.3M
        PassedFirst = true;
268
56.3M
      }
269
62.4M
270
62.4M
      // Get either previous decl or latest decl.
271
62.4M
      decl_type *Next = Current->getNextRedeclaration();
272
62.4M
      Current = (Next != Starter) ? 
Next23.0M
:
nullptr39.4M
;
273
62.4M
      return *this;
274
62.4M
    }
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::operator++()
Line
Count
Source
258
15.7M
    redecl_iterator& operator++() {
259
15.7M
      assert(Current && "Advancing while iterator has reached end");
260
15.7M
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
15.7M
      if (Current->isFirstDecl()) {
262
14.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
14.9M
        PassedFirst = true;
268
14.9M
      }
269
15.7M
270
15.7M
      // Get either previous decl or latest decl.
271
15.7M
      decl_type *Next = Current->getNextRedeclaration();
272
15.7M
      Current = (Next != Starter) ? 
Next1.99M
:
nullptr13.7M
;
273
15.7M
      return *this;
274
15.7M
    }
clang::Redeclarable<clang::TagDecl>::redecl_iterator::operator++()
Line
Count
Source
258
21.4M
    redecl_iterator& operator++() {
259
21.4M
      assert(Current && "Advancing while iterator has reached end");
260
21.4M
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
21.4M
      if (Current->isFirstDecl()) {
262
20.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
20.1M
        PassedFirst = true;
268
20.1M
      }
269
21.4M
270
21.4M
      // Get either previous decl or latest decl.
271
21.4M
      decl_type *Next = Current->getNextRedeclaration();
272
21.4M
      Current = (Next != Starter) ? 
Next12.7M
:
nullptr8.63M
;
273
21.4M
      return *this;
274
21.4M
    }
clang::Redeclarable<clang::VarDecl>::redecl_iterator::operator++()
Line
Count
Source
258
24.7M
    redecl_iterator& operator++() {
259
24.7M
      assert(Current && "Advancing while iterator has reached end");
260
24.7M
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
24.7M
      if (Current->isFirstDecl()) {
262
20.7M
        if (PassedFirst) {
263
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
264
0
          Current = nullptr;
265
0
          return *this;
266
0
        }
267
20.7M
        PassedFirst = true;
268
20.7M
      }
269
24.7M
270
24.7M
      // Get either previous decl or latest decl.
271
24.7M
      decl_type *Next = Current->getNextRedeclaration();
272
24.7M
      Current = (Next != Starter) ? 
Next8.16M
:
nullptr16.5M
;
273
24.7M
      return *this;
274
24.7M
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::redecl_iterator::operator++()
Line
Count
Source
258
526k
    redecl_iterator& operator++() {
259
526k
      assert(Current && "Advancing while iterator has reached end");
260
526k
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
526k
      if (Current->isFirstDecl()) {
262
475k
        if (PassedFirst) {
263
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
264
0
          Current = nullptr;
265
0
          return *this;
266
0
        }
267
475k
        PassedFirst = true;
268
475k
      }
269
526k
270
526k
      // Get either previous decl or latest decl.
271
526k
      decl_type *Next = Current->getNextRedeclaration();
272
526k
      Current = (Next != Starter) ? 
Next50.9k
:
nullptr475k
;
273
526k
      return *this;
274
526k
    }
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::operator++()
Line
Count
Source
258
597
    redecl_iterator& operator++() {
259
597
      assert(Current && "Advancing while iterator has reached end");
260
597
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
597
      if (Current->isFirstDecl()) {
262
589
        if (PassedFirst) {
263
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
264
0
          Current = nullptr;
265
0
          return *this;
266
0
        }
267
589
        PassedFirst = true;
268
589
      }
269
597
270
597
      // Get either previous decl or latest decl.
271
597
      decl_type *Next = Current->getNextRedeclaration();
272
597
      Current = (Next != Starter) ? 
Next8
:
nullptr589
;
273
597
      return *this;
274
597
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::operator++()
Line
Count
Source
258
15.4k
    redecl_iterator& operator++() {
259
15.4k
      assert(Current && "Advancing while iterator has reached end");
260
15.4k
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
15.4k
      if (Current->isFirstDecl()) {
262
13.1k
        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.1k
        PassedFirst = true;
268
13.1k
      }
269
15.4k
270
15.4k
      // Get either previous decl or latest decl.
271
15.4k
      decl_type *Next = Current->getNextRedeclaration();
272
15.4k
      Current = (Next != Starter) ? 
Next2.26k
:
nullptr13.1k
;
273
15.4k
      return *this;
274
15.4k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::operator++()
Line
Count
Source
258
3.63k
    redecl_iterator& operator++() {
259
3.63k
      assert(Current && "Advancing while iterator has reached end");
260
3.63k
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
3.63k
      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.63k
270
3.63k
      // Get either previous decl or latest decl.
271
3.63k
      decl_type *Next = Current->getNextRedeclaration();
272
3.63k
      Current = (Next != Starter) ? 
Next283
:
nullptr3.34k
;
273
3.63k
      return *this;
274
3.63k
    }
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
397M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
286
397M
      return x.Current != y.Current;
287
397M
    }
clang::operator!=(clang::Redeclarable<clang::FunctionDecl>::redecl_iterator, clang::Redeclarable<clang::FunctionDecl>::redecl_iterator)
Line
Count
Source
285
44.2M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
286
44.2M
      return x.Current != y.Current;
287
44.2M
    }
clang::operator!=(clang::Redeclarable<clang::TagDecl>::redecl_iterator, clang::Redeclarable<clang::TagDecl>::redecl_iterator)
Line
Count
Source
285
279M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
286
279M
      return x.Current != y.Current;
287
279M
    }
clang::operator!=(clang::Redeclarable<clang::VarDecl>::redecl_iterator, clang::Redeclarable<clang::VarDecl>::redecl_iterator)
Line
Count
Source
285
73.4M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
286
73.4M
      return x.Current != y.Current;
287
73.4M
    }
clang::operator!=(clang::Redeclarable<clang::RedeclarableTemplateDecl>::redecl_iterator, clang::Redeclarable<clang::RedeclarableTemplateDecl>::redecl_iterator)
Line
Count
Source
285
1.00M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
286
1.00M
      return x.Current != y.Current;
287
1.00M
    }
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.5k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
286
28.5k
      return x.Current != y.Current;
287
28.5k
    }
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
335M
  redecl_range redecls() const {
295
335M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
296
335M
                            static_cast<const decl_type *>(this))),
297
335M
                        redecl_iterator());
298
335M
  }
clang::Redeclarable<clang::FunctionDecl>::redecls() const
Line
Count
Source
294
28.5M
  redecl_range redecls() const {
295
28.5M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
296
28.5M
                            static_cast<const decl_type *>(this))),
297
28.5M
                        redecl_iterator());
298
28.5M
  }
clang::Redeclarable<clang::TagDecl>::redecls() const
Line
Count
Source
294
257M
  redecl_range redecls() const {
295
257M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
296
257M
                            static_cast<const decl_type *>(this))),
297
257M
                        redecl_iterator());
298
257M
  }
clang::Redeclarable<clang::VarDecl>::redecls() const
Line
Count
Source
294
48.7M
  redecl_range redecls() const {
295
48.7M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
296
48.7M
                            static_cast<const decl_type *>(this))),
297
48.7M
                        redecl_iterator());
298
48.7M
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::redecls() const
Line
Count
Source
294
475k
  redecl_range redecls() const {
295
475k
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
296
475k
                            static_cast<const decl_type *>(this))),
297
475k
                        redecl_iterator());
298
475k
  }
clang::Redeclarable<clang::UsingShadowDecl>::redecls() const
Line
Count
Source
294
589
  redecl_range redecls() const {
295
589
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
296
589
                            static_cast<const decl_type *>(this))),
297
589
                        redecl_iterator());
298
589
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecls() const
Line
Count
Source
294
13.1k
  redecl_range redecls() const {
295
13.1k
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
296
13.1k
                            static_cast<const decl_type *>(this))),
297
13.1k
                        redecl_iterator());
298
13.1k
  }
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.33M
  decl_type *getFirstDecl() {
319
6.33M
    auto *D = static_cast<decl_type *>(this);
320
6.33M
    if (!D->isFromASTFile())
321
6.30M
      return D;
322
23.7k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
323
23.7k
  }
clang::Mergeable<clang::FieldDecl>::getFirstDecl()
Line
Count
Source
318
5.42M
  decl_type *getFirstDecl() {
319
5.42M
    auto *D = static_cast<decl_type *>(this);
320
5.42M
    if (!D->isFromASTFile())
321
5.40M
      return D;
322
21.7k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
323
21.7k
  }
clang::Mergeable<clang::EnumConstantDecl>::getFirstDecl()
Line
Count
Source
318
661k
  decl_type *getFirstDecl() {
319
661k
    auto *D = static_cast<decl_type *>(this);
320
661k
    if (!D->isFromASTFile())
321
660k
      return D;
322
1.23k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
323
1.23k
  }
clang::Mergeable<clang::IndirectFieldDecl>::getFirstDecl()
Line
Count
Source
318
22.4k
  decl_type *getFirstDecl() {
319
22.4k
    auto *D = static_cast<decl_type *>(this);
320
22.4k
    if (!D->isFromASTFile())
321
22.3k
      return D;
322
167
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
323
167
  }
clang::Mergeable<clang::UsingDecl>::getFirstDecl()
Line
Count
Source
318
225k
  decl_type *getFirstDecl() {
319
225k
    auto *D = static_cast<decl_type *>(this);
320
225k
    if (!D->isFromASTFile())
321
224k
      return D;
322
450
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
323
450
  }
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::UnresolvedUsingValueDecl>::getFirstDecl()
Line
Count
Source
318
927
  decl_type *getFirstDecl() {
319
927
    auto *D = static_cast<decl_type *>(this);
320
927
    if (!D->isFromASTFile())
321
824
      return D;
322
103
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
323
103
  }
clang::Mergeable<clang::UnresolvedUsingTypenameDecl>::getFirstDecl()
Line
Count
Source
318
374
  decl_type *getFirstDecl() {
319
374
    auto *D = static_cast<decl_type *>(this);
320
374
    if (!D->isFromASTFile())
321
270
      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.79M
  const decl_type *getFirstDecl() const {
328
2.79M
    const auto *D = static_cast<const decl_type *>(this);
329
2.79M
    if (!D->isFromASTFile())
330
2.76M
      return D;
331
24.3k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
332
24.3k
  }
clang::Mergeable<clang::FieldDecl>::getFirstDecl() const
Line
Count
Source
327
2.79M
  const decl_type *getFirstDecl() const {
328
2.79M
    const auto *D = static_cast<const decl_type *>(this);
329
2.79M
    if (!D->isFromASTFile())
330
2.76M
      return D;
331
24.3k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
332
24.3k
  }
clang::Mergeable<clang::EnumConstantDecl>::getFirstDecl() const
Line
Count
Source
327
80
  const decl_type *getFirstDecl() const {
328
80
    const auto *D = static_cast<const decl_type *>(this);
329
80
    if (!D->isFromASTFile())
330
80
      return D;
331
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
332
0
  }
clang::Mergeable<clang::IndirectFieldDecl>::getFirstDecl() const
Line
Count
Source
327
37
  const decl_type *getFirstDecl() const {
328
37
    const auto *D = static_cast<const decl_type *>(this);
329
37
    if (!D->isFromASTFile())
330
37
      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
21
  const decl_type *getFirstDecl() const {
328
21
    const auto *D = static_cast<const decl_type *>(this);
329
21
    if (!D->isFromASTFile())
330
21
      return D;
331
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
332
0
  }
Unexecuted instantiation: clang::Mergeable<clang::UsingPackDecl>::getFirstDecl() const
clang::Mergeable<clang::UnresolvedUsingValueDecl>::getFirstDecl() const
Line
Count
Source
327
1
  const decl_type *getFirstDecl() const {
328
1
    const auto *D = static_cast<const decl_type *>(this);
329
1
    if (!D->isFromASTFile())
330
1
      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
1
  const decl_type *getFirstDecl() const {
328
1
    const auto *D = static_cast<const decl_type *>(this);
329
1
    if (!D->isFromASTFile())
330
1
      return D;
331
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
332
0
  }
Unexecuted instantiation: clang::Mergeable<clang::ConceptDecl>::getFirstDecl() const
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
405k
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::CanonicalDeclPtr()
Line
Count
Source
349
765
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::VarDecl const>::CanonicalDeclPtr()
Line
Count
Source
349
29.8k
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::FunctionDecl>::CanonicalDeclPtr()
Line
Count
Source
349
78.3k
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::Decl>::CanonicalDeclPtr()
Line
Count
Source
349
296k
  CanonicalDeclPtr() = default;
Unexecuted instantiation: clang::CanonicalDeclPtr<clang::VarDecl>::CanonicalDeclPtr()
350
  CanonicalDeclPtr(decl_type *Ptr)
351
160k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::CanonicalDeclPtr(clang::CXXRecordDecl const*)
Line
Count
Source
351
140
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::VarDecl const>::CanonicalDeclPtr(clang::VarDecl const*)
Line
Count
Source
351
9.62k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::FunctionDecl>::CanonicalDeclPtr(clang::FunctionDecl*)
Line
Count
Source
351
33.5k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::VarDecl>::CanonicalDeclPtr(clang::VarDecl*)
Line
Count
Source
351
57.7k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::Decl>::CanonicalDeclPtr(clang::Decl*)
Line
Count
Source
351
59.6k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
352
  CanonicalDeclPtr(const CanonicalDeclPtr &) = default;
353
  CanonicalDeclPtr &operator=(const CanonicalDeclPtr &) = default;
354
355
844
  operator decl_type *() { return Ptr; }
clang::CanonicalDeclPtr<clang::FunctionDecl>::operator clang::FunctionDecl*()
Line
Count
Source
355
297
  operator decl_type *() { return Ptr; }
clang::CanonicalDeclPtr<clang::VarDecl>::operator clang::VarDecl*()
Line
Count
Source
355
547
  operator decl_type *() { return Ptr; }
356
6.81M
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::operator clang::CXXRecordDecl const*() const
Line
Count
Source
356
16.0k
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::VarDecl const>::operator clang::VarDecl const*() const
Line
Count
Source
356
371k
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::FunctionDecl>::operator clang::FunctionDecl const*() const
Line
Count
Source
356
789k
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::Decl>::operator clang::Decl const*() const
Line
Count
Source
356
5.64M
  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
2.33k
  friend bool operator==(CanonicalDeclPtr LHS, CanonicalDeclPtr RHS) {
365
2.33k
    return LHS.Ptr == RHS.Ptr;
366
2.33k
  }
367
  friend bool operator!=(CanonicalDeclPtr LHS, CanonicalDeclPtr RHS) {
368
    return LHS.Ptr != RHS.Ptr;
369
  }
370
371
private:
372
  friend struct llvm::DenseMapInfo<CanonicalDeclPtr<decl_type>>;
373
374
  decl_type *Ptr = nullptr;
375
};
376
377
} // namespace clang
378
379
namespace llvm {
380
381
template <typename decl_type>
382
struct DenseMapInfo<clang::CanonicalDeclPtr<decl_type>> {
383
  using CanonicalDeclPtr = clang::CanonicalDeclPtr<decl_type>;
384
  using BaseInfo = DenseMapInfo<decl_type *>;
385
386
261k
  static CanonicalDeclPtr getEmptyKey() {
387
261k
    // Construct our CanonicalDeclPtr this way because the regular constructor
388
261k
    // would dereference P.Ptr, which is not allowed.
389
261k
    CanonicalDeclPtr P;
390
261k
    P.Ptr = BaseInfo::getEmptyKey();
391
261k
    return P;
392
261k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::getEmptyKey()
Line
Count
Source
386
509
  static CanonicalDeclPtr getEmptyKey() {
387
509
    // Construct our CanonicalDeclPtr this way because the regular constructor
388
509
    // would dereference P.Ptr, which is not allowed.
389
509
    CanonicalDeclPtr P;
390
509
    P.Ptr = BaseInfo::getEmptyKey();
391
509
    return P;
392
509
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::VarDecl const> >::getEmptyKey()
Line
Count
Source
386
18.2k
  static CanonicalDeclPtr getEmptyKey() {
387
18.2k
    // Construct our CanonicalDeclPtr this way because the regular constructor
388
18.2k
    // would dereference P.Ptr, which is not allowed.
389
18.2k
    CanonicalDeclPtr P;
390
18.2k
    P.Ptr = BaseInfo::getEmptyKey();
391
18.2k
    return P;
392
18.2k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::getEmptyKey()
Line
Count
Source
386
45.3k
  static CanonicalDeclPtr getEmptyKey() {
387
45.3k
    // Construct our CanonicalDeclPtr this way because the regular constructor
388
45.3k
    // would dereference P.Ptr, which is not allowed.
389
45.3k
    CanonicalDeclPtr P;
390
45.3k
    P.Ptr = BaseInfo::getEmptyKey();
391
45.3k
    return P;
392
45.3k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl> >::getEmptyKey()
Line
Count
Source
386
197k
  static CanonicalDeclPtr getEmptyKey() {
387
197k
    // Construct our CanonicalDeclPtr this way because the regular constructor
388
197k
    // would dereference P.Ptr, which is not allowed.
389
197k
    CanonicalDeclPtr P;
390
197k
    P.Ptr = BaseInfo::getEmptyKey();
391
197k
    return P;
392
197k
  }
393
394
142k
  static CanonicalDeclPtr getTombstoneKey() {
395
142k
    CanonicalDeclPtr P;
396
142k
    P.Ptr = BaseInfo::getTombstoneKey();
397
142k
    return P;
398
142k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::getTombstoneKey()
Line
Count
Source
394
256
  static CanonicalDeclPtr getTombstoneKey() {
395
256
    CanonicalDeclPtr P;
396
256
    P.Ptr = BaseInfo::getTombstoneKey();
397
256
    return P;
398
256
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::VarDecl const> >::getTombstoneKey()
Line
Count
Source
394
11.5k
  static CanonicalDeclPtr getTombstoneKey() {
395
11.5k
    CanonicalDeclPtr P;
396
11.5k
    P.Ptr = BaseInfo::getTombstoneKey();
397
11.5k
    return P;
398
11.5k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::getTombstoneKey()
Line
Count
Source
394
31.0k
  static CanonicalDeclPtr getTombstoneKey() {
395
31.0k
    CanonicalDeclPtr P;
396
31.0k
    P.Ptr = BaseInfo::getTombstoneKey();
397
31.0k
    return P;
398
31.0k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl> >::getTombstoneKey()
Line
Count
Source
394
99.5k
  static CanonicalDeclPtr getTombstoneKey() {
395
99.5k
    CanonicalDeclPtr P;
396
99.5k
    P.Ptr = BaseInfo::getTombstoneKey();
397
99.5k
    return P;
398
99.5k
  }
399
400
95.3k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
401
95.3k
    return BaseInfo::getHashValue(P);
402
95.3k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::getHashValue(clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&)
Line
Count
Source
400
140
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
401
140
    return BaseInfo::getHashValue(P);
402
140
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::VarDecl const> >::getHashValue(clang::CanonicalDeclPtr<clang::VarDecl const> const&)
Line
Count
Source
400
9.03k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
401
9.03k
    return BaseInfo::getHashValue(P);
402
9.03k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::getHashValue(clang::CanonicalDeclPtr<clang::FunctionDecl> const&)
Line
Count
Source
400
26.5k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
401
26.5k
    return BaseInfo::getHashValue(P);
402
26.5k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl> >::getHashValue(clang::CanonicalDeclPtr<clang::Decl> const&)
Line
Count
Source
400
59.6k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
401
59.6k
    return BaseInfo::getHashValue(P);
402
59.6k
  }
403
404
  static bool isEqual(const CanonicalDeclPtr &LHS,
405
3.36M
                      const CanonicalDeclPtr &RHS) {
406
3.36M
    return BaseInfo::isEqual(LHS, RHS);
407
3.36M
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::isEqual(clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&, clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&)
Line
Count
Source
405
7.97k
                      const CanonicalDeclPtr &RHS) {
406
7.97k
    return BaseInfo::isEqual(LHS, RHS);
407
7.97k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::VarDecl const> >::isEqual(clang::CanonicalDeclPtr<clang::VarDecl const> const&, clang::CanonicalDeclPtr<clang::VarDecl const> const&)
Line
Count
Source
405
181k
                      const CanonicalDeclPtr &RHS) {
406
181k
    return BaseInfo::isEqual(LHS, RHS);
407
181k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::isEqual(clang::CanonicalDeclPtr<clang::FunctionDecl> const&, clang::CanonicalDeclPtr<clang::FunctionDecl> const&)
Line
Count
Source
405
381k
                      const CanonicalDeclPtr &RHS) {
406
381k
    return BaseInfo::isEqual(LHS, RHS);
407
381k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl> >::isEqual(clang::CanonicalDeclPtr<clang::Decl> const&, clang::CanonicalDeclPtr<clang::Decl> const&)
Line
Count
Source
405
2.79M
                      const CanonicalDeclPtr &RHS) {
406
2.79M
    return BaseInfo::isEqual(LHS, RHS);
407
2.79M
  }
408
};
409
410
} // namespace llvm
411
412
#endif // LLVM_CLANG_AST_REDECLARABLE_H