Coverage Report

Created: 2022-07-16 07:03

/Users/buildslave/jenkins/workspace/coverage/llvm-project/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
131M
        : 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
4.52M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::TranslationUnitDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::TranslationUnitDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
112
96.7k
        : 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
84.0M
        : 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
30.5M
        : 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
7.50M
        : 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
376
        : 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
1.64M
        : 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
453k
        : 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
285k
        : 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
26.1k
        : 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
2.33M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
113
3.10M
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::TranslationUnitDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::TranslationUnitDecl>::DeclLink::PreviousTag, clang::TranslationUnitDecl*)
Line
Count
Source
113
112
    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
647k
    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
306k
    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
264k
    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
1.58M
    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
167k
    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
5.66k
    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
25.7k
    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
82.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
12.9k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
114
115
651M
    bool isFirst() const {
116
651M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
651M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()358M
;
120
651M
    }
clang::Redeclarable<clang::TranslationUnitDecl>::DeclLink::isFirst() const
Line
Count
Source
115
53.2k
    bool isFirst() const {
116
53.2k
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
53.2k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()157
;
120
53.2k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::isFirst() const
Line
Count
Source
115
49.2M
    bool isFirst() const {
116
49.2M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
49.2M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()15.0M
;
120
49.2M
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::isFirst() const
Line
Count
Source
115
101M
    bool isFirst() const {
116
101M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
101M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()23.1M
;
120
101M
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::isFirst() const
Line
Count
Source
115
4.54M
    bool isFirst() const {
116
4.54M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
4.54M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()3.90M
;
120
4.54M
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::isFirst() const
Line
Count
Source
115
64.2M
    bool isFirst() const {
116
64.2M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
64.2M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()18.3M
;
120
64.2M
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::isFirst() const
Line
Count
Source
115
1.19M
    bool isFirst() const {
116
1.19M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
1.19M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()824k
;
120
1.19M
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::isFirst() const
Line
Count
Source
115
6.92M
    bool isFirst() const {
116
6.92M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
6.92M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()4.78M
;
120
6.92M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::isFirst() const
Line
Count
Source
115
421M
    bool isFirst() const {
116
421M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
421M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()291M
;
120
421M
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::isFirst() const
Line
Count
Source
115
434
    bool isFirst() const {
116
434
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
434
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()409
;
120
434
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::isFirst() const
Line
Count
Source
115
1.25M
    bool isFirst() const {
116
1.25M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
1.25M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()772k
;
120
1.25M
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::isFirst() const
Line
Count
Source
115
117k
    bool isFirst() const {
116
117k
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
117k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()61.4k
;
120
117k
    }
121
122
886M
    decl_type *getPrevious(const decl_type *D) const {
123
886M
      if (Link.is<NotKnownLatest>()) {
124
158M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
158M
        if (NKL.is<Previous>())
126
58.5M
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // Allocate the generational 'most recent' cache now, if needed.
129
100M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
100M
                               NKL.get<UninitializedLatest>()),
131
100M
                           const_cast<decl_type *>(D));
132
100M
      }
133
134
827M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
886M
    }
clang::Redeclarable<clang::TranslationUnitDecl>::DeclLink::getPrevious(clang::TranslationUnitDecl const*) const
Line
Count
Source
122
96.4M
    decl_type *getPrevious(const decl_type *D) const {
123
96.4M
      if (Link.is<NotKnownLatest>()) {
124
96.5k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
96.5k
        if (NKL.is<Previous>())
126
45
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // Allocate the generational 'most recent' cache now, if needed.
129
96.5k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
96.5k
                               NKL.get<UninitializedLatest>()),
131
96.5k
                           const_cast<decl_type *>(D));
132
96.5k
      }
133
134
96.4M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
96.4M
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::getPrevious(clang::VarDecl const*) const
Line
Count
Source
122
206M
    decl_type *getPrevious(const decl_type *D) const {
123
206M
      if (Link.is<NotKnownLatest>()) {
124
76.0M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
76.0M
        if (NKL.is<Previous>())
126
4.66M
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // Allocate the generational 'most recent' cache now, if needed.
129
71.3M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
71.3M
                               NKL.get<UninitializedLatest>()),
131
71.3M
                           const_cast<decl_type *>(D));
132
71.3M
      }
133
134
201M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
206M
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::getPrevious(clang::FunctionDecl const*) const
Line
Count
Source
122
104M
    decl_type *getPrevious(const decl_type *D) const {
123
104M
      if (Link.is<NotKnownLatest>()) {
124
29.0M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
29.0M
        if (NKL.is<Previous>())
126
1.67M
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // Allocate the generational 'most recent' cache now, if needed.
129
27.3M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
27.3M
                               NKL.get<UninitializedLatest>()),
131
27.3M
                           const_cast<decl_type *>(D));
132
27.3M
      }
133
134
103M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
104M
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::getPrevious(clang::TypedefNameDecl const*) const
Line
Count
Source
122
3.38M
    decl_type *getPrevious(const decl_type *D) const {
123
3.38M
      if (Link.is<NotKnownLatest>()) {
124
520k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
520k
        if (NKL.is<Previous>())
126
31.1k
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // Allocate the generational 'most recent' cache now, if needed.
129
489k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
489k
                               NKL.get<UninitializedLatest>()),
131
489k
                           const_cast<decl_type *>(D));
132
489k
      }
133
134
3.35M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
3.38M
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::getPrevious(clang::TagDecl const*) const
Line
Count
Source
122
385M
    decl_type *getPrevious(const decl_type *D) const {
123
385M
      if (Link.is<NotKnownLatest>()) {
124
3.62M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
3.62M
        if (NKL.is<Previous>())
126
3.62M
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // 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
134
382M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
385M
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::getPrevious(clang::UsingShadowDecl const*) const
Line
Count
Source
122
1.38M
    decl_type *getPrevious(const decl_type *D) const {
123
1.38M
      if (Link.is<NotKnownLatest>()) {
124
18.6k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
18.6k
        if (NKL.is<Previous>())
126
18.6k
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // Allocate the generational 'most recent' cache now, if needed.
129
25
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
25
                               NKL.get<UninitializedLatest>()),
131
25
                           const_cast<decl_type *>(D));
132
25
      }
133
134
1.36M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
1.38M
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::getPrevious(clang::ObjCProtocolDecl const*) const
Line
Count
Source
122
261k
    decl_type *getPrevious(const decl_type *D) const {
123
261k
      if (Link.is<NotKnownLatest>()) {
124
14.8k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
14.8k
        if (NKL.is<Previous>())
126
14.8k
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // 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
134
246k
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
261k
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::getPrevious(clang::ObjCInterfaceDecl const*) const
Line
Count
Source
122
1.18M
    decl_type *getPrevious(const decl_type *D) const {
123
1.18M
      if (Link.is<NotKnownLatest>()) {
124
365k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
365k
        if (NKL.is<Previous>())
126
365k
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // 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
134
824k
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
1.18M
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::getPrevious(clang::RedeclarableTemplateDecl const*) const
Line
Count
Source
122
30.0M
    decl_type *getPrevious(const decl_type *D) const {
123
30.0M
      if (Link.is<NotKnownLatest>()) {
124
1.56M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
1.56M
        if (NKL.is<Previous>())
126
638k
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // Allocate the generational 'most recent' cache now, if needed.
129
923k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
923k
                               NKL.get<UninitializedLatest>()),
131
923k
                           const_cast<decl_type *>(D));
132
923k
      }
133
134
29.3M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
30.0M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::getPrevious(clang::NamespaceDecl const*) const
Line
Count
Source
122
56.4M
    decl_type *getPrevious(const decl_type *D) const {
123
56.4M
      if (Link.is<NotKnownLatest>()) {
124
47.5M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
47.5M
        if (NKL.is<Previous>())
126
47.5M
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // 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
134
8.95M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
56.4M
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::getPrevious(clang::NamespaceAliasDecl const*) const
Line
Count
Source
122
248
    decl_type *getPrevious(const decl_type *D) const {
123
248
      if (Link.is<NotKnownLatest>()) {
124
83
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
83
        if (NKL.is<Previous>())
126
14
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // Allocate the generational 'most recent' cache now, if needed.
129
69
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
69
                               NKL.get<UninitializedLatest>()),
131
69
                           const_cast<decl_type *>(D));
132
69
      }
133
134
234
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
248
    }
136
137
1.70M
    void setPrevious(decl_type *D) {
138
1.70M
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
0
      Link = Previous(D);
140
1.70M
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::setPrevious(clang::VarDecl*)
Line
Count
Source
137
10.6k
    void setPrevious(decl_type *D) {
138
10.6k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
0
      Link = Previous(D);
140
10.6k
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::setPrevious(clang::FunctionDecl*)
Line
Count
Source
137
183k
    void setPrevious(decl_type *D) {
138
183k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
0
      Link = Previous(D);
140
183k
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::setPrevious(clang::NamespaceDecl*)
Line
Count
Source
137
1.19M
    void setPrevious(decl_type *D) {
138
1.19M
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
0
      Link = Previous(D);
140
1.19M
    }
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
0
      Link = Previous(D);
140
3
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::setPrevious(clang::ObjCInterfaceDecl*)
Line
Count
Source
137
42.4k
    void setPrevious(decl_type *D) {
138
42.4k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
0
      Link = Previous(D);
140
42.4k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::setPrevious(clang::ObjCProtocolDecl*)
Line
Count
Source
137
655
    void setPrevious(decl_type *D) {
138
655
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
0
      Link = Previous(D);
140
655
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::setPrevious(clang::RedeclarableTemplateDecl*)
Line
Count
Source
137
146k
    void setPrevious(decl_type *D) {
138
146k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
0
      Link = Previous(D);
140
146k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::setPrevious(clang::TagDecl*)
Line
Count
Source
137
109k
    void setPrevious(decl_type *D) {
138
109k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
0
      Link = Previous(D);
140
109k
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::setPrevious(clang::TypedefNameDecl*)
Line
Count
Source
137
19.5k
    void setPrevious(decl_type *D) {
138
19.5k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
0
      Link = Previous(D);
140
19.5k
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::setPrevious(clang::UsingShadowDecl*)
Line
Count
Source
137
6.15k
    void setPrevious(decl_type *D) {
138
6.15k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
0
      Link = Previous(D);
140
6.15k
    }
Unexecuted instantiation: clang::Redeclarable<clang::TranslationUnitDecl>::DeclLink::setPrevious(clang::TranslationUnitDecl*)
141
142
17.0M
    void setLatest(decl_type *D) {
143
17.0M
      assert(isFirst() && "decl became canonical unexpectedly");
144
17.0M
      if (Link.is<NotKnownLatest>()) {
145
14.0M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
14.0M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
14.0M
                               NKL.get<UninitializedLatest>()),
148
14.0M
                           D);
149
14.0M
      } else {
150
2.99M
        auto Latest = Link.get<KnownLatest>();
151
2.99M
        Latest.set(D);
152
2.99M
        Link = Latest;
153
2.99M
      }
154
17.0M
    }
clang::Redeclarable<clang::TranslationUnitDecl>::DeclLink::setLatest(clang::TranslationUnitDecl*)
Line
Count
Source
142
112
    void setLatest(decl_type *D) {
143
112
      assert(isFirst() && "decl became canonical unexpectedly");
144
112
      if (Link.is<NotKnownLatest>()) {
145
0
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
0
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
0
                               NKL.get<UninitializedLatest>()),
148
0
                           D);
149
112
      } else {
150
112
        auto Latest = Link.get<KnownLatest>();
151
112
        Latest.set(D);
152
112
        Link = Latest;
153
112
      }
154
112
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::setLatest(clang::FunctionDecl*)
Line
Count
Source
142
1.70M
    void setLatest(decl_type *D) {
143
1.70M
      assert(isFirst() && "decl became canonical unexpectedly");
144
1.70M
      if (Link.is<NotKnownLatest>()) {
145
1.23M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
1.23M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
1.23M
                               NKL.get<UninitializedLatest>()),
148
1.23M
                           D);
149
1.23M
      } else {
150
465k
        auto Latest = Link.get<KnownLatest>();
151
465k
        Latest.set(D);
152
465k
        Link = Latest;
153
465k
      }
154
1.70M
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::setLatest(clang::RedeclarableTemplateDecl*)
Line
Count
Source
142
957k
    void setLatest(decl_type *D) {
143
957k
      assert(isFirst() && "decl became canonical unexpectedly");
144
957k
      if (Link.is<NotKnownLatest>()) {
145
795k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
795k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
795k
                               NKL.get<UninitializedLatest>()),
148
795k
                           D);
149
795k
      } else {
150
161k
        auto Latest = Link.get<KnownLatest>();
151
161k
        Latest.set(D);
152
161k
        Link = Latest;
153
161k
      }
154
957k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::setLatest(clang::TagDecl*)
Line
Count
Source
142
9.10M
    void setLatest(decl_type *D) {
143
9.10M
      assert(isFirst() && "decl became canonical unexpectedly");
144
9.10M
      if (Link.is<NotKnownLatest>()) {
145
7.37M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
7.37M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
7.37M
                               NKL.get<UninitializedLatest>()),
148
7.37M
                           D);
149
7.37M
      } else {
150
1.73M
        auto Latest = Link.get<KnownLatest>();
151
1.73M
        Latest.set(D);
152
1.73M
        Link = Latest;
153
1.73M
      }
154
9.10M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::setLatest(clang::NamespaceDecl*)
Line
Count
Source
142
1.65M
    void setLatest(decl_type *D) {
143
1.65M
      assert(isFirst() && "decl became canonical unexpectedly");
144
1.65M
      if (Link.is<NotKnownLatest>()) {
145
1.25M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
1.25M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
1.25M
                               NKL.get<UninitializedLatest>()),
148
1.25M
                           D);
149
1.25M
      } else {
150
406k
        auto Latest = Link.get<KnownLatest>();
151
406k
        Latest.set(D);
152
406k
        Link = Latest;
153
406k
      }
154
1.65M
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::setLatest(clang::ObjCInterfaceDecl*)
Line
Count
Source
142
293k
    void setLatest(decl_type *D) {
143
293k
      assert(isFirst() && "decl became canonical unexpectedly");
144
293k
      if (Link.is<NotKnownLatest>()) {
145
160k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
160k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
160k
                               NKL.get<UninitializedLatest>()),
148
160k
                           D);
149
160k
      } else {
150
133k
        auto Latest = Link.get<KnownLatest>();
151
133k
        Latest.set(D);
152
133k
        Link = Latest;
153
133k
      }
154
293k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::setLatest(clang::ObjCProtocolDecl*)
Line
Count
Source
142
28.2k
    void setLatest(decl_type *D) {
143
28.2k
      assert(isFirst() && "decl became canonical unexpectedly");
144
28.2k
      if (Link.is<NotKnownLatest>()) {
145
21.1k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
21.1k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
21.1k
                               NKL.get<UninitializedLatest>()),
148
21.1k
                           D);
149
21.1k
      } else {
150
7.11k
        auto Latest = Link.get<KnownLatest>();
151
7.11k
        Latest.set(D);
152
7.11k
        Link = Latest;
153
7.11k
      }
154
28.2k
    }
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::TypedefNameDecl>::DeclLink::setLatest(clang::TypedefNameDecl*)
Line
Count
Source
142
387k
    void setLatest(decl_type *D) {
143
387k
      assert(isFirst() && "decl became canonical unexpectedly");
144
387k
      if (Link.is<NotKnownLatest>()) {
145
379k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
379k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
379k
                               NKL.get<UninitializedLatest>()),
148
379k
                           D);
149
379k
      } else {
150
8.03k
        auto Latest = Link.get<KnownLatest>();
151
8.03k
        Latest.set(D);
152
8.03k
        Link = Latest;
153
8.03k
      }
154
387k
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::setLatest(clang::UsingShadowDecl*)
Line
Count
Source
142
405k
    void setLatest(decl_type *D) {
143
405k
      assert(isFirst() && "decl became canonical unexpectedly");
144
405k
      if (Link.is<NotKnownLatest>()) {
145
398k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
398k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
398k
                               NKL.get<UninitializedLatest>()),
148
398k
                           D);
149
398k
      } else {
150
6.82k
        auto Latest = Link.get<KnownLatest>();
151
6.82k
        Latest.set(D);
152
6.82k
        Link = Latest;
153
6.82k
      }
154
405k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::setLatest(clang::VarDecl*)
Line
Count
Source
142
2.53M
    void setLatest(decl_type *D) {
143
2.53M
      assert(isFirst() && "decl became canonical unexpectedly");
144
2.53M
      if (Link.is<NotKnownLatest>()) {
145
2.46M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
2.46M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
2.46M
                               NKL.get<UninitializedLatest>()),
148
2.46M
                           D);
149
2.46M
      } else {
150
72.7k
        auto Latest = Link.get<KnownLatest>();
151
72.7k
        Latest.set(D);
152
72.7k
        Link = Latest;
153
72.7k
      }
154
2.53M
    }
155
156
709k
    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
7.58k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
2
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
Unexecuted instantiation: clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::markIncomplete()
clang::Redeclarable<clang::TagDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
13.7k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
29
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
Unexecuted instantiation: clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::markIncomplete()
clang::Redeclarable<clang::FunctionDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
668k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::VarDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
27
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::TranslationUnitDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
19.2k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
157
158
572k
    Decl *getLatestNotUpdated() const {
159
572k
      assert(isFirst() && "expected a canonical decl");
160
572k
      if (Link.is<NotKnownLatest>())
161
1.79k
        return nullptr;
162
571k
      return Link.get<KnownLatest>().getNotUpdated();
163
572k
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
2.23k
    Decl *getLatestNotUpdated() const {
159
2.23k
      assert(isFirst() && "expected a canonical decl");
160
2.23k
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
2.23k
      return Link.get<KnownLatest>().getNotUpdated();
163
2.23k
    }
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
7.57k
    Decl *getLatestNotUpdated() const {
159
7.57k
      assert(isFirst() && "expected a canonical decl");
160
7.57k
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
7.57k
      return Link.get<KnownLatest>().getNotUpdated();
163
7.57k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
2.07k
    Decl *getLatestNotUpdated() const {
159
2.07k
      assert(isFirst() && "expected a canonical decl");
160
2.07k
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
2.07k
      return Link.get<KnownLatest>().getNotUpdated();
163
2.07k
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
501k
    Decl *getLatestNotUpdated() const {
159
501k
      assert(isFirst() && "expected a canonical decl");
160
501k
      if (Link.is<NotKnownLatest>())
161
13
        return nullptr;
162
501k
      return Link.get<KnownLatest>().getNotUpdated();
163
501k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
53.4k
    Decl *getLatestNotUpdated() const {
159
53.4k
      assert(isFirst() && "expected a canonical decl");
160
53.4k
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
53.4k
      return Link.get<KnownLatest>().getNotUpdated();
163
53.4k
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
3.59k
    Decl *getLatestNotUpdated() const {
159
3.59k
      assert(isFirst() && "expected a canonical decl");
160
3.59k
      if (Link.is<NotKnownLatest>())
161
1.78k
        return nullptr;
162
1.81k
      return Link.get<KnownLatest>().getNotUpdated();
163
3.59k
    }
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.39k
    Decl *getLatestNotUpdated() const {
159
1.39k
      assert(isFirst() && "expected a canonical decl");
160
1.39k
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
1.39k
      return Link.get<KnownLatest>().getNotUpdated();
163
1.39k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
868
    Decl *getLatestNotUpdated() const {
159
868
      assert(isFirst() && "expected a canonical decl");
160
868
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
868
      return Link.get<KnownLatest>().getNotUpdated();
163
868
    }
Unexecuted instantiation: clang::Redeclarable<clang::TranslationUnitDecl>::DeclLink::getLatestNotUpdated() const
164
  };
165
166
3.10M
  static DeclLink PreviousDeclLink(decl_type *D) {
167
3.10M
    return DeclLink(DeclLink::PreviousLink, D);
168
3.10M
  }
clang::Redeclarable<clang::TranslationUnitDecl>::PreviousDeclLink(clang::TranslationUnitDecl*)
Line
Count
Source
166
112
  static DeclLink PreviousDeclLink(decl_type *D) {
167
112
    return DeclLink(DeclLink::PreviousLink, D);
168
112
  }
clang::Redeclarable<clang::FunctionDecl>::PreviousDeclLink(clang::FunctionDecl*)
Line
Count
Source
166
647k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
647k
    return DeclLink(DeclLink::PreviousLink, D);
168
647k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::PreviousDeclLink(clang::RedeclarableTemplateDecl*)
Line
Count
Source
166
306k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
306k
    return DeclLink(DeclLink::PreviousLink, D);
168
306k
  }
clang::Redeclarable<clang::TagDecl>::PreviousDeclLink(clang::TagDecl*)
Line
Count
Source
166
264k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
264k
    return DeclLink(DeclLink::PreviousLink, D);
168
264k
  }
clang::Redeclarable<clang::NamespaceDecl>::PreviousDeclLink(clang::NamespaceDecl*)
Line
Count
Source
166
1.58M
  static DeclLink PreviousDeclLink(decl_type *D) {
167
1.58M
    return DeclLink(DeclLink::PreviousLink, D);
168
1.58M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::PreviousDeclLink(clang::ObjCInterfaceDecl*)
Line
Count
Source
166
167k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
167k
    return DeclLink(DeclLink::PreviousLink, D);
168
167k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::PreviousDeclLink(clang::ObjCProtocolDecl*)
Line
Count
Source
166
5.66k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
5.66k
    return DeclLink(DeclLink::PreviousLink, D);
168
5.66k
  }
clang::Redeclarable<clang::TypedefNameDecl>::PreviousDeclLink(clang::TypedefNameDecl*)
Line
Count
Source
166
25.7k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
25.7k
    return DeclLink(DeclLink::PreviousLink, D);
168
25.7k
  }
clang::Redeclarable<clang::VarDecl>::PreviousDeclLink(clang::VarDecl*)
Line
Count
Source
166
82.5k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
82.5k
    return DeclLink(DeclLink::PreviousLink, D);
168
82.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
12.9k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
12.9k
    return DeclLink(DeclLink::PreviousLink, D);
168
12.9k
  }
169
170
131M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
131M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
131M
  }
clang::Redeclarable<clang::TypedefNameDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
4.52M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
4.52M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
4.52M
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
376
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
376
    return DeclLink(DeclLink::LatestLink, Ctx);
172
376
  }
clang::Redeclarable<clang::TranslationUnitDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
96.7k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
96.7k
    return DeclLink(DeclLink::LatestLink, Ctx);
172
96.7k
  }
clang::Redeclarable<clang::VarDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
84.0M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
84.0M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
84.0M
  }
clang::Redeclarable<clang::FunctionDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
30.5M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
30.5M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
30.5M
  }
clang::Redeclarable<clang::TagDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
7.50M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
7.50M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
7.50M
  }
clang::Redeclarable<clang::NamespaceDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
1.64M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
1.64M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
1.64M
  }
clang::Redeclarable<clang::UsingShadowDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
453k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
453k
    return DeclLink(DeclLink::LatestLink, Ctx);
172
453k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
285k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
285k
    return DeclLink(DeclLink::LatestLink, Ctx);
172
285k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
26.1k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
26.1k
    return DeclLink(DeclLink::LatestLink, Ctx);
172
26.1k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
2.33M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
2.33M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
2.33M
  }
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
886M
  decl_type *getNextRedeclaration() const {
190
886M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
886M
  }
clang::Redeclarable<clang::TranslationUnitDecl>::getNextRedeclaration() const
Line
Count
Source
189
96.4M
  decl_type *getNextRedeclaration() const {
190
96.4M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
96.4M
  }
clang::Redeclarable<clang::VarDecl>::getNextRedeclaration() const
Line
Count
Source
189
206M
  decl_type *getNextRedeclaration() const {
190
206M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
206M
  }
clang::Redeclarable<clang::FunctionDecl>::getNextRedeclaration() const
Line
Count
Source
189
104M
  decl_type *getNextRedeclaration() const {
190
104M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
104M
  }
clang::Redeclarable<clang::TypedefNameDecl>::getNextRedeclaration() const
Line
Count
Source
189
3.38M
  decl_type *getNextRedeclaration() const {
190
3.38M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
3.38M
  }
clang::Redeclarable<clang::TagDecl>::getNextRedeclaration() const
Line
Count
Source
189
385M
  decl_type *getNextRedeclaration() const {
190
385M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
385M
  }
clang::Redeclarable<clang::UsingShadowDecl>::getNextRedeclaration() const
Line
Count
Source
189
1.38M
  decl_type *getNextRedeclaration() const {
190
1.38M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
1.38M
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getNextRedeclaration() const
Line
Count
Source
189
261k
  decl_type *getNextRedeclaration() const {
190
261k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
261k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getNextRedeclaration() const
Line
Count
Source
189
1.18M
  decl_type *getNextRedeclaration() const {
190
1.18M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
1.18M
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getNextRedeclaration() const
Line
Count
Source
189
30.0M
  decl_type *getNextRedeclaration() const {
190
30.0M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
30.0M
  }
clang::Redeclarable<clang::NamespaceDecl>::getNextRedeclaration() const
Line
Count
Source
189
56.4M
  decl_type *getNextRedeclaration() const {
190
56.4M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
56.4M
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getNextRedeclaration() const
Line
Count
Source
189
248
  decl_type *getNextRedeclaration() const {
190
248
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
248
  }
192
193
public:
194
  friend class ASTDeclReader;
195
  friend class ASTDeclWriter;
196
  friend class IncrementalParser;
197
198
  Redeclarable(const ASTContext &Ctx)
199
      : RedeclLink(LatestDeclLink(Ctx)),
200
131M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::TypedefNameDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
4.52M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::TranslationUnitDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
96.7k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::VarDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
84.0M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::FunctionDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
30.5M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::TagDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
7.50M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::NamespaceAliasDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
376
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::NamespaceDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
1.64M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::UsingShadowDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
453k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
285k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
26.1k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::RedeclarableTemplateDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
2.33M
        First(static_cast<decl_type *>(this)) {}
201
202
  /// Return the previous declaration of this declaration or NULL if this
203
  /// is the first declaration.
204
82.1M
  decl_type *getPreviousDecl() {
205
82.1M
    if (!RedeclLink.isFirst())
206
2.11M
      return getNextRedeclaration();
207
80.0M
    return nullptr;
208
82.1M
  }
clang::Redeclarable<clang::TranslationUnitDecl>::getPreviousDecl()
Line
Count
Source
204
52.9k
  decl_type *getPreviousDecl() {
205
52.9k
    if (!RedeclLink.isFirst())
206
45
      return getNextRedeclaration();
207
52.8k
    return nullptr;
208
52.9k
  }
clang::Redeclarable<clang::VarDecl>::getPreviousDecl()
Line
Count
Source
204
11.6M
  decl_type *getPreviousDecl() {
205
11.6M
    if (!RedeclLink.isFirst())
206
27.2k
      return getNextRedeclaration();
207
11.5M
    return nullptr;
208
11.6M
  }
clang::Redeclarable<clang::FunctionDecl>::getPreviousDecl()
Line
Count
Source
204
52.8M
  decl_type *getPreviousDecl() {
205
52.8M
    if (!RedeclLink.isFirst())
206
499k
      return getNextRedeclaration();
207
52.3M
    return nullptr;
208
52.8M
  }
clang::Redeclarable<clang::TypedefNameDecl>::getPreviousDecl()
Line
Count
Source
204
3.76M
  decl_type *getPreviousDecl() {
205
3.76M
    if (!RedeclLink.isFirst())
206
19.9k
      return getNextRedeclaration();
207
3.75M
    return nullptr;
208
3.76M
  }
clang::Redeclarable<clang::TagDecl>::getPreviousDecl()
Line
Count
Source
204
8.62M
  decl_type *getPreviousDecl() {
205
8.62M
    if (!RedeclLink.isFirst())
206
439k
      return getNextRedeclaration();
207
8.18M
    return nullptr;
208
8.62M
  }
clang::Redeclarable<clang::UsingShadowDecl>::getPreviousDecl()
Line
Count
Source
204
360k
  decl_type *getPreviousDecl() {
205
360k
    if (!RedeclLink.isFirst())
206
7.39k
      return getNextRedeclaration();
207
352k
    return nullptr;
208
360k
  }
clang::Redeclarable<clang::NamespaceDecl>::getPreviousDecl()
Line
Count
Source
204
544k
  decl_type *getPreviousDecl() {
205
544k
    if (!RedeclLink.isFirst())
206
476k
      return getNextRedeclaration();
207
67.5k
    return nullptr;
208
544k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getPreviousDecl()
Line
Count
Source
204
356
  decl_type *getPreviousDecl() {
205
356
    if (!RedeclLink.isFirst())
206
12
      return getNextRedeclaration();
207
344
    return nullptr;
208
356
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getPreviousDecl()
Line
Count
Source
204
339k
  decl_type *getPreviousDecl() {
205
339k
    if (!RedeclLink.isFirst())
206
208k
      return getNextRedeclaration();
207
131k
    return nullptr;
208
339k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getPreviousDecl()
Line
Count
Source
204
29.7k
  decl_type *getPreviousDecl() {
205
29.7k
    if (!RedeclLink.isFirst())
206
8.08k
      return getNextRedeclaration();
207
21.6k
    return nullptr;
208
29.7k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getPreviousDecl()
Line
Count
Source
204
3.92M
  decl_type *getPreviousDecl() {
205
3.92M
    if (!RedeclLink.isFirst())
206
433k
      return getNextRedeclaration();
207
3.49M
    return nullptr;
208
3.92M
  }
209
4.75M
  const decl_type *getPreviousDecl() const {
210
4.75M
    return const_cast<decl_type *>(
211
4.75M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
4.75M
  }
clang::Redeclarable<clang::VarDecl>::getPreviousDecl() const
Line
Count
Source
209
1.23M
  const decl_type *getPreviousDecl() const {
210
1.23M
    return const_cast<decl_type *>(
211
1.23M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
1.23M
  }
clang::Redeclarable<clang::FunctionDecl>::getPreviousDecl() const
Line
Count
Source
209
2.10M
  const decl_type *getPreviousDecl() const {
210
2.10M
    return const_cast<decl_type *>(
211
2.10M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
2.10M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getPreviousDecl() const
Line
Count
Source
209
32.9k
  const decl_type *getPreviousDecl() const {
210
32.9k
    return const_cast<decl_type *>(
211
32.9k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
32.9k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getPreviousDecl() const
Line
Count
Source
209
1.36M
  const decl_type *getPreviousDecl() const {
210
1.36M
    return const_cast<decl_type *>(
211
1.36M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
1.36M
  }
clang::Redeclarable<clang::NamespaceDecl>::getPreviousDecl() const
Line
Count
Source
209
218
  const decl_type *getPreviousDecl() const {
210
218
    return const_cast<decl_type *>(
211
218
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
218
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getPreviousDecl() const
Line
Count
Source
209
5
  const decl_type *getPreviousDecl() const {
210
5
    return const_cast<decl_type *>(
211
5
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
5
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getPreviousDecl() const
Line
Count
Source
209
26
  const decl_type *getPreviousDecl() const {
210
26
    return const_cast<decl_type *>(
211
26
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
26
  }
clang::Redeclarable<clang::TagDecl>::getPreviousDecl() const
Line
Count
Source
209
4.36k
  const decl_type *getPreviousDecl() const {
210
4.36k
    return const_cast<decl_type *>(
211
4.36k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
4.36k
  }
clang::Redeclarable<clang::TypedefNameDecl>::getPreviousDecl() const
Line
Count
Source
209
3.49k
  const decl_type *getPreviousDecl() const {
210
3.49k
    return const_cast<decl_type *>(
211
3.49k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
3.49k
  }
clang::Redeclarable<clang::UsingShadowDecl>::getPreviousDecl() const
Line
Count
Source
209
84
  const decl_type *getPreviousDecl() const {
210
84
    return const_cast<decl_type *>(
211
84
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
84
  }
clang::Redeclarable<clang::TranslationUnitDecl>::getPreviousDecl() const
Line
Count
Source
209
551
  const decl_type *getPreviousDecl() const {
210
551
    return const_cast<decl_type *>(
211
551
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
551
  }
213
214
  /// Return the first declaration of this declaration or itself if this
215
  /// is the only declaration.
216
2.52G
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::TranslationUnitDecl>::getFirstDecl()
Line
Count
Source
216
799M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::VarDecl>::getFirstDecl()
Line
Count
Source
216
330M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::FunctionDecl>::getFirstDecl()
Line
Count
Source
216
697M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::TypedefNameDecl>::getFirstDecl()
Line
Count
Source
216
137M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::TagDecl>::getFirstDecl()
Line
Count
Source
216
402M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::NamespaceAliasDecl>::getFirstDecl()
Line
Count
Source
216
450
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::UsingShadowDecl>::getFirstDecl()
Line
Count
Source
216
4.02M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getFirstDecl()
Line
Count
Source
216
132M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::NamespaceDecl>::getFirstDecl()
Line
Count
Source
216
9.92M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getFirstDecl()
Line
Count
Source
216
6.55M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::ObjCProtocolDecl>::getFirstDecl()
Line
Count
Source
216
323k
  decl_type *getFirstDecl() { return First; }
217
218
  /// Return the first declaration of this declaration or itself if this
219
  /// is the only declaration.
220
63.1M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::TypedefNameDecl>::getFirstDecl() const
Line
Count
Source
220
140
  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::ObjCProtocolDecl>::getFirstDecl() const
Line
Count
Source
220
2.47k
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getFirstDecl() const
Line
Count
Source
220
65.7k
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::VarDecl>::getFirstDecl() const
Line
Count
Source
220
21.2M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::FunctionDecl>::getFirstDecl() const
Line
Count
Source
220
34.2M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::TagDecl>::getFirstDecl() const
Line
Count
Source
220
328k
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getFirstDecl() const
Line
Count
Source
220
7.24M
  const decl_type *getFirstDecl() const { return First; }
221
222
  /// True if this is the first declaration in its redeclaration chain.
223
537M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::TagDecl>::isFirstDecl() const
Line
Count
Source
223
38.6M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::VarDecl>::isFirstDecl() const
Line
Count
Source
223
34.9M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::FunctionDecl>::isFirstDecl() const
Line
Count
Source
223
45.9M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::NamespaceDecl>::isFirstDecl() const
Line
Count
Source
223
416M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::ObjCInterfaceDecl>::isFirstDecl() const
Line
Count
Source
223
157k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::ObjCProtocolDecl>::isFirstDecl() const
Line
Count
Source
223
25.4k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::TypedefNameDecl>::isFirstDecl() const
Line
Count
Source
223
353k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::NamespaceAliasDecl>::isFirstDecl() const
Line
Count
Source
223
16
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::UsingShadowDecl>::isFirstDecl() const
Line
Count
Source
223
50.9k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::isFirstDecl() const
Line
Count
Source
223
780k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
224
225
  /// Returns the most recent (re)declaration of this declaration.
226
636M
  decl_type *getMostRecentDecl() {
227
636M
    return getFirstDecl()->getNextRedeclaration();
228
636M
  }
clang::Redeclarable<clang::TranslationUnitDecl>::getMostRecentDecl()
Line
Count
Source
226
96.4M
  decl_type *getMostRecentDecl() {
227
96.4M
    return getFirstDecl()->getNextRedeclaration();
228
96.4M
  }
clang::Redeclarable<clang::VarDecl>::getMostRecentDecl()
Line
Count
Source
226
90.6M
  decl_type *getMostRecentDecl() {
227
90.6M
    return getFirstDecl()->getNextRedeclaration();
228
90.6M
  }
clang::Redeclarable<clang::FunctionDecl>::getMostRecentDecl()
Line
Count
Source
226
69.5M
  decl_type *getMostRecentDecl() {
227
69.5M
    return getFirstDecl()->getNextRedeclaration();
228
69.5M
  }
clang::Redeclarable<clang::TypedefNameDecl>::getMostRecentDecl()
Line
Count
Source
226
2.40M
  decl_type *getMostRecentDecl() {
227
2.40M
    return getFirstDecl()->getNextRedeclaration();
228
2.40M
  }
clang::Redeclarable<clang::TagDecl>::getMostRecentDecl()
Line
Count
Source
226
347M
  decl_type *getMostRecentDecl() {
227
347M
    return getFirstDecl()->getNextRedeclaration();
228
347M
  }
clang::Redeclarable<clang::UsingShadowDecl>::getMostRecentDecl()
Line
Count
Source
226
973k
  decl_type *getMostRecentDecl() {
227
973k
    return getFirstDecl()->getNextRedeclaration();
228
973k
  }
clang::Redeclarable<clang::NamespaceDecl>::getMostRecentDecl()
Line
Count
Source
226
8.32M
  decl_type *getMostRecentDecl() {
227
8.32M
    return getFirstDecl()->getNextRedeclaration();
228
8.32M
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getMostRecentDecl()
Line
Count
Source
226
135
  decl_type *getMostRecentDecl() {
227
135
    return getFirstDecl()->getNextRedeclaration();
228
135
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getMostRecentDecl()
Line
Count
Source
226
549k
  decl_type *getMostRecentDecl() {
227
549k
    return getFirstDecl()->getNextRedeclaration();
228
549k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getMostRecentDecl()
Line
Count
Source
226
219k
  decl_type *getMostRecentDecl() {
227
219k
    return getFirstDecl()->getNextRedeclaration();
228
219k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getMostRecentDecl()
Line
Count
Source
226
20.4M
  decl_type *getMostRecentDecl() {
227
20.4M
    return getFirstDecl()->getNextRedeclaration();
228
20.4M
  }
229
230
  /// Returns the most recent (re)declaration of this declaration.
231
7.92M
  const decl_type *getMostRecentDecl() const {
232
7.92M
    return getFirstDecl()->getNextRedeclaration();
233
7.92M
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getMostRecentDecl() const
Line
Count
Source
231
1.66k
  const decl_type *getMostRecentDecl() const {
232
1.66k
    return getFirstDecl()->getNextRedeclaration();
233
1.66k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getMostRecentDecl() const
Line
Count
Source
231
65.7k
  const decl_type *getMostRecentDecl() const {
232
65.7k
    return getFirstDecl()->getNextRedeclaration();
233
65.7k
  }
clang::Redeclarable<clang::FunctionDecl>::getMostRecentDecl() const
Line
Count
Source
231
678k
  const decl_type *getMostRecentDecl() const {
232
678k
    return getFirstDecl()->getNextRedeclaration();
233
678k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getMostRecentDecl() const
Line
Count
Source
231
7.17M
  const decl_type *getMostRecentDecl() const {
232
7.17M
    return getFirstDecl()->getNextRedeclaration();
233
7.17M
  }
clang::Redeclarable<clang::VarDecl>::getMostRecentDecl() const
Line
Count
Source
231
1.19k
  const decl_type *getMostRecentDecl() const {
232
1.19k
    return getFirstDecl()->getNextRedeclaration();
233
1.19k
  }
clang::Redeclarable<clang::TagDecl>::getMostRecentDecl() const
Line
Count
Source
231
170
  const decl_type *getMostRecentDecl() const {
232
170
    return getFirstDecl()->getNextRedeclaration();
233
170
  }
234
235
  /// Set the previous declaration. If PrevDecl is NULL, set this as the
236
  /// first and only declaration.
237
  void setPreviousDecl(decl_type *PrevDecl);
238
239
  /// Iterates through all the redeclarations of the same decl.
240
  class redecl_iterator {
241
    /// Current - The current declaration.
242
    decl_type *Current = nullptr;
243
    decl_type *Starter;
244
    bool PassedFirst = false;
245
246
  public:
247
    using value_type = decl_type *;
248
    using reference = decl_type *;
249
    using pointer = decl_type *;
250
    using iterator_category = std::forward_iterator_tag;
251
    using difference_type = std::ptrdiff_t;
252
253
311M
    redecl_iterator() = default;
clang::Redeclarable<clang::VarDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
55.4M
    redecl_iterator() = default;
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
41.0M
    redecl_iterator() = default;
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
74.6k
    redecl_iterator() = default;
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
18.0k
    redecl_iterator() = default;
clang::Redeclarable<clang::TagDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
214M
    redecl_iterator() = default;
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
976
    redecl_iterator() = default;
254
311M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::VarDecl>::redecl_iterator::redecl_iterator(clang::VarDecl*)
Line
Count
Source
254
55.4M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::redecl_iterator(clang::FunctionDecl*)
Line
Count
Source
254
41.0M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::redecl_iterator(clang::ObjCInterfaceDecl*)
Line
Count
Source
254
74.6k
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::redecl_iterator(clang::ObjCProtocolDecl*)
Line
Count
Source
254
18.0k
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::TagDecl>::redecl_iterator::redecl_iterator(clang::TagDecl*)
Line
Count
Source
254
214M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::redecl_iterator(clang::UsingShadowDecl*)
Line
Count
Source
254
976
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
255
256
333M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::VarDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
64.1M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
42.5M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
108k
    reference operator*() const { return Current; }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
22.8k
    reference operator*() const { return Current; }
clang::Redeclarable<clang::TagDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
226M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
984
    reference operator*() const { return Current; }
257
    pointer operator->() const { return Current; }
258
259
87.3M
    redecl_iterator& operator++() {
260
87.3M
      assert(Current && "Advancing while iterator has reached end");
261
      // Make sure we don't infinitely loop on an invalid redecl chain. This
262
      // should never happen.
263
87.3M
      if (Current->isFirstDecl()) {
264
78.8M
        if (PassedFirst) {
265
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
266
0
          Current = nullptr;
267
0
          return *this;
268
0
        }
269
78.8M
        PassedFirst = true;
270
78.8M
      }
271
272
      // Get either previous decl or latest decl.
273
87.3M
      decl_type *Next = Current->getNextRedeclaration();
274
87.3M
      Current = (Next != Starter) ? 
Next22.1M
:
nullptr65.2M
;
275
87.3M
      return *this;
276
87.3M
    }
clang::Redeclarable<clang::VarDecl>::redecl_iterator::operator++()
Line
Count
Source
259
32.0M
    redecl_iterator& operator++() {
260
32.0M
      assert(Current && "Advancing while iterator has reached end");
261
      // Make sure we don't infinitely loop on an invalid redecl chain. This
262
      // should never happen.
263
32.0M
      if (Current->isFirstDecl()) {
264
27.3M
        if (PassedFirst) {
265
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
266
0
          Current = nullptr;
267
0
          return *this;
268
0
        }
269
27.3M
        PassedFirst = true;
270
27.3M
      }
271
272
      // Get either previous decl or latest decl.
273
32.0M
      decl_type *Next = Current->getNextRedeclaration();
274
32.0M
      Current = (Next != Starter) ? 
Next8.78M
:
nullptr23.2M
;
275
32.0M
      return *this;
276
32.0M
    }
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::operator++()
Line
Count
Source
259
20.1M
    redecl_iterator& operator++() {
260
20.1M
      assert(Current && "Advancing while iterator has reached end");
261
      // Make sure we don't infinitely loop on an invalid redecl chain. This
262
      // should never happen.
263
20.1M
      if (Current->isFirstDecl()) {
264
19.2M
        if (PassedFirst) {
265
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
266
0
          Current = nullptr;
267
0
          return *this;
268
0
        }
269
19.2M
        PassedFirst = true;
270
19.2M
      }
271
272
      // Get either previous decl or latest decl.
273
20.1M
      decl_type *Next = Current->getNextRedeclaration();
274
20.1M
      Current = (Next != Starter) ? 
Next1.47M
:
nullptr18.7M
;
275
20.1M
      return *this;
276
20.1M
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::operator++()
Line
Count
Source
259
108k
    redecl_iterator& operator++() {
260
108k
      assert(Current && "Advancing while iterator has reached end");
261
      // Make sure we don't infinitely loop on an invalid redecl chain. This
262
      // should never happen.
263
108k
      if (Current->isFirstDecl()) {
264
74.6k
        if (PassedFirst) {
265
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
266
0
          Current = nullptr;
267
0
          return *this;
268
0
        }
269
74.6k
        PassedFirst = true;
270
74.6k
      }
271
272
      // Get either previous decl or latest decl.
273
108k
      decl_type *Next = Current->getNextRedeclaration();
274
108k
      Current = (Next != Starter) ? 
Next33.8k
:
nullptr74.6k
;
275
108k
      return *this;
276
108k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::operator++()
Line
Count
Source
259
22.8k
    redecl_iterator& operator++() {
260
22.8k
      assert(Current && "Advancing while iterator has reached end");
261
      // Make sure we don't infinitely loop on an invalid redecl chain. This
262
      // should never happen.
263
22.8k
      if (Current->isFirstDecl()) {
264
18.0k
        if (PassedFirst) {
265
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
266
0
          Current = nullptr;
267
0
          return *this;
268
0
        }
269
18.0k
        PassedFirst = true;
270
18.0k
      }
271
272
      // Get either previous decl or latest decl.
273
22.8k
      decl_type *Next = Current->getNextRedeclaration();
274
22.8k
      Current = (Next != Starter) ? 
Next4.76k
:
nullptr18.0k
;
275
22.8k
      return *this;
276
22.8k
    }
clang::Redeclarable<clang::TagDecl>::redecl_iterator::operator++()
Line
Count
Source
259
35.0M
    redecl_iterator& operator++() {
260
35.0M
      assert(Current && "Advancing while iterator has reached end");
261
      // Make sure we don't infinitely loop on an invalid redecl chain. This
262
      // should never happen.
263
35.0M
      if (Current->isFirstDecl()) {
264
32.1M
        if (PassedFirst) {
265
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
266
0
          Current = nullptr;
267
0
          return *this;
268
0
        }
269
32.1M
        PassedFirst = true;
270
32.1M
      }
271
272
      // Get either previous decl or latest decl.
273
35.0M
      decl_type *Next = Current->getNextRedeclaration();
274
35.0M
      Current = (Next != Starter) ? 
Next11.8M
:
nullptr23.1M
;
275
35.0M
      return *this;
276
35.0M
    }
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::operator++()
Line
Count
Source
259
984
    redecl_iterator& operator++() {
260
984
      assert(Current && "Advancing while iterator has reached end");
261
      // Make sure we don't infinitely loop on an invalid redecl chain. This
262
      // should never happen.
263
984
      if (Current->isFirstDecl()) {
264
976
        if (PassedFirst) {
265
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
266
0
          Current = nullptr;
267
0
          return *this;
268
0
        }
269
976
        PassedFirst = true;
270
976
      }
271
272
      // Get either previous decl or latest decl.
273
984
      decl_type *Next = Current->getNextRedeclaration();
274
984
      Current = (Next != Starter) ? 
Next8
:
nullptr976
;
275
984
      return *this;
276
984
    }
277
278
    redecl_iterator operator++(int) {
279
      redecl_iterator tmp(*this);
280
      ++(*this);
281
      return tmp;
282
    }
283
284
11
    friend bool operator==(redecl_iterator x, redecl_iterator y) {
285
11
      return x.Current == y.Current;
286
11
    }
287
398M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
288
398M
      return x.Current != y.Current;
289
398M
    }
clang::operator!=(clang::Redeclarable<clang::VarDecl>::redecl_iterator, clang::Redeclarable<clang::VarDecl>::redecl_iterator)
Line
Count
Source
287
87.4M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
288
87.4M
      return x.Current != y.Current;
289
87.4M
    }
clang::operator!=(clang::Redeclarable<clang::FunctionDecl>::redecl_iterator, clang::Redeclarable<clang::FunctionDecl>::redecl_iterator)
Line
Count
Source
287
61.2M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
288
61.2M
      return x.Current != y.Current;
289
61.2M
    }
clang::operator!=(clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator, clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator)
Line
Count
Source
287
183k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
288
183k
      return x.Current != y.Current;
289
183k
    }
clang::operator!=(clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator, clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator)
Line
Count
Source
287
40.8k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
288
40.8k
      return x.Current != y.Current;
289
40.8k
    }
clang::operator!=(clang::Redeclarable<clang::TagDecl>::redecl_iterator, clang::Redeclarable<clang::TagDecl>::redecl_iterator)
Line
Count
Source
287
249M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
288
249M
      return x.Current != y.Current;
289
249M
    }
clang::operator!=(clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator, clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator)
Line
Count
Source
287
1.96k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
288
1.96k
      return x.Current != y.Current;
289
1.96k
    }
290
  };
291
292
  using redecl_range = llvm::iterator_range<redecl_iterator>;
293
294
  /// Returns an iterator range for all the redeclarations of the same
295
  /// decl. It will iterate at least once (when this decl is the only one).
296
311M
  redecl_range redecls() const {
297
311M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
298
311M
                            static_cast<const decl_type *>(this))),
299
311M
                        redecl_iterator());
300
311M
  }
clang::Redeclarable<clang::VarDecl>::redecls() const
Line
Count
Source
296
55.4M
  redecl_range redecls() const {
297
55.4M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
298
55.4M
                            static_cast<const decl_type *>(this))),
299
55.4M
                        redecl_iterator());
300
55.4M
  }
clang::Redeclarable<clang::FunctionDecl>::redecls() const
Line
Count
Source
296
41.0M
  redecl_range redecls() const {
297
41.0M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
298
41.0M
                            static_cast<const decl_type *>(this))),
299
41.0M
                        redecl_iterator());
300
41.0M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecls() const
Line
Count
Source
296
74.6k
  redecl_range redecls() const {
297
74.6k
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
298
74.6k
                            static_cast<const decl_type *>(this))),
299
74.6k
                        redecl_iterator());
300
74.6k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecls() const
Line
Count
Source
296
18.0k
  redecl_range redecls() const {
297
18.0k
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
298
18.0k
                            static_cast<const decl_type *>(this))),
299
18.0k
                        redecl_iterator());
300
18.0k
  }
clang::Redeclarable<clang::TagDecl>::redecls() const
Line
Count
Source
296
214M
  redecl_range redecls() const {
297
214M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
298
214M
                            static_cast<const decl_type *>(this))),
299
214M
                        redecl_iterator());
300
214M
  }
clang::Redeclarable<clang::UsingShadowDecl>::redecls() const
Line
Count
Source
296
976
  redecl_range redecls() const {
297
976
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
298
976
                            static_cast<const decl_type *>(this))),
299
976
                        redecl_iterator());
300
976
  }
301
302
  redecl_iterator redecls_begin() const { return redecls().begin(); }
303
11
  redecl_iterator redecls_end() const { return redecls().end(); }
304
};
305
306
/// Get the primary declaration for a declaration from an AST file. That
307
/// will be the first-loaded declaration.
308
Decl *getPrimaryMergedDecl(Decl *D);
309
310
/// Provides common interface for the Decls that cannot be redeclared,
311
/// but can be merged if the same declaration is brought in from multiple
312
/// modules.
313
template<typename decl_type>
314
class Mergeable {
315
public:
316
  Mergeable() = default;
317
318
  /// Return the first declaration of this declaration or itself if this
319
  /// is the only declaration.
320
11.3M
  decl_type *getFirstDecl() {
321
11.3M
    auto *D = static_cast<decl_type *>(this);
322
11.3M
    if (!D->isFromASTFile())
323
9.57M
      return D;
324
1.82M
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
11.3M
  }
clang::Mergeable<clang::FieldDecl>::getFirstDecl()
Line
Count
Source
320
9.81M
  decl_type *getFirstDecl() {
321
9.81M
    auto *D = static_cast<decl_type *>(this);
322
9.81M
    if (!D->isFromASTFile())
323
8.24M
      return D;
324
1.56M
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
9.81M
  }
clang::Mergeable<clang::EnumConstantDecl>::getFirstDecl()
Line
Count
Source
320
898k
  decl_type *getFirstDecl() {
321
898k
    auto *D = static_cast<decl_type *>(this);
322
898k
    if (!D->isFromASTFile())
323
808k
      return D;
324
90.0k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
898k
  }
clang::Mergeable<clang::IndirectFieldDecl>::getFirstDecl()
Line
Count
Source
320
43.8k
  decl_type *getFirstDecl() {
321
43.8k
    auto *D = static_cast<decl_type *>(this);
322
43.8k
    if (!D->isFromASTFile())
323
11.3k
      return D;
324
32.5k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
43.8k
  }
clang::Mergeable<clang::UsingDecl>::getFirstDecl()
Line
Count
Source
320
591k
  decl_type *getFirstDecl() {
321
591k
    auto *D = static_cast<decl_type *>(this);
322
591k
    if (!D->isFromASTFile())
323
467k
      return D;
324
123k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
591k
  }
clang::Mergeable<clang::UsingEnumDecl>::getFirstDecl()
Line
Count
Source
320
149
  decl_type *getFirstDecl() {
321
149
    auto *D = static_cast<decl_type *>(this);
322
149
    if (!D->isFromASTFile())
323
145
      return D;
324
4
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
149
  }
clang::Mergeable<clang::UsingPackDecl>::getFirstDecl()
Line
Count
Source
320
64
  decl_type *getFirstDecl() {
321
64
    auto *D = static_cast<decl_type *>(this);
322
64
    if (!D->isFromASTFile())
323
52
      return D;
324
12
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
64
  }
clang::Mergeable<clang::UnresolvedUsingValueDecl>::getFirstDecl()
Line
Count
Source
320
3.86k
  decl_type *getFirstDecl() {
321
3.86k
    auto *D = static_cast<decl_type *>(this);
322
3.86k
    if (!D->isFromASTFile())
323
3.68k
      return D;
324
184
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
3.86k
  }
clang::Mergeable<clang::UnresolvedUsingTypenameDecl>::getFirstDecl()
Line
Count
Source
320
3.96k
  decl_type *getFirstDecl() {
321
3.96k
    auto *D = static_cast<decl_type *>(this);
322
3.96k
    if (!D->isFromASTFile())
323
877
      return D;
324
3.09k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
3.96k
  }
clang::Mergeable<clang::ConceptDecl>::getFirstDecl()
Line
Count
Source
320
38.1k
  decl_type *getFirstDecl() {
321
38.1k
    auto *D = static_cast<decl_type *>(this);
322
38.1k
    if (!D->isFromASTFile())
323
33.1k
      return D;
324
4.99k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
38.1k
  }
clang::Mergeable<clang::TemplateParamObjectDecl>::getFirstDecl()
Line
Count
Source
320
1.18k
  decl_type *getFirstDecl() {
321
1.18k
    auto *D = static_cast<decl_type *>(this);
322
1.18k
    if (!D->isFromASTFile())
323
1.16k
      return D;
324
20
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
1.18k
  }
326
327
  /// Return the first declaration of this declaration or itself if this
328
  /// is the only declaration.
329
1.51M
  const decl_type *getFirstDecl() const {
330
1.51M
    const auto *D = static_cast<const decl_type *>(this);
331
1.51M
    if (!D->isFromASTFile())
332
1.45M
      return D;
333
59.8k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
334
1.51M
  }
clang::Mergeable<clang::FieldDecl>::getFirstDecl() const
Line
Count
Source
329
1.51M
  const decl_type *getFirstDecl() const {
330
1.51M
    const auto *D = static_cast<const decl_type *>(this);
331
1.51M
    if (!D->isFromASTFile())
332
1.45M
      return D;
333
59.1k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
334
1.51M
  }
clang::Mergeable<clang::EnumConstantDecl>::getFirstDecl() const
Line
Count
Source
329
113
  const decl_type *getFirstDecl() const {
330
113
    const auto *D = static_cast<const decl_type *>(this);
331
113
    if (!D->isFromASTFile())
332
94
      return D;
333
19
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
334
113
  }
clang::Mergeable<clang::IndirectFieldDecl>::getFirstDecl() const
Line
Count
Source
329
62
  const decl_type *getFirstDecl() const {
330
62
    const auto *D = static_cast<const decl_type *>(this);
331
62
    if (!D->isFromASTFile())
332
41
      return D;
333
21
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
334
62
  }
clang::Mergeable<clang::UsingDecl>::getFirstDecl() const
Line
Count
Source
329
48
  const decl_type *getFirstDecl() const {
330
48
    const auto *D = static_cast<const decl_type *>(this);
331
48
    if (!D->isFromASTFile())
332
41
      return D;
333
7
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
334
48
  }
clang::Mergeable<clang::UsingEnumDecl>::getFirstDecl() const
Line
Count
Source
329
10
  const decl_type *getFirstDecl() const {
330
10
    const auto *D = static_cast<const decl_type *>(this);
331
10
    if (!D->isFromASTFile())
332
9
      return D;
333
1
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
334
10
  }
Unexecuted instantiation: clang::Mergeable<clang::UsingPackDecl>::getFirstDecl() const
clang::Mergeable<clang::UnresolvedUsingValueDecl>::getFirstDecl() const
Line
Count
Source
329
1
  const decl_type *getFirstDecl() const {
330
1
    const auto *D = static_cast<const decl_type *>(this);
331
1
    if (!D->isFromASTFile())
332
1
      return D;
333
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
334
1
  }
clang::Mergeable<clang::UnresolvedUsingTypenameDecl>::getFirstDecl() const
Line
Count
Source
329
1.09k
  const decl_type *getFirstDecl() const {
330
1.09k
    const auto *D = static_cast<const decl_type *>(this);
331
1.09k
    if (!D->isFromASTFile())
332
446
      return D;
333
651
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
334
1.09k
  }
Unexecuted instantiation: clang::Mergeable<clang::LifetimeExtendedTemporaryDecl>::getFirstDecl() const
clang::Mergeable<clang::ConceptDecl>::getFirstDecl() const
Line
Count
Source
329
6
  const decl_type *getFirstDecl() const {
330
6
    const auto *D = static_cast<const decl_type *>(this);
331
6
    if (!D->isFromASTFile())
332
6
      return D;
333
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
334
6
  }
Unexecuted instantiation: clang::Mergeable<clang::MSGuidDecl>::getFirstDecl() const
Unexecuted instantiation: clang::Mergeable<clang::TemplateParamObjectDecl>::getFirstDecl() const
Unexecuted instantiation: clang::Mergeable<clang::UnnamedGlobalConstantDecl>::getFirstDecl() const
335
336
  /// Returns true if this is the first declaration.
337
  bool isFirstDecl() const { return getFirstDecl() == this; }
338
};
339
340
/// A wrapper class around a pointer that always points to its canonical
341
/// declaration.
342
///
343
/// CanonicalDeclPtr<decl_type> behaves just like decl_type*, except we call
344
/// decl_type::getCanonicalDecl() on construction.
345
///
346
/// This is useful for hashtables that you want to be keyed on a declaration's
347
/// canonical decl -- if you use CanonicalDeclPtr as the key, you don't need to
348
/// remember to call getCanonicalDecl() everywhere.
349
template <typename decl_type> class CanonicalDeclPtr {
350
public:
351
1.66M
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::FunctionDecl>::CanonicalDeclPtr()
Line
Count
Source
351
141k
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::Decl const>::CanonicalDeclPtr()
Line
Count
Source
351
295k
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::Decl>::CanonicalDeclPtr()
Line
Count
Source
351
983k
  CanonicalDeclPtr() = default;
Unexecuted instantiation: clang::CanonicalDeclPtr<clang::VarDecl>::CanonicalDeclPtr()
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::CanonicalDeclPtr()
Line
Count
Source
351
152k
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::VarDecl const>::CanonicalDeclPtr()
Line
Count
Source
351
89.8k
  CanonicalDeclPtr() = default;
352
  CanonicalDeclPtr(decl_type *Ptr)
353
12.0M
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::Decl>::CanonicalDeclPtr(clang::Decl*)
Line
Count
Source
353
852k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::FunctionDecl>::CanonicalDeclPtr(clang::FunctionDecl*)
Line
Count
Source
353
8.41M
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::Decl const>::CanonicalDeclPtr(clang::Decl const*)
Line
Count
Source
353
2.65M
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::VarDecl>::CanonicalDeclPtr(clang::VarDecl*)
Line
Count
Source
353
106k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::CanonicalDeclPtr(clang::CXXRecordDecl const*)
Line
Count
Source
353
27.0k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::VarDecl const>::CanonicalDeclPtr(clang::VarDecl const*)
Line
Count
Source
353
24.1k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
354
  CanonicalDeclPtr(const CanonicalDeclPtr &) = default;
355
  CanonicalDeclPtr &operator=(const CanonicalDeclPtr &) = default;
356
357
88.1k
  operator decl_type *() { return Ptr; }
clang::CanonicalDeclPtr<clang::FunctionDecl>::operator clang::FunctionDecl*()
Line
Count
Source
357
66.9k
  operator decl_type *() { return Ptr; }
clang::CanonicalDeclPtr<clang::VarDecl>::operator clang::VarDecl*()
Line
Count
Source
357
1.38k
  operator decl_type *() { return Ptr; }
clang::CanonicalDeclPtr<clang::Decl const>::operator clang::Decl const*()
Line
Count
Source
357
19.7k
  operator decl_type *() { return Ptr; }
clang::CanonicalDeclPtr<clang::VarDecl const>::operator clang::VarDecl const*()
Line
Count
Source
357
42
  operator decl_type *() { return Ptr; }
358
24.4M
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::FunctionDecl>::operator clang::FunctionDecl const*() const
Line
Count
Source
358
1.08M
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::Decl const>::operator clang::Decl const*() const
Line
Count
Source
358
4.62M
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::Decl>::operator clang::Decl const*() const
Line
Count
Source
358
13.9M
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::operator clang::CXXRecordDecl const*() const
Line
Count
Source
358
3.41M
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::VarDecl const>::operator clang::VarDecl const*() const
Line
Count
Source
358
1.45M
  operator const decl_type *() const { return Ptr; }
359
360
14
  decl_type *operator->() { return Ptr; }
361
4
  const decl_type *operator->() const { return Ptr; }
362
363
  decl_type &operator*() { return *Ptr; }
364
  const decl_type &operator*() const { return *Ptr; }
365
366
2.71k
  friend bool operator==(CanonicalDeclPtr LHS, CanonicalDeclPtr RHS) {
367
2.71k
    return LHS.Ptr == RHS.Ptr;
368
2.71k
  }
369
  friend bool operator!=(CanonicalDeclPtr LHS, CanonicalDeclPtr RHS) {
370
    return LHS.Ptr != RHS.Ptr;
371
  }
372
373
private:
374
  friend struct llvm::DenseMapInfo<CanonicalDeclPtr<decl_type>>;
375
  friend struct llvm::PointerLikeTypeTraits<CanonicalDeclPtr<decl_type>>;
376
377
  decl_type *Ptr = nullptr;
378
};
379
380
} // namespace clang
381
382
namespace llvm {
383
384
template <typename decl_type>
385
struct DenseMapInfo<clang::CanonicalDeclPtr<decl_type>> {
386
  using CanonicalDeclPtr = clang::CanonicalDeclPtr<decl_type>;
387
  using BaseInfo = DenseMapInfo<decl_type *>;
388
389
1.00M
  static CanonicalDeclPtr getEmptyKey() {
390
    // Construct our CanonicalDeclPtr this way because the regular constructor
391
    // would dereference P.Ptr, which is not allowed.
392
1.00M
    CanonicalDeclPtr P;
393
1.00M
    P.Ptr = BaseInfo::getEmptyKey();
394
1.00M
    return P;
395
1.00M
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl>, void>::getEmptyKey()
Line
Count
Source
389
72.7k
  static CanonicalDeclPtr getEmptyKey() {
390
    // Construct our CanonicalDeclPtr this way because the regular constructor
391
    // would dereference P.Ptr, which is not allowed.
392
72.7k
    CanonicalDeclPtr P;
393
72.7k
    P.Ptr = BaseInfo::getEmptyKey();
394
72.7k
    return P;
395
72.7k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl const>, void>::getEmptyKey()
Line
Count
Source
389
179k
  static CanonicalDeclPtr getEmptyKey() {
390
    // Construct our CanonicalDeclPtr this way because the regular constructor
391
    // would dereference P.Ptr, which is not allowed.
392
179k
    CanonicalDeclPtr P;
393
179k
    P.Ptr = BaseInfo::getEmptyKey();
394
179k
    return P;
395
179k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl>, void>::getEmptyKey()
Line
Count
Source
389
593k
  static CanonicalDeclPtr getEmptyKey() {
390
    // Construct our CanonicalDeclPtr this way because the regular constructor
391
    // would dereference P.Ptr, which is not allowed.
392
593k
    CanonicalDeclPtr P;
393
593k
    P.Ptr = BaseInfo::getEmptyKey();
394
593k
    return P;
395
593k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const>, void>::getEmptyKey()
Line
Count
Source
389
101k
  static CanonicalDeclPtr getEmptyKey() {
390
    // Construct our CanonicalDeclPtr this way because the regular constructor
391
    // would dereference P.Ptr, which is not allowed.
392
101k
    CanonicalDeclPtr P;
393
101k
    P.Ptr = BaseInfo::getEmptyKey();
394
101k
    return P;
395
101k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::VarDecl const>, void>::getEmptyKey()
Line
Count
Source
389
56.9k
  static CanonicalDeclPtr getEmptyKey() {
390
    // Construct our CanonicalDeclPtr this way because the regular constructor
391
    // would dereference P.Ptr, which is not allowed.
392
56.9k
    CanonicalDeclPtr P;
393
56.9k
    P.Ptr = BaseInfo::getEmptyKey();
394
56.9k
    return P;
395
56.9k
  }
396
397
637k
  static CanonicalDeclPtr getTombstoneKey() {
398
637k
    CanonicalDeclPtr P;
399
637k
    P.Ptr = BaseInfo::getTombstoneKey();
400
637k
    return P;
401
637k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl>, void>::getTombstoneKey()
Line
Count
Source
397
46.8k
  static CanonicalDeclPtr getTombstoneKey() {
398
46.8k
    CanonicalDeclPtr P;
399
46.8k
    P.Ptr = BaseInfo::getTombstoneKey();
400
46.8k
    return P;
401
46.8k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl const>, void>::getTombstoneKey()
Line
Count
Source
397
116k
  static CanonicalDeclPtr getTombstoneKey() {
398
116k
    CanonicalDeclPtr P;
399
116k
    P.Ptr = BaseInfo::getTombstoneKey();
400
116k
    return P;
401
116k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl>, void>::getTombstoneKey()
Line
Count
Source
397
390k
  static CanonicalDeclPtr getTombstoneKey() {
398
390k
    CanonicalDeclPtr P;
399
390k
    P.Ptr = BaseInfo::getTombstoneKey();
400
390k
    return P;
401
390k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const>, void>::getTombstoneKey()
Line
Count
Source
397
50.9k
  static CanonicalDeclPtr getTombstoneKey() {
398
50.9k
    CanonicalDeclPtr P;
399
50.9k
    P.Ptr = BaseInfo::getTombstoneKey();
400
50.9k
    return P;
401
50.9k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::VarDecl const>, void>::getTombstoneKey()
Line
Count
Source
397
32.8k
  static CanonicalDeclPtr getTombstoneKey() {
398
32.8k
    CanonicalDeclPtr P;
399
32.8k
    P.Ptr = BaseInfo::getTombstoneKey();
400
32.8k
    return P;
401
32.8k
  }
402
403
454k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
404
454k
    return BaseInfo::getHashValue(P);
405
454k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl>, void>::getHashValue(clang::CanonicalDeclPtr<clang::FunctionDecl> const&)
Line
Count
Source
403
43.1k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
404
43.1k
    return BaseInfo::getHashValue(P);
405
43.1k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl const>, void>::getHashValue(clang::CanonicalDeclPtr<clang::Decl const> const&)
Line
Count
Source
403
56.8k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
404
56.8k
    return BaseInfo::getHashValue(P);
405
56.8k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl>, void>::getHashValue(clang::CanonicalDeclPtr<clang::Decl> const&)
Line
Count
Source
403
304k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
404
304k
    return BaseInfo::getHashValue(P);
405
304k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const>, void>::getHashValue(clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&)
Line
Count
Source
403
27.0k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
404
27.0k
    return BaseInfo::getHashValue(P);
405
27.0k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::VarDecl const>, void>::getHashValue(clang::CanonicalDeclPtr<clang::VarDecl const> const&)
Line
Count
Source
403
23.4k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
404
23.4k
    return BaseInfo::getHashValue(P);
405
23.4k
  }
406
407
  static bool isEqual(const CanonicalDeclPtr &LHS,
408
12.0M
                      const CanonicalDeclPtr &RHS) {
409
12.0M
    return BaseInfo::isEqual(LHS, RHS);
410
12.0M
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl>, void>::isEqual(clang::CanonicalDeclPtr<clang::FunctionDecl> const&, clang::CanonicalDeclPtr<clang::FunctionDecl> const&)
Line
Count
Source
408
521k
                      const CanonicalDeclPtr &RHS) {
409
521k
    return BaseInfo::isEqual(LHS, RHS);
410
521k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl const>, void>::isEqual(clang::CanonicalDeclPtr<clang::Decl const> const&, clang::CanonicalDeclPtr<clang::Decl const> const&)
Line
Count
Source
408
2.28M
                      const CanonicalDeclPtr &RHS) {
409
2.28M
    return BaseInfo::isEqual(LHS, RHS);
410
2.28M
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl>, void>::isEqual(clang::CanonicalDeclPtr<clang::Decl> const&, clang::CanonicalDeclPtr<clang::Decl> const&)
Line
Count
Source
408
6.80M
                      const CanonicalDeclPtr &RHS) {
409
6.80M
    return BaseInfo::isEqual(LHS, RHS);
410
6.80M
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const>, void>::isEqual(clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&, clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&)
Line
Count
Source
408
1.69M
                      const CanonicalDeclPtr &RHS) {
409
1.69M
    return BaseInfo::isEqual(LHS, RHS);
410
1.69M
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::VarDecl const>, void>::isEqual(clang::CanonicalDeclPtr<clang::VarDecl const> const&, clang::CanonicalDeclPtr<clang::VarDecl const> const&)
Line
Count
Source
408
715k
                      const CanonicalDeclPtr &RHS) {
409
715k
    return BaseInfo::isEqual(LHS, RHS);
410
715k
  }
411
};
412
413
template <typename decl_type>
414
struct PointerLikeTypeTraits<clang::CanonicalDeclPtr<decl_type>> {
415
270k
  static inline void *getAsVoidPointer(clang::CanonicalDeclPtr<decl_type> P) {
416
270k
    return P.Ptr;
417
270k
  }
418
  static inline clang::CanonicalDeclPtr<decl_type> getFromVoidPointer(void *P) {
419
    clang::CanonicalDeclPtr<decl_type> C;
420
    C.Ptr = PointerLikeTypeTraits<decl_type *>::getFromVoidPtr(P);
421
    return C;
422
  }
423
  static constexpr int NumLowBitsAvailable =
424
      PointerLikeTypeTraits<decl_type *>::NumLowBitsAvailable;
425
};
426
427
} // namespace llvm
428
429
#endif // LLVM_CLANG_AST_REDECLARABLE_H