Coverage Report

Created: 2022-01-18 06:27

/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
137M
        : 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.05M
        : 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
93.6k
        : 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
90.6M
        : 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
32.4M
        : 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
6.47M
        : 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
365
        : 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.22M
        : 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
352k
        : 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
282k
        : 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
25.8k
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
112
1.82M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
113
2.31M
    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
51
    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
396k
    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
227k
    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
238k
    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.17M
    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
165k
    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.60k
    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
24.4k
    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
72.8k
    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
11.1k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
114
115
554M
    bool isFirst() const {
116
554M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
554M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()294M
;
120
554M
    }
clang::Redeclarable<clang::TranslationUnitDecl>::DeclLink::isFirst() const
Line
Count
Source
115
51.0k
    bool isFirst() const {
116
51.0k
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
51.0k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()76
;
120
51.0k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::isFirst() const
Line
Count
Source
115
43.5M
    bool isFirst() const {
116
43.5M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
43.5M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()12.4M
;
120
43.5M
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::isFirst() const
Line
Count
Source
115
102M
    bool isFirst() const {
116
102M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
102M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()24.7M
;
120
102M
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::isFirst() const
Line
Count
Source
115
4.09M
    bool isFirst() const {
116
4.09M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
4.09M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()3.57M
;
120
4.09M
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::isFirst() const
Line
Count
Source
115
57.4M
    bool isFirst() const {
116
57.4M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
57.4M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()16.1M
;
120
57.4M
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::isFirst() const
Line
Count
Source
115
1.01M
    bool isFirst() const {
116
1.01M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
1.01M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()682k
;
120
1.01M
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::isFirst() const
Line
Count
Source
115
5.54M
    bool isFirst() const {
116
5.54M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
5.54M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()3.87M
;
120
5.54M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::isFirst() const
Line
Count
Source
115
339M
    bool isFirst() const {
116
339M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
339M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()232M
;
120
339M
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::isFirst() const
Line
Count
Source
115
423
    bool isFirst() const {
116
423
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
423
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()398
;
120
423
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::isFirst() const
Line
Count
Source
115
1.23M
    bool isFirst() const {
116
1.23M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
1.23M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()762k
;
120
1.23M
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::isFirst() const
Line
Count
Source
115
115k
    bool isFirst() const {
116
115k
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
115k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()60.6k
;
120
115k
    }
121
122
788M
    decl_type *getPrevious(const decl_type *D) const {
123
788M
      if (Link.is<NotKnownLatest>()) {
124
142M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
142M
        if (NKL.is<Previous>())
126
31.1M
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // Allocate the generational 'most recent' cache now, if needed.
129
111M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
111M
                               NKL.get<UninitializedLatest>()),
131
111M
                           const_cast<decl_type *>(D));
132
111M
      }
133
134
757M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
788M
    }
clang::Redeclarable<clang::TranslationUnitDecl>::DeclLink::getPrevious(clang::TranslationUnitDecl const*) const
Line
Count
Source
122
98.8M
    decl_type *getPrevious(const decl_type *D) const {
123
98.8M
      if (Link.is<NotKnownLatest>()) {
124
93.4k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
93.4k
        if (NKL.is<Previous>())
126
25
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // Allocate the generational 'most recent' cache now, if needed.
129
93.4k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
93.4k
                               NKL.get<UninitializedLatest>()),
131
93.4k
                           const_cast<decl_type *>(D));
132
93.4k
      }
133
134
98.8M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
98.8M
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::getPrevious(clang::VarDecl const*) const
Line
Count
Source
122
199M
    decl_type *getPrevious(const decl_type *D) const {
123
199M
      if (Link.is<NotKnownLatest>()) {
124
83.5M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
83.5M
        if (NKL.is<Previous>())
126
3.69M
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // Allocate the generational 'most recent' cache now, if needed.
129
79.9M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
79.9M
                               NKL.get<UninitializedLatest>()),
131
79.9M
                           const_cast<decl_type *>(D));
132
79.9M
      }
133
134
195M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
199M
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::getPrevious(clang::FunctionDecl const*) const
Line
Count
Source
122
103M
    decl_type *getPrevious(const decl_type *D) const {
123
103M
      if (Link.is<NotKnownLatest>()) {
124
31.3M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
31.3M
        if (NKL.is<Previous>())
126
1.23M
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // Allocate the generational 'most recent' cache now, if needed.
129
30.1M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
30.1M
                               NKL.get<UninitializedLatest>()),
131
30.1M
                           const_cast<decl_type *>(D));
132
30.1M
      }
133
134
101M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
103M
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::getPrevious(clang::TypedefNameDecl const*) const
Line
Count
Source
122
2.19M
    decl_type *getPrevious(const decl_type *D) const {
123
2.19M
      if (Link.is<NotKnownLatest>()) {
124
474k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
474k
        if (NKL.is<Previous>())
126
26.4k
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // Allocate the generational 'most recent' cache now, if needed.
129
448k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
448k
                               NKL.get<UninitializedLatest>()),
131
448k
                           const_cast<decl_type *>(D));
132
448k
      }
133
134
2.16M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
2.19M
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::getPrevious(clang::TagDecl const*) const
Line
Count
Source
122
333M
    decl_type *getPrevious(const decl_type *D) const {
123
333M
      if (Link.is<NotKnownLatest>()) {
124
3.44M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
3.44M
        if (NKL.is<Previous>())
126
3.44M
          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
330M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
333M
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::getPrevious(clang::UsingShadowDecl const*) const
Line
Count
Source
122
1.07M
    decl_type *getPrevious(const decl_type *D) const {
123
1.07M
      if (Link.is<NotKnownLatest>()) {
124
17.5k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
17.5k
        if (NKL.is<Previous>())
126
17.5k
          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.05M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
1.07M
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::getPrevious(clang::ObjCProtocolDecl const*) const
Line
Count
Source
122
250k
    decl_type *getPrevious(const decl_type *D) const {
123
250k
      if (Link.is<NotKnownLatest>()) {
124
14.6k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
14.6k
        if (NKL.is<Previous>())
126
14.6k
          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
235k
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
250k
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::getPrevious(clang::ObjCInterfaceDecl const*) const
Line
Count
Source
122
1.13M
    decl_type *getPrevious(const decl_type *D) const {
123
1.13M
      if (Link.is<NotKnownLatest>()) {
124
343k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
343k
        if (NKL.is<Previous>())
126
343k
          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
793k
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
1.13M
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::getPrevious(clang::RedeclarableTemplateDecl const*) const
Line
Count
Source
122
20.1M
    decl_type *getPrevious(const decl_type *D) const {
123
20.1M
      if (Link.is<NotKnownLatest>()) {
124
1.17M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
1.17M
        if (NKL.is<Previous>())
126
453k
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // Allocate the generational 'most recent' cache now, if needed.
129
723k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
723k
                               NKL.get<UninitializedLatest>()),
131
723k
                           const_cast<decl_type *>(D));
132
723k
      }
133
134
19.6M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
20.1M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::getPrevious(clang::NamespaceDecl const*) const
Line
Count
Source
122
28.2M
    decl_type *getPrevious(const decl_type *D) const {
123
28.2M
      if (Link.is<NotKnownLatest>()) {
124
21.9M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
21.9M
        if (NKL.is<Previous>())
126
21.9M
          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
6.33M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
28.2M
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::getPrevious(clang::NamespaceAliasDecl const*) const
Line
Count
Source
122
239
    decl_type *getPrevious(const decl_type *D) const {
123
239
      if (Link.is<NotKnownLatest>()) {
124
81
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
81
        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
67
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
67
                               NKL.get<UninitializedLatest>()),
131
67
                           const_cast<decl_type *>(D));
132
67
      }
133
134
225
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
239
    }
136
137
1.33M
    void setPrevious(decl_type *D) {
138
1.33M
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
0
      Link = Previous(D);
140
1.33M
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::setPrevious(clang::VarDecl*)
Line
Count
Source
137
7.81k
    void setPrevious(decl_type *D) {
138
7.81k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
0
      Link = Previous(D);
140
7.81k
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::setPrevious(clang::FunctionDecl*)
Line
Count
Source
137
112k
    void setPrevious(decl_type *D) {
138
112k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
0
      Link = Previous(D);
140
112k
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::setPrevious(clang::NamespaceDecl*)
Line
Count
Source
137
923k
    void setPrevious(decl_type *D) {
138
923k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
0
      Link = Previous(D);
140
923k
    }
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.1k
    void setPrevious(decl_type *D) {
138
42.1k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
0
      Link = Previous(D);
140
42.1k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::setPrevious(clang::ObjCProtocolDecl*)
Line
Count
Source
137
651
    void setPrevious(decl_type *D) {
138
651
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
0
      Link = Previous(D);
140
651
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::setPrevious(clang::RedeclarableTemplateDecl*)
Line
Count
Source
137
123k
    void setPrevious(decl_type *D) {
138
123k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
0
      Link = Previous(D);
140
123k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::setPrevious(clang::TagDecl*)
Line
Count
Source
137
104k
    void setPrevious(decl_type *D) {
138
104k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
0
      Link = Previous(D);
140
104k
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::setPrevious(clang::TypedefNameDecl*)
Line
Count
Source
137
18.1k
    void setPrevious(decl_type *D) {
138
18.1k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
0
      Link = Previous(D);
140
18.1k
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::setPrevious(clang::UsingShadowDecl*)
Line
Count
Source
137
4.71k
    void setPrevious(decl_type *D) {
138
4.71k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
0
      Link = Previous(D);
140
4.71k
    }
Unexecuted instantiation: clang::Redeclarable<clang::TranslationUnitDecl>::DeclLink::setPrevious(clang::TranslationUnitDecl*)
141
142
13.5M
    void setLatest(decl_type *D) {
143
13.5M
      assert(isFirst() && "decl became canonical unexpectedly");
144
13.5M
      if (Link.is<NotKnownLatest>()) {
145
11.2M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
11.2M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
11.2M
                               NKL.get<UninitializedLatest>()),
148
11.2M
                           D);
149
11.2M
      } else {
150
2.34M
        auto Latest = Link.get<KnownLatest>();
151
2.34M
        Latest.set(D);
152
2.34M
        Link = Latest;
153
2.34M
      }
154
13.5M
    }
clang::Redeclarable<clang::TranslationUnitDecl>::DeclLink::setLatest(clang::TranslationUnitDecl*)
Line
Count
Source
142
53
    void setLatest(decl_type *D) {
143
53
      assert(isFirst() && "decl became canonical unexpectedly");
144
53
      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
53
      } else {
150
53
        auto Latest = Link.get<KnownLatest>();
151
53
        Latest.set(D);
152
53
        Link = Latest;
153
53
      }
154
53
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::setLatest(clang::FunctionDecl*)
Line
Count
Source
142
1.08M
    void setLatest(decl_type *D) {
143
1.08M
      assert(isFirst() && "decl became canonical unexpectedly");
144
1.08M
      if (Link.is<NotKnownLatest>()) {
145
800k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
800k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
800k
                               NKL.get<UninitializedLatest>()),
148
800k
                           D);
149
800k
      } else {
150
286k
        auto Latest = Link.get<KnownLatest>();
151
286k
        Latest.set(D);
152
286k
        Link = Latest;
153
286k
      }
154
1.08M
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::setLatest(clang::RedeclarableTemplateDecl*)
Line
Count
Source
142
747k
    void setLatest(decl_type *D) {
143
747k
      assert(isFirst() && "decl became canonical unexpectedly");
144
747k
      if (Link.is<NotKnownLatest>()) {
145
642k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
642k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
642k
                               NKL.get<UninitializedLatest>()),
148
642k
                           D);
149
642k
      } else {
150
104k
        auto Latest = Link.get<KnownLatest>();
151
104k
        Latest.set(D);
152
104k
        Link = Latest;
153
104k
      }
154
747k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::setLatest(clang::TagDecl*)
Line
Count
Source
142
7.83M
    void setLatest(decl_type *D) {
143
7.83M
      assert(isFirst() && "decl became canonical unexpectedly");
144
7.83M
      if (Link.is<NotKnownLatest>()) {
145
6.35M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
6.35M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
6.35M
                               NKL.get<UninitializedLatest>()),
148
6.35M
                           D);
149
6.35M
      } else {
150
1.47M
        auto Latest = Link.get<KnownLatest>();
151
1.47M
        Latest.set(D);
152
1.47M
        Link = Latest;
153
1.47M
      }
154
7.83M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::setLatest(clang::NamespaceDecl*)
Line
Count
Source
142
1.24M
    void setLatest(decl_type *D) {
143
1.24M
      assert(isFirst() && "decl became canonical unexpectedly");
144
1.24M
      if (Link.is<NotKnownLatest>()) {
145
980k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
980k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
980k
                               NKL.get<UninitializedLatest>()),
148
980k
                           D);
149
980k
      } else {
150
260k
        auto Latest = Link.get<KnownLatest>();
151
260k
        Latest.set(D);
152
260k
        Link = Latest;
153
260k
      }
154
1.24M
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::setLatest(clang::ObjCInterfaceDecl*)
Line
Count
Source
142
290k
    void setLatest(decl_type *D) {
143
290k
      assert(isFirst() && "decl became canonical unexpectedly");
144
290k
      if (Link.is<NotKnownLatest>()) {
145
158k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
158k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
158k
                               NKL.get<UninitializedLatest>()),
148
158k
                           D);
149
158k
      } else {
150
131k
        auto Latest = Link.get<KnownLatest>();
151
131k
        Latest.set(D);
152
131k
        Link = Latest;
153
131k
      }
154
290k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::setLatest(clang::ObjCProtocolDecl*)
Line
Count
Source
142
27.8k
    void setLatest(decl_type *D) {
143
27.8k
      assert(isFirst() && "decl became canonical unexpectedly");
144
27.8k
      if (Link.is<NotKnownLatest>()) {
145
20.8k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
20.8k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
20.8k
                               NKL.get<UninitializedLatest>()),
148
20.8k
                           D);
149
20.8k
      } else {
150
6.99k
        auto Latest = Link.get<KnownLatest>();
151
6.99k
        Latest.set(D);
152
6.99k
        Link = Latest;
153
6.99k
      }
154
27.8k
    }
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
269k
    void setLatest(decl_type *D) {
143
269k
      assert(isFirst() && "decl became canonical unexpectedly");
144
269k
      if (Link.is<NotKnownLatest>()) {
145
261k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
261k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
261k
                               NKL.get<UninitializedLatest>()),
148
261k
                           D);
149
261k
      } else {
150
8.04k
        auto Latest = Link.get<KnownLatest>();
151
8.04k
        Latest.set(D);
152
8.04k
        Link = Latest;
153
8.04k
      }
154
269k
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::setLatest(clang::UsingShadowDecl*)
Line
Count
Source
142
336k
    void setLatest(decl_type *D) {
143
336k
      assert(isFirst() && "decl became canonical unexpectedly");
144
336k
      if (Link.is<NotKnownLatest>()) {
145
329k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
329k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
329k
                               NKL.get<UninitializedLatest>()),
148
329k
                           D);
149
329k
      } else {
150
6.49k
        auto Latest = Link.get<KnownLatest>();
151
6.49k
        Latest.set(D);
152
6.49k
        Link = Latest;
153
6.49k
      }
154
336k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::setLatest(clang::VarDecl*)
Line
Count
Source
142
1.72M
    void setLatest(decl_type *D) {
143
1.72M
      assert(isFirst() && "decl became canonical unexpectedly");
144
1.72M
      if (Link.is<NotKnownLatest>()) {
145
1.66M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
1.66M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
1.66M
                               NKL.get<UninitializedLatest>()),
148
1.66M
                           D);
149
1.66M
      } else {
150
65.9k
        auto Latest = Link.get<KnownLatest>();
151
65.9k
        Latest.set(D);
152
65.9k
        Link = Latest;
153
65.9k
      }
154
1.72M
    }
155
156
514k
    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.37k
    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
11.9k
    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
476k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::VarDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
26
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::TranslationUnitDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
19.3k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
157
158
462k
    Decl *getLatestNotUpdated() const {
159
462k
      assert(isFirst() && "expected a canonical decl");
160
462k
      if (Link.is<NotKnownLatest>())
161
1.64k
        return nullptr;
162
460k
      return Link.get<KnownLatest>().getNotUpdated();
163
462k
    }
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.48k
    Decl *getLatestNotUpdated() const {
159
7.48k
      assert(isFirst() && "expected a canonical decl");
160
7.48k
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
7.48k
      return Link.get<KnownLatest>().getNotUpdated();
163
7.48k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
2.02k
    Decl *getLatestNotUpdated() const {
159
2.02k
      assert(isFirst() && "expected a canonical decl");
160
2.02k
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
2.02k
      return Link.get<KnownLatest>().getNotUpdated();
163
2.02k
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
395k
    Decl *getLatestNotUpdated() const {
159
395k
      assert(isFirst() && "expected a canonical decl");
160
395k
      if (Link.is<NotKnownLatest>())
161
9
        return nullptr;
162
395k
      return Link.get<KnownLatest>().getNotUpdated();
163
395k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
49.2k
    Decl *getLatestNotUpdated() const {
159
49.2k
      assert(isFirst() && "expected a canonical decl");
160
49.2k
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
49.2k
      return Link.get<KnownLatest>().getNotUpdated();
163
49.2k
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
3.37k
    Decl *getLatestNotUpdated() const {
159
3.37k
      assert(isFirst() && "expected a canonical decl");
160
3.37k
      if (Link.is<NotKnownLatest>())
161
1.64k
        return nullptr;
162
1.73k
      return Link.get<KnownLatest>().getNotUpdated();
163
3.37k
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
24
    Decl *getLatestNotUpdated() const {
159
24
      assert(isFirst() && "expected a canonical decl");
160
24
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
24
      return Link.get<KnownLatest>().getNotUpdated();
163
24
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
1.36k
    Decl *getLatestNotUpdated() const {
159
1.36k
      assert(isFirst() && "expected a canonical decl");
160
1.36k
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
1.36k
      return Link.get<KnownLatest>().getNotUpdated();
163
1.36k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
863
    Decl *getLatestNotUpdated() const {
159
863
      assert(isFirst() && "expected a canonical decl");
160
863
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
863
      return Link.get<KnownLatest>().getNotUpdated();
163
863
    }
Unexecuted instantiation: clang::Redeclarable<clang::TranslationUnitDecl>::DeclLink::getLatestNotUpdated() const
164
  };
165
166
2.31M
  static DeclLink PreviousDeclLink(decl_type *D) {
167
2.31M
    return DeclLink(DeclLink::PreviousLink, D);
168
2.31M
  }
clang::Redeclarable<clang::TranslationUnitDecl>::PreviousDeclLink(clang::TranslationUnitDecl*)
Line
Count
Source
166
51
  static DeclLink PreviousDeclLink(decl_type *D) {
167
51
    return DeclLink(DeclLink::PreviousLink, D);
168
51
  }
clang::Redeclarable<clang::FunctionDecl>::PreviousDeclLink(clang::FunctionDecl*)
Line
Count
Source
166
396k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
396k
    return DeclLink(DeclLink::PreviousLink, D);
168
396k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::PreviousDeclLink(clang::RedeclarableTemplateDecl*)
Line
Count
Source
166
227k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
227k
    return DeclLink(DeclLink::PreviousLink, D);
168
227k
  }
clang::Redeclarable<clang::TagDecl>::PreviousDeclLink(clang::TagDecl*)
Line
Count
Source
166
238k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
238k
    return DeclLink(DeclLink::PreviousLink, D);
168
238k
  }
clang::Redeclarable<clang::NamespaceDecl>::PreviousDeclLink(clang::NamespaceDecl*)
Line
Count
Source
166
1.17M
  static DeclLink PreviousDeclLink(decl_type *D) {
167
1.17M
    return DeclLink(DeclLink::PreviousLink, D);
168
1.17M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::PreviousDeclLink(clang::ObjCInterfaceDecl*)
Line
Count
Source
166
165k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
165k
    return DeclLink(DeclLink::PreviousLink, D);
168
165k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::PreviousDeclLink(clang::ObjCProtocolDecl*)
Line
Count
Source
166
5.60k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
5.60k
    return DeclLink(DeclLink::PreviousLink, D);
168
5.60k
  }
clang::Redeclarable<clang::TypedefNameDecl>::PreviousDeclLink(clang::TypedefNameDecl*)
Line
Count
Source
166
24.4k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
24.4k
    return DeclLink(DeclLink::PreviousLink, D);
168
24.4k
  }
clang::Redeclarable<clang::VarDecl>::PreviousDeclLink(clang::VarDecl*)
Line
Count
Source
166
72.8k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
72.8k
    return DeclLink(DeclLink::PreviousLink, D);
168
72.8k
  }
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
11.1k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
11.1k
    return DeclLink(DeclLink::PreviousLink, D);
168
11.1k
  }
169
170
137M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
137M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
137M
  }
clang::Redeclarable<clang::TypedefNameDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
4.05M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
4.05M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
4.05M
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
365
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
365
    return DeclLink(DeclLink::LatestLink, Ctx);
172
365
  }
clang::Redeclarable<clang::TranslationUnitDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
93.6k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
93.6k
    return DeclLink(DeclLink::LatestLink, Ctx);
172
93.6k
  }
clang::Redeclarable<clang::VarDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
90.6M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
90.6M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
90.6M
  }
clang::Redeclarable<clang::FunctionDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
32.4M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
32.4M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
32.4M
  }
clang::Redeclarable<clang::TagDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
6.47M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
6.47M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
6.47M
  }
clang::Redeclarable<clang::NamespaceDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
1.22M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
1.22M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
1.22M
  }
clang::Redeclarable<clang::UsingShadowDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
352k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
352k
    return DeclLink(DeclLink::LatestLink, Ctx);
172
352k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
282k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
282k
    return DeclLink(DeclLink::LatestLink, Ctx);
172
282k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
25.8k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
25.8k
    return DeclLink(DeclLink::LatestLink, Ctx);
172
25.8k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
1.82M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
1.82M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
1.82M
  }
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
788M
  decl_type *getNextRedeclaration() const {
190
788M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
788M
  }
clang::Redeclarable<clang::TranslationUnitDecl>::getNextRedeclaration() const
Line
Count
Source
189
98.8M
  decl_type *getNextRedeclaration() const {
190
98.8M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
98.8M
  }
clang::Redeclarable<clang::VarDecl>::getNextRedeclaration() const
Line
Count
Source
189
199M
  decl_type *getNextRedeclaration() const {
190
199M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
199M
  }
clang::Redeclarable<clang::FunctionDecl>::getNextRedeclaration() const
Line
Count
Source
189
103M
  decl_type *getNextRedeclaration() const {
190
103M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
103M
  }
clang::Redeclarable<clang::TypedefNameDecl>::getNextRedeclaration() const
Line
Count
Source
189
2.19M
  decl_type *getNextRedeclaration() const {
190
2.19M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
2.19M
  }
clang::Redeclarable<clang::TagDecl>::getNextRedeclaration() const
Line
Count
Source
189
333M
  decl_type *getNextRedeclaration() const {
190
333M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
333M
  }
clang::Redeclarable<clang::UsingShadowDecl>::getNextRedeclaration() const
Line
Count
Source
189
1.07M
  decl_type *getNextRedeclaration() const {
190
1.07M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
1.07M
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getNextRedeclaration() const
Line
Count
Source
189
250k
  decl_type *getNextRedeclaration() const {
190
250k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
250k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getNextRedeclaration() const
Line
Count
Source
189
1.13M
  decl_type *getNextRedeclaration() const {
190
1.13M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
1.13M
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getNextRedeclaration() const
Line
Count
Source
189
20.1M
  decl_type *getNextRedeclaration() const {
190
20.1M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
20.1M
  }
clang::Redeclarable<clang::NamespaceDecl>::getNextRedeclaration() const
Line
Count
Source
189
28.2M
  decl_type *getNextRedeclaration() const {
190
28.2M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
28.2M
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getNextRedeclaration() const
Line
Count
Source
189
239
  decl_type *getNextRedeclaration() const {
190
239
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
239
  }
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
137M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::TypedefNameDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
4.05M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::TranslationUnitDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
93.5k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::VarDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
90.6M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::FunctionDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
32.4M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::TagDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
6.47M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::NamespaceAliasDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
365
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::NamespaceDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
1.22M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::UsingShadowDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
352k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
282k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
25.8k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::RedeclarableTemplateDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
1.82M
        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
81.0M
  decl_type *getPreviousDecl() {
205
81.0M
    if (!RedeclLink.isFirst())
206
1.64M
      return getNextRedeclaration();
207
79.4M
    return nullptr;
208
81.0M
  }
clang::Redeclarable<clang::TranslationUnitDecl>::getPreviousDecl()
Line
Count
Source
204
50.9k
  decl_type *getPreviousDecl() {
205
50.9k
    if (!RedeclLink.isFirst())
206
25
      return getNextRedeclaration();
207
50.9k
    return nullptr;
208
50.9k
  }
clang::Redeclarable<clang::VarDecl>::getPreviousDecl()
Line
Count
Source
204
10.6M
  decl_type *getPreviousDecl() {
205
10.6M
    if (!RedeclLink.isFirst())
206
26.1k
      return getNextRedeclaration();
207
10.5M
    return nullptr;
208
10.6M
  }
clang::Redeclarable<clang::FunctionDecl>::getPreviousDecl()
Line
Count
Source
204
55.0M
  decl_type *getPreviousDecl() {
205
55.0M
    if (!RedeclLink.isFirst())
206
328k
      return getNextRedeclaration();
207
54.6M
    return nullptr;
208
55.0M
  }
clang::Redeclarable<clang::TypedefNameDecl>::getPreviousDecl()
Line
Count
Source
204
3.55M
  decl_type *getPreviousDecl() {
205
3.55M
    if (!RedeclLink.isFirst())
206
18.5k
      return getNextRedeclaration();
207
3.53M
    return nullptr;
208
3.55M
  }
clang::Redeclarable<clang::TagDecl>::getPreviousDecl()
Line
Count
Source
204
7.62M
  decl_type *getPreviousDecl() {
205
7.62M
    if (!RedeclLink.isFirst())
206
402k
      return getNextRedeclaration();
207
7.21M
    return nullptr;
208
7.62M
  }
clang::Redeclarable<clang::UsingShadowDecl>::getPreviousDecl()
Line
Count
Source
204
321k
  decl_type *getPreviousDecl() {
205
321k
    if (!RedeclLink.isFirst())
206
7.03k
      return getNextRedeclaration();
207
314k
    return nullptr;
208
321k
  }
clang::Redeclarable<clang::NamespaceDecl>::getPreviousDecl()
Line
Count
Source
204
369k
  decl_type *getPreviousDecl() {
205
369k
    if (!RedeclLink.isFirst())
206
308k
      return getNextRedeclaration();
207
61.5k
    return nullptr;
208
369k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getPreviousDecl()
Line
Count
Source
204
345
  decl_type *getPreviousDecl() {
205
345
    if (!RedeclLink.isFirst())
206
12
      return getNextRedeclaration();
207
333
    return nullptr;
208
345
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getPreviousDecl()
Line
Count
Source
204
333k
  decl_type *getPreviousDecl() {
205
333k
    if (!RedeclLink.isFirst())
206
204k
      return getNextRedeclaration();
207
128k
    return nullptr;
208
333k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getPreviousDecl()
Line
Count
Source
204
29.2k
  decl_type *getPreviousDecl() {
205
29.2k
    if (!RedeclLink.isFirst())
206
7.96k
      return getNextRedeclaration();
207
21.2k
    return nullptr;
208
29.2k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getPreviousDecl()
Line
Count
Source
204
3.18M
  decl_type *getPreviousDecl() {
205
3.18M
    if (!RedeclLink.isFirst())
206
337k
      return getNextRedeclaration();
207
2.85M
    return nullptr;
208
3.18M
  }
209
4.36M
  const decl_type *getPreviousDecl() const {
210
4.36M
    return const_cast<decl_type *>(
211
4.36M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
4.36M
  }
clang::Redeclarable<clang::VarDecl>::getPreviousDecl() const
Line
Count
Source
209
1.21M
  const decl_type *getPreviousDecl() const {
210
1.21M
    return const_cast<decl_type *>(
211
1.21M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
1.21M
  }
clang::Redeclarable<clang::FunctionDecl>::getPreviousDecl() const
Line
Count
Source
209
2.01M
  const decl_type *getPreviousDecl() const {
210
2.01M
    return const_cast<decl_type *>(
211
2.01M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
2.01M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getPreviousDecl() const
Line
Count
Source
209
32.5k
  const decl_type *getPreviousDecl() const {
210
32.5k
    return const_cast<decl_type *>(
211
32.5k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
32.5k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getPreviousDecl() const
Line
Count
Source
209
1.09M
  const decl_type *getPreviousDecl() const {
210
1.09M
    return const_cast<decl_type *>(
211
1.09M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
1.09M
  }
clang::Redeclarable<clang::NamespaceDecl>::getPreviousDecl() const
Line
Count
Source
209
186
  const decl_type *getPreviousDecl() const {
210
186
    return const_cast<decl_type *>(
211
186
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
186
  }
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.14k
  const decl_type *getPreviousDecl() const {
210
4.14k
    return const_cast<decl_type *>(
211
4.14k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
4.14k
  }
clang::Redeclarable<clang::TypedefNameDecl>::getPreviousDecl() const
Line
Count
Source
209
3.27k
  const decl_type *getPreviousDecl() const {
210
3.27k
    return const_cast<decl_type *>(
211
3.27k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
3.27k
  }
clang::Redeclarable<clang::UsingShadowDecl>::getPreviousDecl() const
Line
Count
Source
209
83
  const decl_type *getPreviousDecl() const {
210
83
    return const_cast<decl_type *>(
211
83
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
83
  }
clang::Redeclarable<clang::TranslationUnitDecl>::getPreviousDecl() const
Line
Count
Source
209
507
  const decl_type *getPreviousDecl() const {
210
507
    return const_cast<decl_type *>(
211
507
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
507
  }
213
214
  /// Return the first declaration of this declaration or itself if this
215
  /// is the only declaration.
216
2.34G
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::TranslationUnitDecl>::getFirstDecl()
Line
Count
Source
216
844M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::VarDecl>::getFirstDecl()
Line
Count
Source
216
220M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::FunctionDecl>::getFirstDecl()
Line
Count
Source
216
692M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::TypedefNameDecl>::getFirstDecl()
Line
Count
Source
216
132M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::TagDecl>::getFirstDecl()
Line
Count
Source
216
342M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::NamespaceAliasDecl>::getFirstDecl()
Line
Count
Source
216
437
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::UsingShadowDecl>::getFirstDecl()
Line
Count
Source
216
3.01M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getFirstDecl()
Line
Count
Source
216
92.0M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::NamespaceDecl>::getFirstDecl()
Line
Count
Source
216
7.11M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getFirstDecl()
Line
Count
Source
216
6.46M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::ObjCProtocolDecl>::getFirstDecl()
Line
Count
Source
216
311k
  decl_type *getFirstDecl() { return First; }
217
218
  /// Return the first declaration of this declaration or itself if this
219
  /// is the only declaration.
220
61.1M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::TypedefNameDecl>::getFirstDecl() const
Line
Count
Source
220
109
  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.21k
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getFirstDecl() const
Line
Count
Source
220
61.4k
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::VarDecl>::getFirstDecl() const
Line
Count
Source
220
18.5M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::FunctionDecl>::getFirstDecl() const
Line
Count
Source
220
36.5M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::TagDecl>::getFirstDecl() const
Line
Count
Source
220
268k
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getFirstDecl() const
Line
Count
Source
220
5.62M
  const decl_type *getFirstDecl() const { return First; }
221
222
  /// True if this is the first declaration in its redeclaration chain.
223
448M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::TagDecl>::isFirstDecl() const
Line
Count
Source
223
35.2M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::VarDecl>::isFirstDecl() const
Line
Count
Source
223
31.0M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::FunctionDecl>::isFirstDecl() const
Line
Count
Source
223
46.1M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::NamespaceDecl>::isFirstDecl() const
Line
Count
Source
223
335M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::ObjCInterfaceDecl>::isFirstDecl() const
Line
Count
Source
223
155k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::ObjCProtocolDecl>::isFirstDecl() const
Line
Count
Source
223
25.1k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::TypedefNameDecl>::isFirstDecl() const
Line
Count
Source
223
238k
  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
19.3k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::isFirstDecl() const
Line
Count
Source
223
630k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
224
225
  /// Returns the most recent (re)declaration of this declaration.
226
570M
  decl_type *getMostRecentDecl() {
227
570M
    return getFirstDecl()->getNextRedeclaration();
228
570M
  }
clang::Redeclarable<clang::TranslationUnitDecl>::getMostRecentDecl()
Line
Count
Source
226
98.8M
  decl_type *getMostRecentDecl() {
227
98.8M
    return getFirstDecl()->getNextRedeclaration();
228
98.8M
  }
clang::Redeclarable<clang::VarDecl>::getMostRecentDecl()
Line
Count
Source
226
79.5M
  decl_type *getMostRecentDecl() {
227
79.5M
    return getFirstDecl()->getNextRedeclaration();
228
79.5M
  }
clang::Redeclarable<clang::FunctionDecl>::getMostRecentDecl()
Line
Count
Source
226
71.4M
  decl_type *getMostRecentDecl() {
227
71.4M
    return getFirstDecl()->getNextRedeclaration();
228
71.4M
  }
clang::Redeclarable<clang::TypedefNameDecl>::getMostRecentDecl()
Line
Count
Source
226
1.78M
  decl_type *getMostRecentDecl() {
227
1.78M
    return getFirstDecl()->getNextRedeclaration();
228
1.78M
  }
clang::Redeclarable<clang::TagDecl>::getMostRecentDecl()
Line
Count
Source
226
298M
  decl_type *getMostRecentDecl() {
227
298M
    return getFirstDecl()->getNextRedeclaration();
228
298M
  }
clang::Redeclarable<clang::UsingShadowDecl>::getMostRecentDecl()
Line
Count
Source
226
720k
  decl_type *getMostRecentDecl() {
227
720k
    return getFirstDecl()->getNextRedeclaration();
228
720k
  }
clang::Redeclarable<clang::NamespaceDecl>::getMostRecentDecl()
Line
Count
Source
226
5.93M
  decl_type *getMostRecentDecl() {
227
5.93M
    return getFirstDecl()->getNextRedeclaration();
228
5.93M
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getMostRecentDecl()
Line
Count
Source
226
129
  decl_type *getMostRecentDecl() {
227
129
    return getFirstDecl()->getNextRedeclaration();
228
129
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getMostRecentDecl()
Line
Count
Source
226
525k
  decl_type *getMostRecentDecl() {
227
525k
    return getFirstDecl()->getNextRedeclaration();
228
525k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getMostRecentDecl()
Line
Count
Source
226
209k
  decl_type *getMostRecentDecl() {
227
209k
    return getFirstDecl()->getNextRedeclaration();
228
209k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getMostRecentDecl()
Line
Count
Source
226
13.0M
  decl_type *getMostRecentDecl() {
227
13.0M
    return getFirstDecl()->getNextRedeclaration();
228
13.0M
  }
229
230
  /// Returns the most recent (re)declaration of this declaration.
231
6.31M
  const decl_type *getMostRecentDecl() const {
232
6.31M
    return getFirstDecl()->getNextRedeclaration();
233
6.31M
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getMostRecentDecl() const
Line
Count
Source
231
1.41k
  const decl_type *getMostRecentDecl() const {
232
1.41k
    return getFirstDecl()->getNextRedeclaration();
233
1.41k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getMostRecentDecl() const
Line
Count
Source
231
61.4k
  const decl_type *getMostRecentDecl() const {
232
61.4k
    return getFirstDecl()->getNextRedeclaration();
233
61.4k
  }
clang::Redeclarable<clang::FunctionDecl>::getMostRecentDecl() const
Line
Count
Source
231
672k
  const decl_type *getMostRecentDecl() const {
232
672k
    return getFirstDecl()->getNextRedeclaration();
233
672k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getMostRecentDecl() const
Line
Count
Source
231
5.57M
  const decl_type *getMostRecentDecl() const {
232
5.57M
    return getFirstDecl()->getNextRedeclaration();
233
5.57M
  }
clang::Redeclarable<clang::VarDecl>::getMostRecentDecl() const
Line
Count
Source
231
1.18k
  const decl_type *getMostRecentDecl() const {
232
1.18k
    return getFirstDecl()->getNextRedeclaration();
233
1.18k
  }
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
279M
    redecl_iterator() = default;
clang::Redeclarable<clang::VarDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
49.6M
    redecl_iterator() = default;
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
33.8M
    redecl_iterator() = default;
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
73.7k
    redecl_iterator() = default;
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
17.8k
    redecl_iterator() = default;
clang::Redeclarable<clang::TagDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
195M
    redecl_iterator() = default;
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
961
    redecl_iterator() = default;
254
279M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::VarDecl>::redecl_iterator::redecl_iterator(clang::VarDecl*)
Line
Count
Source
254
49.6M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::redecl_iterator(clang::FunctionDecl*)
Line
Count
Source
254
33.8M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::redecl_iterator(clang::ObjCInterfaceDecl*)
Line
Count
Source
254
73.7k
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::redecl_iterator(clang::ObjCProtocolDecl*)
Line
Count
Source
254
17.8k
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::TagDecl>::redecl_iterator::redecl_iterator(clang::TagDecl*)
Line
Count
Source
254
195M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::redecl_iterator(clang::UsingShadowDecl*)
Line
Count
Source
254
961
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
255
256
297M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::VarDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
56.5M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
35.0M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
107k
    reference operator*() const { return Current; }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
22.5k
    reference operator*() const { return Current; }
clang::Redeclarable<clang::TagDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
205M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
969
    reference operator*() const { return Current; }
257
    pointer operator->() const { return Current; }
258
259
78.2M
    redecl_iterator& operator++() {
260
78.2M
      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
78.2M
      if (Current->isFirstDecl()) {
264
71.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
71.1M
        PassedFirst = true;
270
71.1M
      }
271
272
      // Get either previous decl or latest decl.
273
78.2M
      decl_type *Next = Current->getNextRedeclaration();
274
78.2M
      Current = (Next != Starter) ? 
Next18.3M
:
nullptr59.9M
;
275
78.2M
      return *this;
276
78.2M
    }
clang::Redeclarable<clang::VarDecl>::redecl_iterator::operator++()
Line
Count
Source
259
28.4M
    redecl_iterator& operator++() {
260
28.4M
      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
28.4M
      if (Current->isFirstDecl()) {
264
24.7M
        if (PassedFirst) {
265
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
266
0
          Current = nullptr;
267
0
          return *this;
268
0
        }
269
24.7M
        PassedFirst = true;
270
24.7M
      }
271
272
      // Get either previous decl or latest decl.
273
28.4M
      decl_type *Next = Current->getNextRedeclaration();
274
28.4M
      Current = (Next != Starter) ? 
Next6.94M
:
nullptr21.4M
;
275
28.4M
      return *this;
276
28.4M
    }
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::operator++()
Line
Count
Source
259
17.6M
    redecl_iterator& operator++() {
260
17.6M
      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
17.6M
      if (Current->isFirstDecl()) {
264
16.9M
        if (PassedFirst) {
265
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
266
0
          Current = nullptr;
267
0
          return *this;
268
0
        }
269
16.9M
        PassedFirst = true;
270
16.9M
      }
271
272
      // Get either previous decl or latest decl.
273
17.6M
      decl_type *Next = Current->getNextRedeclaration();
274
17.6M
      Current = (Next != Starter) ? 
Next1.18M
:
nullptr16.5M
;
275
17.6M
      return *this;
276
17.6M
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::operator++()
Line
Count
Source
259
107k
    redecl_iterator& operator++() {
260
107k
      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
107k
      if (Current->isFirstDecl()) {
264
73.7k
        if (PassedFirst) {
265
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
266
0
          Current = nullptr;
267
0
          return *this;
268
0
        }
269
73.7k
        PassedFirst = true;
270
73.7k
      }
271
272
      // Get either previous decl or latest decl.
273
107k
      decl_type *Next = Current->getNextRedeclaration();
274
107k
      Current = (Next != Starter) ? 
Next33.4k
:
nullptr73.7k
;
275
107k
      return *this;
276
107k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::operator++()
Line
Count
Source
259
22.5k
    redecl_iterator& operator++() {
260
22.5k
      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.5k
      if (Current->isFirstDecl()) {
264
17.8k
        if (PassedFirst) {
265
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
266
0
          Current = nullptr;
267
0
          return *this;
268
0
        }
269
17.8k
        PassedFirst = true;
270
17.8k
      }
271
272
      // Get either previous decl or latest decl.
273
22.5k
      decl_type *Next = Current->getNextRedeclaration();
274
22.5k
      Current = (Next != Starter) ? 
Next4.70k
:
nullptr17.8k
;
275
22.5k
      return *this;
276
22.5k
    }
clang::Redeclarable<clang::TagDecl>::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
29.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
29.2M
        PassedFirst = true;
270
29.2M
      }
271
272
      // Get either previous decl or latest decl.
273
32.0M
      decl_type *Next = Current->getNextRedeclaration();
274
32.0M
      Current = (Next != Starter) ? 
Next10.2M
:
nullptr21.8M
;
275
32.0M
      return *this;
276
32.0M
    }
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::operator++()
Line
Count
Source
259
969
    redecl_iterator& operator++() {
260
969
      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
969
      if (Current->isFirstDecl()) {
264
961
        if (PassedFirst) {
265
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
266
0
          Current = nullptr;
267
0
          return *this;
268
0
        }
269
961
        PassedFirst = true;
270
961
      }
271
272
      // Get either previous decl or latest decl.
273
969
      decl_type *Next = Current->getNextRedeclaration();
274
969
      Current = (Next != Starter) ? 
Next8
:
nullptr961
;
275
969
      return *this;
276
969
    }
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
357M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
288
357M
      return x.Current != y.Current;
289
357M
    }
clang::operator!=(clang::Redeclarable<clang::VarDecl>::redecl_iterator, clang::Redeclarable<clang::VarDecl>::redecl_iterator)
Line
Count
Source
287
78.0M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
288
78.0M
      return x.Current != y.Current;
289
78.0M
    }
clang::operator!=(clang::Redeclarable<clang::FunctionDecl>::redecl_iterator, clang::Redeclarable<clang::FunctionDecl>::redecl_iterator)
Line
Count
Source
287
51.5M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
288
51.5M
      return x.Current != y.Current;
289
51.5M
    }
clang::operator!=(clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator, clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator)
Line
Count
Source
287
180k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
288
180k
      return x.Current != y.Current;
289
180k
    }
clang::operator!=(clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator, clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator)
Line
Count
Source
287
40.3k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
288
40.3k
      return x.Current != y.Current;
289
40.3k
    }
clang::operator!=(clang::Redeclarable<clang::TagDecl>::redecl_iterator, clang::Redeclarable<clang::TagDecl>::redecl_iterator)
Line
Count
Source
287
227M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
288
227M
      return x.Current != y.Current;
289
227M
    }
clang::operator!=(clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator, clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator)
Line
Count
Source
287
1.93k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
288
1.93k
      return x.Current != y.Current;
289
1.93k
    }
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
279M
  redecl_range redecls() const {
297
279M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
298
279M
                            static_cast<const decl_type *>(this))),
299
279M
                        redecl_iterator());
300
279M
  }
clang::Redeclarable<clang::VarDecl>::redecls() const
Line
Count
Source
296
49.6M
  redecl_range redecls() const {
297
49.6M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
298
49.6M
                            static_cast<const decl_type *>(this))),
299
49.6M
                        redecl_iterator());
300
49.6M
  }
clang::Redeclarable<clang::FunctionDecl>::redecls() const
Line
Count
Source
296
33.8M
  redecl_range redecls() const {
297
33.8M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
298
33.8M
                            static_cast<const decl_type *>(this))),
299
33.8M
                        redecl_iterator());
300
33.8M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecls() const
Line
Count
Source
296
73.7k
  redecl_range redecls() const {
297
73.7k
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
298
73.7k
                            static_cast<const decl_type *>(this))),
299
73.7k
                        redecl_iterator());
300
73.7k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecls() const
Line
Count
Source
296
17.8k
  redecl_range redecls() const {
297
17.8k
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
298
17.8k
                            static_cast<const decl_type *>(this))),
299
17.8k
                        redecl_iterator());
300
17.8k
  }
clang::Redeclarable<clang::TagDecl>::redecls() const
Line
Count
Source
296
195M
  redecl_range redecls() const {
297
195M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
298
195M
                            static_cast<const decl_type *>(this))),
299
195M
                        redecl_iterator());
300
195M
  }
clang::Redeclarable<clang::UsingShadowDecl>::redecls() const
Line
Count
Source
296
961
  redecl_range redecls() const {
297
961
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
298
961
                            static_cast<const decl_type *>(this))),
299
961
                        redecl_iterator());
300
961
  }
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
9.85M
  decl_type *getFirstDecl() {
321
9.85M
    auto *D = static_cast<decl_type *>(this);
322
9.85M
    if (!D->isFromASTFile())
323
9.10M
      return D;
324
753k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
9.85M
  }
clang::Mergeable<clang::FieldDecl>::getFirstDecl()
Line
Count
Source
320
8.56M
  decl_type *getFirstDecl() {
321
8.56M
    auto *D = static_cast<decl_type *>(this);
322
8.56M
    if (!D->isFromASTFile())
323
7.90M
      return D;
324
660k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
8.56M
  }
clang::Mergeable<clang::EnumConstantDecl>::getFirstDecl()
Line
Count
Source
320
781k
  decl_type *getFirstDecl() {
321
781k
    auto *D = static_cast<decl_type *>(this);
322
781k
    if (!D->isFromASTFile())
323
747k
      return D;
324
34.2k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
781k
  }
clang::Mergeable<clang::IndirectFieldDecl>::getFirstDecl()
Line
Count
Source
320
15.4k
  decl_type *getFirstDecl() {
321
15.4k
    auto *D = static_cast<decl_type *>(this);
322
15.4k
    if (!D->isFromASTFile())
323
8.45k
      return D;
324
7.02k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
15.4k
  }
clang::Mergeable<clang::UsingDecl>::getFirstDecl()
Line
Count
Source
320
485k
  decl_type *getFirstDecl() {
321
485k
    auto *D = static_cast<decl_type *>(this);
322
485k
    if (!D->isFromASTFile())
323
437k
      return D;
324
48.1k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
485k
  }
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
24
  decl_type *getFirstDecl() {
321
24
    auto *D = static_cast<decl_type *>(this);
322
24
    if (!D->isFromASTFile())
323
12
      return D;
324
12
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
24
  }
clang::Mergeable<clang::UnresolvedUsingValueDecl>::getFirstDecl()
Line
Count
Source
320
1.83k
  decl_type *getFirstDecl() {
321
1.83k
    auto *D = static_cast<decl_type *>(this);
322
1.83k
    if (!D->isFromASTFile())
323
1.65k
      return D;
324
185
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
1.83k
  }
clang::Mergeable<clang::UnresolvedUsingTypenameDecl>::getFirstDecl()
Line
Count
Source
320
3.30k
  decl_type *getFirstDecl() {
321
3.30k
    auto *D = static_cast<decl_type *>(this);
322
3.30k
    if (!D->isFromASTFile())
323
861
      return D;
324
2.44k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
3.30k
  }
clang::Mergeable<clang::ConceptDecl>::getFirstDecl()
Line
Count
Source
320
2.19k
  decl_type *getFirstDecl() {
321
2.19k
    auto *D = static_cast<decl_type *>(this);
322
2.19k
    if (!D->isFromASTFile())
323
2.12k
      return D;
324
72
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
2.19k
  }
clang::Mergeable<clang::TemplateParamObjectDecl>::getFirstDecl()
Line
Count
Source
320
936
  decl_type *getFirstDecl() {
321
936
    auto *D = static_cast<decl_type *>(this);
322
936
    if (!D->isFromASTFile())
323
916
      return D;
324
20
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
936
  }
326
327
  /// Return the first declaration of this declaration or itself if this
328
  /// is the only declaration.
329
1.52M
  const decl_type *getFirstDecl() const {
330
1.52M
    const auto *D = static_cast<const decl_type *>(this);
331
1.52M
    if (!D->isFromASTFile())
332
1.46M
      return D;
333
55.4k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
334
1.52M
  }
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.46M
      return D;
333
54.8k
    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
43
  const decl_type *getFirstDecl() const {
330
43
    const auto *D = static_cast<const decl_type *>(this);
331
43
    if (!D->isFromASTFile())
332
36
      return D;
333
7
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
334
43
  }
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
958
  const decl_type *getFirstDecl() const {
330
958
    const auto *D = static_cast<const decl_type *>(this);
331
958
    if (!D->isFromASTFile())
332
376
      return D;
333
582
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
334
958
  }
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
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.46M
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::FunctionDecl>::CanonicalDeclPtr()
Line
Count
Source
351
140k
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::Decl const>::CanonicalDeclPtr()
Line
Count
Source
351
294k
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::Decl>::CanonicalDeclPtr()
Line
Count
Source
351
808k
  CanonicalDeclPtr() = default;
Unexecuted instantiation: clang::CanonicalDeclPtr<clang::VarDecl>::CanonicalDeclPtr()
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::CanonicalDeclPtr()
Line
Count
Source
351
131k
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::VarDecl const>::CanonicalDeclPtr()
Line
Count
Source
351
89.4k
  CanonicalDeclPtr() = default;
352
  CanonicalDeclPtr(decl_type *Ptr)
353
11.0M
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::Decl>::CanonicalDeclPtr(clang::Decl*)
Line
Count
Source
353
752k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::FunctionDecl>::CanonicalDeclPtr(clang::FunctionDecl*)
Line
Count
Source
353
7.54M
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::Decl const>::CanonicalDeclPtr(clang::Decl const*)
Line
Count
Source
353
2.55M
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::VarDecl>::CanonicalDeclPtr(clang::VarDecl*)
Line
Count
Source
353
97.7k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::CanonicalDeclPtr(clang::CXXRecordDecl const*)
Line
Count
Source
353
23.5k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::VarDecl const>::CanonicalDeclPtr(clang::VarDecl const*)
Line
Count
Source
353
24.0k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
354
  CanonicalDeclPtr(const CanonicalDeclPtr &) = default;
355
  CanonicalDeclPtr &operator=(const CanonicalDeclPtr &) = default;
356
357
87.5k
  operator decl_type *() { return Ptr; }
clang::CanonicalDeclPtr<clang::FunctionDecl>::operator clang::FunctionDecl*()
Line
Count
Source
357
66.8k
  operator decl_type *() { return Ptr; }
clang::CanonicalDeclPtr<clang::VarDecl>::operator clang::VarDecl*()
Line
Count
Source
357
1.11k
  operator decl_type *() { return Ptr; }
clang::CanonicalDeclPtr<clang::Decl const>::operator clang::Decl const*()
Line
Count
Source
357
19.6k
  operator decl_type *() { return Ptr; }
clang::CanonicalDeclPtr<clang::VarDecl const>::operator clang::VarDecl const*()
Line
Count
Source
357
24
  operator decl_type *() { return Ptr; }
358
22.1M
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::FunctionDecl>::operator clang::FunctionDecl const*() const
Line
Count
Source
358
1.06M
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::Decl const>::operator clang::Decl const*() const
Line
Count
Source
358
4.60M
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::Decl>::operator clang::Decl const*() const
Line
Count
Source
358
12.1M
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::operator clang::CXXRecordDecl const*() const
Line
Count
Source
358
2.92M
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::VarDecl const>::operator clang::VarDecl const*() const
Line
Count
Source
358
1.44M
  operator const decl_type *() const { return Ptr; }
359
360
  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.07k
  friend bool operator==(CanonicalDeclPtr LHS, CanonicalDeclPtr RHS) {
367
2.07k
    return LHS.Ptr == RHS.Ptr;
368
2.07k
  }
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
890k
  static CanonicalDeclPtr getEmptyKey() {
390
    // Construct our CanonicalDeclPtr this way because the regular constructor
391
    // would dereference P.Ptr, which is not allowed.
392
890k
    CanonicalDeclPtr P;
393
890k
    P.Ptr = BaseInfo::getEmptyKey();
394
890k
    return P;
395
890k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl>, void>::getEmptyKey()
Line
Count
Source
389
72.3k
  static CanonicalDeclPtr getEmptyKey() {
390
    // Construct our CanonicalDeclPtr this way because the regular constructor
391
    // would dereference P.Ptr, which is not allowed.
392
72.3k
    CanonicalDeclPtr P;
393
72.3k
    P.Ptr = BaseInfo::getEmptyKey();
394
72.3k
    return P;
395
72.3k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl const>, void>::getEmptyKey()
Line
Count
Source
389
178k
  static CanonicalDeclPtr getEmptyKey() {
390
    // Construct our CanonicalDeclPtr this way because the regular constructor
391
    // would dereference P.Ptr, which is not allowed.
392
178k
    CanonicalDeclPtr P;
393
178k
    P.Ptr = BaseInfo::getEmptyKey();
394
178k
    return P;
395
178k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl>, void>::getEmptyKey()
Line
Count
Source
389
495k
  static CanonicalDeclPtr getEmptyKey() {
390
    // Construct our CanonicalDeclPtr this way because the regular constructor
391
    // would dereference P.Ptr, which is not allowed.
392
495k
    CanonicalDeclPtr P;
393
495k
    P.Ptr = BaseInfo::getEmptyKey();
394
495k
    return P;
395
495k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const>, void>::getEmptyKey()
Line
Count
Source
389
87.9k
  static CanonicalDeclPtr getEmptyKey() {
390
    // Construct our CanonicalDeclPtr this way because the regular constructor
391
    // would dereference P.Ptr, which is not allowed.
392
87.9k
    CanonicalDeclPtr P;
393
87.9k
    P.Ptr = BaseInfo::getEmptyKey();
394
87.9k
    return P;
395
87.9k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::VarDecl const>, void>::getEmptyKey()
Line
Count
Source
389
56.7k
  static CanonicalDeclPtr getEmptyKey() {
390
    // Construct our CanonicalDeclPtr this way because the regular constructor
391
    // would dereference P.Ptr, which is not allowed.
392
56.7k
    CanonicalDeclPtr P;
393
56.7k
    P.Ptr = BaseInfo::getEmptyKey();
394
56.7k
    return P;
395
56.7k
  }
396
397
552k
  static CanonicalDeclPtr getTombstoneKey() {
398
552k
    CanonicalDeclPtr P;
399
552k
    P.Ptr = BaseInfo::getTombstoneKey();
400
552k
    return P;
401
552k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl>, void>::getTombstoneKey()
Line
Count
Source
397
46.5k
  static CanonicalDeclPtr getTombstoneKey() {
398
46.5k
    CanonicalDeclPtr P;
399
46.5k
    P.Ptr = BaseInfo::getTombstoneKey();
400
46.5k
    return P;
401
46.5k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl const>, void>::getTombstoneKey()
Line
Count
Source
397
115k
  static CanonicalDeclPtr getTombstoneKey() {
398
115k
    CanonicalDeclPtr P;
399
115k
    P.Ptr = BaseInfo::getTombstoneKey();
400
115k
    return P;
401
115k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl>, void>::getTombstoneKey()
Line
Count
Source
397
313k
  static CanonicalDeclPtr getTombstoneKey() {
398
313k
    CanonicalDeclPtr P;
399
313k
    P.Ptr = BaseInfo::getTombstoneKey();
400
313k
    return P;
401
313k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const>, void>::getTombstoneKey()
Line
Count
Source
397
43.9k
  static CanonicalDeclPtr getTombstoneKey() {
398
43.9k
    CanonicalDeclPtr P;
399
43.9k
    P.Ptr = BaseInfo::getTombstoneKey();
400
43.9k
    return P;
401
43.9k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::VarDecl const>, void>::getTombstoneKey()
Line
Count
Source
397
32.6k
  static CanonicalDeclPtr getTombstoneKey() {
398
32.6k
    CanonicalDeclPtr P;
399
32.6k
    P.Ptr = BaseInfo::getTombstoneKey();
400
32.6k
    return P;
401
32.6k
  }
402
403
382k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
404
382k
    return BaseInfo::getHashValue(P);
405
382k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl>, void>::getHashValue(clang::CanonicalDeclPtr<clang::FunctionDecl> const&)
Line
Count
Source
403
42.8k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
404
42.8k
    return BaseInfo::getHashValue(P);
405
42.8k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl const>, void>::getHashValue(clang::CanonicalDeclPtr<clang::Decl const> const&)
Line
Count
Source
403
56.4k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
404
56.4k
    return BaseInfo::getHashValue(P);
405
56.4k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl>, void>::getHashValue(clang::CanonicalDeclPtr<clang::Decl> const&)
Line
Count
Source
403
236k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
404
236k
    return BaseInfo::getHashValue(P);
405
236k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const>, void>::getHashValue(clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&)
Line
Count
Source
403
23.5k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
404
23.5k
    return BaseInfo::getHashValue(P);
405
23.5k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::VarDecl const>, void>::getHashValue(clang::CanonicalDeclPtr<clang::VarDecl const> const&)
Line
Count
Source
403
23.3k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
404
23.3k
    return BaseInfo::getHashValue(P);
405
23.3k
  }
406
407
  static bool isEqual(const CanonicalDeclPtr &LHS,
408
10.9M
                      const CanonicalDeclPtr &RHS) {
409
10.9M
    return BaseInfo::isEqual(LHS, RHS);
410
10.9M
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl>, void>::isEqual(clang::CanonicalDeclPtr<clang::FunctionDecl> const&, clang::CanonicalDeclPtr<clang::FunctionDecl> const&)
Line
Count
Source
408
512k
                      const CanonicalDeclPtr &RHS) {
409
512k
    return BaseInfo::isEqual(LHS, RHS);
410
512k
  }
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.27M
                      const CanonicalDeclPtr &RHS) {
409
2.27M
    return BaseInfo::isEqual(LHS, RHS);
410
2.27M
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl>, void>::isEqual(clang::CanonicalDeclPtr<clang::Decl> const&, clang::CanonicalDeclPtr<clang::Decl> const&)
Line
Count
Source
408
5.96M
                      const CanonicalDeclPtr &RHS) {
409
5.96M
    return BaseInfo::isEqual(LHS, RHS);
410
5.96M
  }
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.44M
                      const CanonicalDeclPtr &RHS) {
409
1.44M
    return BaseInfo::isEqual(LHS, RHS);
410
1.44M
  }
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
711k
                      const CanonicalDeclPtr &RHS) {
409
711k
    return BaseInfo::isEqual(LHS, RHS);
410
711k
  }
411
};
412
413
template <typename decl_type>
414
struct PointerLikeTypeTraits<clang::CanonicalDeclPtr<decl_type>> {
415
263k
  static inline void *getAsVoidPointer(clang::CanonicalDeclPtr<decl_type> P) {
416
263k
    return P.Ptr;
417
263k
  }
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