Coverage Report

Created: 2023-11-11 10:31

/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
170M
        : 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
3.83M
        : 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
98.0k
        : 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
114M
        : 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
41.9M
        : 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
5.54M
        : 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
384
        : 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.73M
        : 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
559k
        : 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
247k
        : 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.9k
        : 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.92M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
113
2.74M
    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
468
    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
491k
    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
153k
    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
166k
    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.67M
    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
135k
    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.90k
    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
16.1k
    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
87.6k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::PreviousTag, clang::NamespaceAliasDecl*)
Line
Count
Source
113
16
    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.5k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
114
115
868M
    bool isFirst() const {
116
868M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
868M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()475M
;
120
868M
    }
clang::Redeclarable<clang::TranslationUnitDecl>::DeclLink::isFirst() const
Line
Count
Source
115
57.5k
    bool isFirst() const {
116
57.5k
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
57.5k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()570
;
120
57.5k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::isFirst() const
Line
Count
Source
115
73.7M
    bool isFirst() const {
116
73.7M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
73.7M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()15.1M
;
120
73.7M
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::isFirst() const
Line
Count
Source
115
166M
    bool isFirst() const {
116
166M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
166M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()31.4M
;
120
166M
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::isFirst() const
Line
Count
Source
115
3.76M
    bool isFirst() const {
116
3.76M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
3.76M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()3.44M
;
120
3.76M
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::isFirst() const
Line
Count
Source
115
61.2M
    bool isFirst() const {
116
61.2M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
61.2M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()14.0M
;
120
61.2M
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::isFirst() const
Line
Count
Source
115
1.68M
    bool isFirst() const {
116
1.68M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
1.68M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()1.11M
;
120
1.68M
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::isFirst() const
Line
Count
Source
115
5.38M
    bool isFirst() const {
116
5.38M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
5.38M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()4.10M
;
120
5.38M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::isFirst() const
Line
Count
Source
115
555M
    bool isFirst() const {
116
555M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
555M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()405M
;
120
555M
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::isFirst() const
Line
Count
Source
115
443
    bool isFirst() const {
116
443
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
443
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()416
;
120
443
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::isFirst() const
Line
Count
Source
115
1.05M
    bool isFirst() const {
116
1.05M
      return Link.is<KnownLatest>() ||
117
             // FIXME: 'template' is required on the next line due to an
118
             // apparent clang bug.
119
1.05M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()594k
;
120
1.05M
    }
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>()61.5k
;
120
115k
    }
121
122
1.09G
    decl_type *getPrevious(const decl_type *D) const {
123
1.09G
      if (Link.is<NotKnownLatest>()) {
124
302M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
302M
        if (NKL.is<Previous>())
126
159M
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // Allocate the generational 'most recent' cache now, if needed.
129
143M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
143M
                               NKL.get<UninitializedLatest>()),
131
143M
                           const_cast<decl_type *>(D));
132
143M
      }
133
134
939M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
1.09G
    }
clang::Redeclarable<clang::TranslationUnitDecl>::DeclLink::getPrevious(clang::TranslationUnitDecl const*) const
Line
Count
Source
122
115M
    decl_type *getPrevious(const decl_type *D) const {
123
115M
      if (Link.is<NotKnownLatest>()) {
124
97.5k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
97.5k
        if (NKL.is<Previous>())
126
102
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // Allocate the generational 'most recent' cache now, if needed.
129
97.4k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
97.4k
                               NKL.get<UninitializedLatest>()),
131
97.4k
                           const_cast<decl_type *>(D));
132
97.4k
      }
133
134
115M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
115M
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::getPrevious(clang::VarDecl const*) const
Line
Count
Source
122
277M
    decl_type *getPrevious(const decl_type *D) const {
123
277M
      if (Link.is<NotKnownLatest>()) {
124
107M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
107M
        if (NKL.is<Previous>())
126
6.23M
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // Allocate the generational 'most recent' cache now, if needed.
129
101M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
101M
                               NKL.get<UninitializedLatest>()),
131
101M
                           const_cast<decl_type *>(D));
132
101M
      }
133
134
271M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
277M
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::getPrevious(clang::FunctionDecl const*) const
Line
Count
Source
122
146M
    decl_type *getPrevious(const decl_type *D) const {
123
146M
      if (Link.is<NotKnownLatest>()) {
124
41.8M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
41.8M
        if (NKL.is<Previous>())
126
1.57M
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // Allocate the generational 'most recent' cache now, if needed.
129
40.2M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
40.2M
                               NKL.get<UninitializedLatest>()),
131
40.2M
                           const_cast<decl_type *>(D));
132
40.2M
      }
133
134
144M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
146M
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::getPrevious(clang::TypedefNameDecl const*) const
Line
Count
Source
122
1.73M
    decl_type *getPrevious(const decl_type *D) const {
123
1.73M
      if (Link.is<NotKnownLatest>()) {
124
404k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
404k
        if (NKL.is<Previous>())
126
22.4k
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // Allocate the generational 'most recent' cache now, if needed.
129
381k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
381k
                               NKL.get<UninitializedLatest>()),
131
381k
                           const_cast<decl_type *>(D));
132
381k
      }
133
134
1.71M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
1.73M
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::getPrevious(clang::TagDecl const*) const
Line
Count
Source
122
377M
    decl_type *getPrevious(const decl_type *D) const {
123
377M
      if (Link.is<NotKnownLatest>()) {
124
3.19M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
3.19M
        if (NKL.is<Previous>())
126
3.19M
          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
374M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
377M
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::getPrevious(clang::UsingShadowDecl const*) const
Line
Count
Source
122
1.31M
    decl_type *getPrevious(const decl_type *D) const {
123
1.31M
      if (Link.is<NotKnownLatest>()) {
124
25.7k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
25.7k
        if (NKL.is<Previous>())
126
25.6k
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // Allocate the generational 'most recent' cache now, if needed.
129
24
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
24
                               NKL.get<UninitializedLatest>()),
131
24
                           const_cast<decl_type *>(D));
132
24
      }
133
134
1.29M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
1.31M
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::getPrevious(clang::ObjCProtocolDecl const*) const
Line
Count
Source
122
238k
    decl_type *getPrevious(const decl_type *D) const {
123
238k
      if (Link.is<NotKnownLatest>()) {
124
15.6k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
15.6k
        if (NKL.is<Previous>())
126
15.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
223k
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
238k
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::getPrevious(clang::ObjCInterfaceDecl const*) const
Line
Count
Source
122
1.02M
    decl_type *getPrevious(const decl_type *D) const {
123
1.02M
      if (Link.is<NotKnownLatest>()) {
124
294k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
294k
        if (NKL.is<Previous>())
126
294k
          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
732k
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
1.02M
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::getPrevious(clang::RedeclarableTemplateDecl const*) const
Line
Count
Source
122
25.0M
    decl_type *getPrevious(const decl_type *D) const {
123
25.0M
      if (Link.is<NotKnownLatest>()) {
124
2.20M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
2.20M
        if (NKL.is<Previous>())
126
1.19M
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // Allocate the generational 'most recent' cache now, if needed.
129
1.01M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
1.01M
                               NKL.get<UninitializedLatest>()),
131
1.01M
                           const_cast<decl_type *>(D));
132
1.01M
      }
133
134
23.8M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
25.0M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::getPrevious(clang::NamespaceDecl const*) const
Line
Count
Source
122
152M
    decl_type *getPrevious(const decl_type *D) const {
123
152M
      if (Link.is<NotKnownLatest>()) {
124
146M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
146M
        if (NKL.is<Previous>())
126
146M
          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
5.81M
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
152M
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::getPrevious(clang::NamespaceAliasDecl const*) const
Line
Count
Source
122
255
    decl_type *getPrevious(const decl_type *D) const {
123
255
      if (Link.is<NotKnownLatest>()) {
124
88
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
88
        if (NKL.is<Previous>())
126
15
          return static_cast<decl_type*>(NKL.get<Previous>());
127
128
        // Allocate the generational 'most recent' cache now, if needed.
129
73
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
73
                               NKL.get<UninitializedLatest>()),
131
73
                           const_cast<decl_type *>(D));
132
73
      }
133
134
240
      return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
135
255
    }
136
137
1.24M
    void setPrevious(decl_type *D) {
138
1.24M
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
1.24M
      Link = Previous(D);
140
1.24M
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::setPrevious(clang::VarDecl*)
Line
Count
Source
137
15.1k
    void setPrevious(decl_type *D) {
138
15.1k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
15.1k
      Link = Previous(D);
140
15.1k
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::setPrevious(clang::FunctionDecl*)
Line
Count
Source
137
44.1k
    void setPrevious(decl_type *D) {
138
44.1k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
44.1k
      Link = Previous(D);
140
44.1k
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::setPrevious(clang::NamespaceDecl*)
Line
Count
Source
137
1.10M
    void setPrevious(decl_type *D) {
138
1.10M
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
1.10M
      Link = Previous(D);
140
1.10M
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::setPrevious(clang::NamespaceAliasDecl*)
Line
Count
Source
137
3
    void setPrevious(decl_type *D) {
138
3
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
3
      Link = Previous(D);
140
3
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::setPrevious(clang::ObjCInterfaceDecl*)
Line
Count
Source
137
9.61k
    void setPrevious(decl_type *D) {
138
9.61k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
9.61k
      Link = Previous(D);
140
9.61k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::setPrevious(clang::ObjCProtocolDecl*)
Line
Count
Source
137
781
    void setPrevious(decl_type *D) {
138
781
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
781
      Link = Previous(D);
140
781
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::setPrevious(clang::RedeclarableTemplateDecl*)
Line
Count
Source
137
27.4k
    void setPrevious(decl_type *D) {
138
27.4k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
27.4k
      Link = Previous(D);
140
27.4k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::setPrevious(clang::TagDecl*)
Line
Count
Source
137
31.9k
    void setPrevious(decl_type *D) {
138
31.9k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
31.9k
      Link = Previous(D);
140
31.9k
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::setPrevious(clang::TypedefNameDecl*)
Line
Count
Source
137
10.7k
    void setPrevious(decl_type *D) {
138
10.7k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
10.7k
      Link = Previous(D);
140
10.7k
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::setPrevious(clang::UsingShadowDecl*)
Line
Count
Source
137
1.37k
    void setPrevious(decl_type *D) {
138
1.37k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
1.37k
      Link = Previous(D);
140
1.37k
    }
Unexecuted instantiation: clang::Redeclarable<clang::TranslationUnitDecl>::DeclLink::setPrevious(clang::TranslationUnitDecl*)
141
142
11.0M
    void setLatest(decl_type *D) {
143
11.0M
      assert(isFirst() && "decl became canonical unexpectedly");
144
11.0M
      if (Link.is<NotKnownLatest>()) {
145
8.52M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
8.52M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
8.52M
                               NKL.get<UninitializedLatest>()),
148
8.52M
                           D);
149
8.52M
      } else {
150
2.55M
        auto Latest = Link.get<KnownLatest>();
151
2.55M
        Latest.set(D);
152
2.55M
        Link = Latest;
153
2.55M
      }
154
11.0M
    }
clang::Redeclarable<clang::TranslationUnitDecl>::DeclLink::setLatest(clang::TranslationUnitDecl*)
Line
Count
Source
142
468
    void setLatest(decl_type *D) {
143
468
      assert(isFirst() && "decl became canonical unexpectedly");
144
468
      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
468
      } else {
150
468
        auto Latest = Link.get<KnownLatest>();
151
468
        Latest.set(D);
152
468
        Link = Latest;
153
468
      }
154
468
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::setLatest(clang::FunctionDecl*)
Line
Count
Source
142
668k
    void setLatest(decl_type *D) {
143
668k
      assert(isFirst() && "decl became canonical unexpectedly");
144
668k
      if (Link.is<NotKnownLatest>()) {
145
192k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
192k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
192k
                               NKL.get<UninitializedLatest>()),
148
192k
                           D);
149
475k
      } else {
150
475k
        auto Latest = Link.get<KnownLatest>();
151
475k
        Latest.set(D);
152
475k
        Link = Latest;
153
475k
      }
154
668k
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::setLatest(clang::RedeclarableTemplateDecl*)
Line
Count
Source
142
570k
    void setLatest(decl_type *D) {
143
570k
      assert(isFirst() && "decl became canonical unexpectedly");
144
570k
      if (Link.is<NotKnownLatest>()) {
145
438k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
438k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
438k
                               NKL.get<UninitializedLatest>()),
148
438k
                           D);
149
438k
      } else {
150
132k
        auto Latest = Link.get<KnownLatest>();
151
132k
        Latest.set(D);
152
132k
        Link = Latest;
153
132k
      }
154
570k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::setLatest(clang::TagDecl*)
Line
Count
Source
142
5.85M
    void setLatest(decl_type *D) {
143
5.85M
      assert(isFirst() && "decl became canonical unexpectedly");
144
5.85M
      if (Link.is<NotKnownLatest>()) {
145
5.40M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
5.40M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
5.40M
                               NKL.get<UninitializedLatest>()),
148
5.40M
                           D);
149
5.40M
      } else {
150
446k
        auto Latest = Link.get<KnownLatest>();
151
446k
        Latest.set(D);
152
446k
        Link = Latest;
153
446k
      }
154
5.85M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::setLatest(clang::NamespaceDecl*)
Line
Count
Source
142
2.42M
    void setLatest(decl_type *D) {
143
2.42M
      assert(isFirst() && "decl became canonical unexpectedly");
144
2.42M
      if (Link.is<NotKnownLatest>()) {
145
1.16M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
1.16M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
1.16M
                               NKL.get<UninitializedLatest>()),
148
1.16M
                           D);
149
1.25M
      } else {
150
1.25M
        auto Latest = Link.get<KnownLatest>();
151
1.25M
        Latest.set(D);
152
1.25M
        Link = Latest;
153
1.25M
      }
154
2.42M
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::setLatest(clang::ObjCInterfaceDecl*)
Line
Count
Source
142
250k
    void setLatest(decl_type *D) {
143
250k
      assert(isFirst() && "decl became canonical unexpectedly");
144
250k
      if (Link.is<NotKnownLatest>()) {
145
121k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
121k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
121k
                               NKL.get<UninitializedLatest>()),
148
121k
                           D);
149
129k
      } else {
150
129k
        auto Latest = Link.get<KnownLatest>();
151
129k
        Latest.set(D);
152
129k
        Link = Latest;
153
129k
      }
154
250k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::setLatest(clang::ObjCProtocolDecl*)
Line
Count
Source
142
27.1k
    void setLatest(decl_type *D) {
143
27.1k
      assert(isFirst() && "decl became canonical unexpectedly");
144
27.1k
      if (Link.is<NotKnownLatest>()) {
145
20.7k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
20.7k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
20.7k
                               NKL.get<UninitializedLatest>()),
148
20.7k
                           D);
149
20.7k
      } else {
150
6.34k
        auto Latest = Link.get<KnownLatest>();
151
6.34k
        Latest.set(D);
152
6.34k
        Link = Latest;
153
6.34k
      }
154
27.1k
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::setLatest(clang::NamespaceAliasDecl*)
Line
Count
Source
142
31
    void setLatest(decl_type *D) {
143
31
      assert(isFirst() && "decl became canonical unexpectedly");
144
31
      if (Link.is<NotKnownLatest>()) {
145
15
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
15
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
15
                               NKL.get<UninitializedLatest>()),
148
15
                           D);
149
16
      } else {
150
16
        auto Latest = Link.get<KnownLatest>();
151
16
        Latest.set(D);
152
16
        Link = Latest;
153
16
      }
154
31
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::setLatest(clang::TypedefNameDecl*)
Line
Count
Source
142
81.4k
    void setLatest(decl_type *D) {
143
81.4k
      assert(isFirst() && "decl became canonical unexpectedly");
144
81.4k
      if (Link.is<NotKnownLatest>()) {
145
67.9k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
67.9k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
67.9k
                               NKL.get<UninitializedLatest>()),
148
67.9k
                           D);
149
67.9k
      } else {
150
13.4k
        auto Latest = Link.get<KnownLatest>();
151
13.4k
        Latest.set(D);
152
13.4k
        Link = Latest;
153
13.4k
      }
154
81.4k
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::setLatest(clang::UsingShadowDecl*)
Line
Count
Source
142
558k
    void setLatest(decl_type *D) {
143
558k
      assert(isFirst() && "decl became canonical unexpectedly");
144
558k
      if (Link.is<NotKnownLatest>()) {
145
546k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
546k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
546k
                               NKL.get<UninitializedLatest>()),
148
546k
                           D);
149
546k
      } else {
150
11.2k
        auto Latest = Link.get<KnownLatest>();
151
11.2k
        Latest.set(D);
152
11.2k
        Link = Latest;
153
11.2k
      }
154
558k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::setLatest(clang::VarDecl*)
Line
Count
Source
142
648k
    void setLatest(decl_type *D) {
143
648k
      assert(isFirst() && "decl became canonical unexpectedly");
144
648k
      if (Link.is<NotKnownLatest>()) {
145
561k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
561k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
561k
                               NKL.get<UninitializedLatest>()),
148
561k
                           D);
149
561k
      } else {
150
86.9k
        auto Latest = Link.get<KnownLatest>();
151
86.9k
        Latest.set(D);
152
86.9k
        Link = Latest;
153
86.9k
      }
154
648k
    }
155
156
161k
    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
3.34k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
2
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
3
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::TagDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
14.0k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
84
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
Unexecuted instantiation: clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::markIncomplete()
clang::Redeclarable<clang::FunctionDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
115k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::VarDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
1.35k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::TranslationUnitDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
28.0k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
157
158
881k
    Decl *getLatestNotUpdated() const {
159
881k
      assert(isFirst() && "expected a canonical decl");
160
881k
      if (Link.is<NotKnownLatest>())
161
610
        return nullptr;
162
881k
      return Link.get<KnownLatest>().getNotUpdated();
163
881k
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
680k
    Decl *getLatestNotUpdated() const {
159
680k
      assert(isFirst() && "expected a canonical decl");
160
680k
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
680k
      return Link.get<KnownLatest>().getNotUpdated();
163
680k
    }
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
3.40k
    Decl *getLatestNotUpdated() const {
159
3.40k
      assert(isFirst() && "expected a canonical decl");
160
3.40k
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
3.40k
      return Link.get<KnownLatest>().getNotUpdated();
163
3.40k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
1.21k
    Decl *getLatestNotUpdated() const {
159
1.21k
      assert(isFirst() && "expected a canonical decl");
160
1.21k
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
1.21k
      return Link.get<KnownLatest>().getNotUpdated();
163
1.21k
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
115k
    Decl *getLatestNotUpdated() const {
159
115k
      assert(isFirst() && "expected a canonical decl");
160
115k
      if (Link.is<NotKnownLatest>())
161
19
        return nullptr;
162
115k
      return Link.get<KnownLatest>().getNotUpdated();
163
115k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
32.9k
    Decl *getLatestNotUpdated() const {
159
32.9k
      assert(isFirst() && "expected a canonical decl");
160
32.9k
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
32.9k
      return Link.get<KnownLatest>().getNotUpdated();
163
32.9k
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
8.67k
    Decl *getLatestNotUpdated() const {
159
8.67k
      assert(isFirst() && "expected a canonical decl");
160
8.67k
      if (Link.is<NotKnownLatest>())
161
591
        return nullptr;
162
8.08k
      return Link.get<KnownLatest>().getNotUpdated();
163
8.67k
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
1.05k
    Decl *getLatestNotUpdated() const {
159
1.05k
      assert(isFirst() && "expected a canonical decl");
160
1.05k
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
1.05k
      return Link.get<KnownLatest>().getNotUpdated();
163
1.05k
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
25.6k
    Decl *getLatestNotUpdated() const {
159
25.6k
      assert(isFirst() && "expected a canonical decl");
160
25.6k
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
25.6k
      return Link.get<KnownLatest>().getNotUpdated();
163
25.6k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
13.1k
    Decl *getLatestNotUpdated() const {
159
13.1k
      assert(isFirst() && "expected a canonical decl");
160
13.1k
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
13.1k
      return Link.get<KnownLatest>().getNotUpdated();
163
13.1k
    }
Unexecuted instantiation: clang::Redeclarable<clang::TranslationUnitDecl>::DeclLink::getLatestNotUpdated() const
164
  };
165
166
2.74M
  static DeclLink PreviousDeclLink(decl_type *D) {
167
2.74M
    return DeclLink(DeclLink::PreviousLink, D);
168
2.74M
  }
clang::Redeclarable<clang::TranslationUnitDecl>::PreviousDeclLink(clang::TranslationUnitDecl*)
Line
Count
Source
166
468
  static DeclLink PreviousDeclLink(decl_type *D) {
167
468
    return DeclLink(DeclLink::PreviousLink, D);
168
468
  }
clang::Redeclarable<clang::FunctionDecl>::PreviousDeclLink(clang::FunctionDecl*)
Line
Count
Source
166
491k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
491k
    return DeclLink(DeclLink::PreviousLink, D);
168
491k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::PreviousDeclLink(clang::RedeclarableTemplateDecl*)
Line
Count
Source
166
153k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
153k
    return DeclLink(DeclLink::PreviousLink, D);
168
153k
  }
clang::Redeclarable<clang::TagDecl>::PreviousDeclLink(clang::TagDecl*)
Line
Count
Source
166
166k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
166k
    return DeclLink(DeclLink::PreviousLink, D);
168
166k
  }
clang::Redeclarable<clang::NamespaceDecl>::PreviousDeclLink(clang::NamespaceDecl*)
Line
Count
Source
166
1.67M
  static DeclLink PreviousDeclLink(decl_type *D) {
167
1.67M
    return DeclLink(DeclLink::PreviousLink, D);
168
1.67M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::PreviousDeclLink(clang::ObjCInterfaceDecl*)
Line
Count
Source
166
135k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
135k
    return DeclLink(DeclLink::PreviousLink, D);
168
135k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::PreviousDeclLink(clang::ObjCProtocolDecl*)
Line
Count
Source
166
5.90k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
5.90k
    return DeclLink(DeclLink::PreviousLink, D);
168
5.90k
  }
clang::Redeclarable<clang::TypedefNameDecl>::PreviousDeclLink(clang::TypedefNameDecl*)
Line
Count
Source
166
16.1k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
16.1k
    return DeclLink(DeclLink::PreviousLink, D);
168
16.1k
  }
clang::Redeclarable<clang::VarDecl>::PreviousDeclLink(clang::VarDecl*)
Line
Count
Source
166
87.6k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
87.6k
    return DeclLink(DeclLink::PreviousLink, D);
168
87.6k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::PreviousDeclLink(clang::NamespaceAliasDecl*)
Line
Count
Source
166
16
  static DeclLink PreviousDeclLink(decl_type *D) {
167
16
    return DeclLink(DeclLink::PreviousLink, D);
168
16
  }
clang::Redeclarable<clang::UsingShadowDecl>::PreviousDeclLink(clang::UsingShadowDecl*)
Line
Count
Source
166
11.5k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
11.5k
    return DeclLink(DeclLink::PreviousLink, D);
168
11.5k
  }
169
170
170M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
170M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
170M
  }
clang::Redeclarable<clang::TypedefNameDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
3.83M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
3.83M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
3.83M
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
384
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
384
    return DeclLink(DeclLink::LatestLink, Ctx);
172
384
  }
clang::Redeclarable<clang::TranslationUnitDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
98.0k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
98.0k
    return DeclLink(DeclLink::LatestLink, Ctx);
172
98.0k
  }
clang::Redeclarable<clang::VarDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
114M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
114M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
114M
  }
clang::Redeclarable<clang::FunctionDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
41.9M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
41.9M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
41.9M
  }
clang::Redeclarable<clang::TagDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
5.54M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
5.54M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
5.54M
  }
clang::Redeclarable<clang::NamespaceDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
1.73M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
1.73M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
1.73M
  }
clang::Redeclarable<clang::UsingShadowDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
559k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
559k
    return DeclLink(DeclLink::LatestLink, Ctx);
172
559k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
247k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
247k
    return DeclLink(DeclLink::LatestLink, Ctx);
172
247k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
25.9k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
25.9k
    return DeclLink(DeclLink::LatestLink, Ctx);
172
25.9k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
1.92M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
1.92M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
1.92M
  }
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
1.09G
  decl_type *getNextRedeclaration() const {
190
1.09G
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
1.09G
  }
clang::Redeclarable<clang::TranslationUnitDecl>::getNextRedeclaration() const
Line
Count
Source
189
115M
  decl_type *getNextRedeclaration() const {
190
115M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
115M
  }
clang::Redeclarable<clang::VarDecl>::getNextRedeclaration() const
Line
Count
Source
189
277M
  decl_type *getNextRedeclaration() const {
190
277M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
277M
  }
clang::Redeclarable<clang::FunctionDecl>::getNextRedeclaration() const
Line
Count
Source
189
146M
  decl_type *getNextRedeclaration() const {
190
146M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
146M
  }
clang::Redeclarable<clang::TypedefNameDecl>::getNextRedeclaration() const
Line
Count
Source
189
1.73M
  decl_type *getNextRedeclaration() const {
190
1.73M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
1.73M
  }
clang::Redeclarable<clang::TagDecl>::getNextRedeclaration() const
Line
Count
Source
189
377M
  decl_type *getNextRedeclaration() const {
190
377M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
377M
  }
clang::Redeclarable<clang::UsingShadowDecl>::getNextRedeclaration() const
Line
Count
Source
189
1.31M
  decl_type *getNextRedeclaration() const {
190
1.31M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
1.31M
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getNextRedeclaration() const
Line
Count
Source
189
238k
  decl_type *getNextRedeclaration() const {
190
238k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
238k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getNextRedeclaration() const
Line
Count
Source
189
1.02M
  decl_type *getNextRedeclaration() const {
190
1.02M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
1.02M
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getNextRedeclaration() const
Line
Count
Source
189
25.0M
  decl_type *getNextRedeclaration() const {
190
25.0M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
25.0M
  }
clang::Redeclarable<clang::NamespaceDecl>::getNextRedeclaration() const
Line
Count
Source
189
152M
  decl_type *getNextRedeclaration() const {
190
152M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
152M
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getNextRedeclaration() const
Line
Count
Source
189
255
  decl_type *getNextRedeclaration() const {
190
255
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
255
  }
192
193
public:
194
  friend class ASTDeclReader;
195
  friend class ASTDeclWriter;
196
  friend class IncrementalParser;
197
198
  Redeclarable(const ASTContext &Ctx)
199
170M
      : RedeclLink(LatestDeclLink(Ctx)),
200
170M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::TypedefNameDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
3.83M
      : RedeclLink(LatestDeclLink(Ctx)),
200
3.83M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::TranslationUnitDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
98.0k
      : RedeclLink(LatestDeclLink(Ctx)),
200
98.0k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::VarDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
114M
      : RedeclLink(LatestDeclLink(Ctx)),
200
114M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::FunctionDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
41.9M
      : RedeclLink(LatestDeclLink(Ctx)),
200
41.9M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::TagDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
5.54M
      : RedeclLink(LatestDeclLink(Ctx)),
200
5.54M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::NamespaceAliasDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
384
      : RedeclLink(LatestDeclLink(Ctx)),
200
384
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::NamespaceDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
1.73M
      : RedeclLink(LatestDeclLink(Ctx)),
200
1.73M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::UsingShadowDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
559k
      : RedeclLink(LatestDeclLink(Ctx)),
200
559k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
247k
      : RedeclLink(LatestDeclLink(Ctx)),
200
247k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
25.9k
      : RedeclLink(LatestDeclLink(Ctx)),
200
25.9k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::RedeclarableTemplateDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
1.92M
      : RedeclLink(LatestDeclLink(Ctx)),
200
1.92M
        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
178M
  decl_type *getPreviousDecl() {
205
178M
    if (!RedeclLink.isFirst())
206
52.7M
      return getNextRedeclaration();
207
125M
    return nullptr;
208
178M
  }
clang::Redeclarable<clang::TranslationUnitDecl>::getPreviousDecl()
Line
Count
Source
204
56.1k
  decl_type *getPreviousDecl() {
205
56.1k
    if (!RedeclLink.isFirst())
206
102
      return getNextRedeclaration();
207
56.0k
    return nullptr;
208
56.1k
  }
clang::Redeclarable<clang::VarDecl>::getPreviousDecl()
Line
Count
Source
204
14.2M
  decl_type *getPreviousDecl() {
205
14.2M
    if (!RedeclLink.isFirst())
206
57.6k
      return getNextRedeclaration();
207
14.2M
    return nullptr;
208
14.2M
  }
clang::Redeclarable<clang::FunctionDecl>::getPreviousDecl()
Line
Count
Source
204
97.3M
  decl_type *getPreviousDecl() {
205
97.3M
    if (!RedeclLink.isFirst())
206
722k
      return getNextRedeclaration();
207
96.5M
    return nullptr;
208
97.3M
  }
clang::Redeclarable<clang::TypedefNameDecl>::getPreviousDecl()
Line
Count
Source
204
3.59M
  decl_type *getPreviousDecl() {
205
3.59M
    if (!RedeclLink.isFirst())
206
15.0k
      return getNextRedeclaration();
207
3.57M
    return nullptr;
208
3.59M
  }
clang::Redeclarable<clang::TagDecl>::getPreviousDecl()
Line
Count
Source
204
7.22M
  decl_type *getPreviousDecl() {
205
7.22M
    if (!RedeclLink.isFirst())
206
525k
      return getNextRedeclaration();
207
6.70M
    return nullptr;
208
7.22M
  }
clang::Redeclarable<clang::UsingShadowDecl>::getPreviousDecl()
Line
Count
Source
204
552k
  decl_type *getPreviousDecl() {
205
552k
    if (!RedeclLink.isFirst())
206
11.2k
      return getNextRedeclaration();
207
541k
    return nullptr;
208
552k
  }
clang::Redeclarable<clang::NamespaceDecl>::getPreviousDecl()
Line
Count
Source
204
51.1M
  decl_type *getPreviousDecl() {
205
51.1M
    if (!RedeclLink.isFirst())
206
50.9M
      return getNextRedeclaration();
207
215k
    return nullptr;
208
51.1M
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getPreviousDecl()
Line
Count
Source
204
366
  decl_type *getPreviousDecl() {
205
366
    if (!RedeclLink.isFirst())
206
13
      return getNextRedeclaration();
207
353
    return nullptr;
208
366
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getPreviousDecl()
Line
Count
Source
204
298k
  decl_type *getPreviousDecl() {
205
298k
    if (!RedeclLink.isFirst())
206
172k
      return getNextRedeclaration();
207
126k
    return nullptr;
208
298k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getPreviousDecl()
Line
Count
Source
204
29.9k
  decl_type *getPreviousDecl() {
205
29.9k
    if (!RedeclLink.isFirst())
206
8.50k
      return getNextRedeclaration();
207
21.4k
    return nullptr;
208
29.9k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getPreviousDecl()
Line
Count
Source
204
3.89M
  decl_type *getPreviousDecl() {
205
3.89M
    if (!RedeclLink.isFirst())
206
298k
      return getNextRedeclaration();
207
3.59M
    return nullptr;
208
3.89M
  }
209
10.9M
  const decl_type *getPreviousDecl() const {
210
10.9M
    return const_cast<decl_type *>(
211
10.9M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
10.9M
  }
clang::Redeclarable<clang::VarDecl>::getPreviousDecl() const
Line
Count
Source
209
1.27M
  const decl_type *getPreviousDecl() const {
210
1.27M
    return const_cast<decl_type *>(
211
1.27M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
1.27M
  }
clang::Redeclarable<clang::FunctionDecl>::getPreviousDecl() const
Line
Count
Source
209
8.08M
  const decl_type *getPreviousDecl() const {
210
8.08M
    return const_cast<decl_type *>(
211
8.08M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
8.08M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getPreviousDecl() const
Line
Count
Source
209
32.9k
  const decl_type *getPreviousDecl() const {
210
32.9k
    return const_cast<decl_type *>(
211
32.9k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
32.9k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getPreviousDecl() const
Line
Count
Source
209
1.52M
  const decl_type *getPreviousDecl() const {
210
1.52M
    return const_cast<decl_type *>(
211
1.52M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
1.52M
  }
clang::Redeclarable<clang::NamespaceDecl>::getPreviousDecl() const
Line
Count
Source
209
317
  const decl_type *getPreviousDecl() const {
210
317
    return const_cast<decl_type *>(
211
317
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
317
  }
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::TypedefNameDecl>::getPreviousDecl() const
Line
Count
Source
209
4.55k
  const decl_type *getPreviousDecl() const {
210
4.55k
    return const_cast<decl_type *>(
211
4.55k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
4.55k
  }
clang::Redeclarable<clang::UsingShadowDecl>::getPreviousDecl() const
Line
Count
Source
209
74
  const decl_type *getPreviousDecl() const {
210
74
    return const_cast<decl_type *>(
211
74
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
74
  }
clang::Redeclarable<clang::TranslationUnitDecl>::getPreviousDecl() const
Line
Count
Source
209
643
  const decl_type *getPreviousDecl() const {
210
643
    return const_cast<decl_type *>(
211
643
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
643
  }
clang::Redeclarable<clang::TagDecl>::getPreviousDecl() const
Line
Count
Source
209
5.15k
  const decl_type *getPreviousDecl() const {
210
5.15k
    return const_cast<decl_type *>(
211
5.15k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
5.15k
  }
213
214
  /// Return the first declaration of this declaration or itself if this
215
  /// is the only declaration.
216
3.72G
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::TranslationUnitDecl>::getFirstDecl()
Line
Count
Source
216
1.40G
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::VarDecl>::getFirstDecl()
Line
Count
Source
216
366M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::FunctionDecl>::getFirstDecl()
Line
Count
Source
216
1.16G
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::TypedefNameDecl>::getFirstDecl()
Line
Count
Source
216
241M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::TagDecl>::getFirstDecl()
Line
Count
Source
216
383M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::NamespaceAliasDecl>::getFirstDecl()
Line
Count
Source
216
472
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::UsingShadowDecl>::getFirstDecl()
Line
Count
Source
216
5.00M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getFirstDecl()
Line
Count
Source
216
149M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::NamespaceDecl>::getFirstDecl()
Line
Count
Source
216
6.18M
  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
297k
  decl_type *getFirstDecl() { return First; }
217
218
  /// Return the first declaration of this declaration or itself if this
219
  /// is the only declaration.
220
79.3M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::TypedefNameDecl>::getFirstDecl() const
Line
Count
Source
220
122
  const decl_type *getFirstDecl() const { return First; }
Unexecuted instantiation: clang::Redeclarable<clang::NamespaceAliasDecl>::getFirstDecl() const
clang::Redeclarable<clang::UsingShadowDecl>::getFirstDecl() const
Line
Count
Source
220
50
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::ObjCProtocolDecl>::getFirstDecl() const
Line
Count
Source
220
2.54k
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getFirstDecl() const
Line
Count
Source
220
185k
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::VarDecl>::getFirstDecl() const
Line
Count
Source
220
25.2M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::FunctionDecl>::getFirstDecl() const
Line
Count
Source
220
47.6M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::TagDecl>::getFirstDecl() const
Line
Count
Source
220
156k
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getFirstDecl() const
Line
Count
Source
220
6.18M
  const decl_type *getFirstDecl() const { return First; }
221
222
  /// True if this is the first declaration in its redeclaration chain.
223
666M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::TagDecl>::isFirstDecl() const
Line
Count
Source
223
42.3M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::VarDecl>::isFirstDecl() const
Line
Count
Source
223
58.6M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::FunctionDecl>::isFirstDecl() const
Line
Count
Source
223
67.1M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::NamespaceDecl>::isFirstDecl() const
Line
Count
Source
223
497M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::ObjCInterfaceDecl>::isFirstDecl() const
Line
Count
Source
223
121k
  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
62.7k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::NamespaceAliasDecl>::isFirstDecl() const
Line
Count
Source
223
14
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::UsingShadowDecl>::isFirstDecl() const
Line
Count
Source
223
5.78k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::isFirstDecl() const
Line
Count
Source
223
195k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
224
225
  /// Returns the most recent (re)declaration of this declaration.
226
675M
  decl_type *getMostRecentDecl() {
227
675M
    return getFirstDecl()->getNextRedeclaration();
228
675M
  }
clang::Redeclarable<clang::TranslationUnitDecl>::getMostRecentDecl()
Line
Count
Source
226
115M
  decl_type *getMostRecentDecl() {
227
115M
    return getFirstDecl()->getNextRedeclaration();
228
115M
  }
clang::Redeclarable<clang::VarDecl>::getMostRecentDecl()
Line
Count
Source
226
106M
  decl_type *getMostRecentDecl() {
227
106M
    return getFirstDecl()->getNextRedeclaration();
228
106M
  }
clang::Redeclarable<clang::FunctionDecl>::getMostRecentDecl()
Line
Count
Source
226
94.9M
  decl_type *getMostRecentDecl() {
227
94.9M
    return getFirstDecl()->getNextRedeclaration();
228
94.9M
  }
clang::Redeclarable<clang::TypedefNameDecl>::getMostRecentDecl()
Line
Count
Source
226
1.12M
  decl_type *getMostRecentDecl() {
227
1.12M
    return getFirstDecl()->getNextRedeclaration();
228
1.12M
  }
clang::Redeclarable<clang::TagDecl>::getMostRecentDecl()
Line
Count
Source
226
335M
  decl_type *getMostRecentDecl() {
227
335M
    return getFirstDecl()->getNextRedeclaration();
228
335M
  }
clang::Redeclarable<clang::UsingShadowDecl>::getMostRecentDecl()
Line
Count
Source
226
857k
  decl_type *getMostRecentDecl() {
227
857k
    return getFirstDecl()->getNextRedeclaration();
228
857k
  }
clang::Redeclarable<clang::NamespaceDecl>::getMostRecentDecl()
Line
Count
Source
226
4.92M
  decl_type *getMostRecentDecl() {
227
4.92M
    return getFirstDecl()->getNextRedeclaration();
228
4.92M
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getMostRecentDecl()
Line
Count
Source
226
141
  decl_type *getMostRecentDecl() {
227
141
    return getFirstDecl()->getNextRedeclaration();
228
141
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getMostRecentDecl()
Line
Count
Source
226
474k
  decl_type *getMostRecentDecl() {
227
474k
    return getFirstDecl()->getNextRedeclaration();
228
474k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getMostRecentDecl()
Line
Count
Source
226
196k
  decl_type *getMostRecentDecl() {
227
196k
    return getFirstDecl()->getNextRedeclaration();
228
196k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getMostRecentDecl()
Line
Count
Source
226
15.5M
  decl_type *getMostRecentDecl() {
227
15.5M
    return getFirstDecl()->getNextRedeclaration();
228
15.5M
  }
229
230
  /// Returns the most recent (re)declaration of this declaration.
231
6.92M
  const decl_type *getMostRecentDecl() const {
232
6.92M
    return getFirstDecl()->getNextRedeclaration();
233
6.92M
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getMostRecentDecl() const
Line
Count
Source
231
1.72k
  const decl_type *getMostRecentDecl() const {
232
1.72k
    return getFirstDecl()->getNextRedeclaration();
233
1.72k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getMostRecentDecl() const
Line
Count
Source
231
50.3k
  const decl_type *getMostRecentDecl() const {
232
50.3k
    return getFirstDecl()->getNextRedeclaration();
233
50.3k
  }
clang::Redeclarable<clang::FunctionDecl>::getMostRecentDecl() const
Line
Count
Source
231
713k
  const decl_type *getMostRecentDecl() const {
232
713k
    return getFirstDecl()->getNextRedeclaration();
233
713k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getMostRecentDecl() const
Line
Count
Source
231
6.15M
  const decl_type *getMostRecentDecl() const {
232
6.15M
    return getFirstDecl()->getNextRedeclaration();
233
6.15M
  }
clang::Redeclarable<clang::VarDecl>::getMostRecentDecl() const
Line
Count
Source
231
1.27k
  const decl_type *getMostRecentDecl() const {
232
1.27k
    return getFirstDecl()->getNextRedeclaration();
233
1.27k
  }
clang::Redeclarable<clang::TagDecl>::getMostRecentDecl() const
Line
Count
Source
231
171
  const decl_type *getMostRecentDecl() const {
232
171
    return getFirstDecl()->getNextRedeclaration();
233
171
  }
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 = nullptr;
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
397M
    redecl_iterator() = default;
clang::Redeclarable<clang::VarDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
93.2M
    redecl_iterator() = default;
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
58.0M
    redecl_iterator() = default;
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
74.6k
    redecl_iterator() = default;
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
18.4k
    redecl_iterator() = default;
clang::Redeclarable<clang::TagDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
245M
    redecl_iterator() = default;
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
979
    redecl_iterator() = default;
254
397M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::VarDecl>::redecl_iterator::redecl_iterator(clang::VarDecl*)
Line
Count
Source
254
93.2M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::redecl_iterator(clang::FunctionDecl*)
Line
Count
Source
254
58.0M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::redecl_iterator(clang::ObjCInterfaceDecl*)
Line
Count
Source
254
74.6k
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::redecl_iterator(clang::ObjCProtocolDecl*)
Line
Count
Source
254
18.4k
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::TagDecl>::redecl_iterator::redecl_iterator(clang::TagDecl*)
Line
Count
Source
254
245M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::redecl_iterator(clang::UsingShadowDecl*)
Line
Count
Source
254
979
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
255
256
425M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::VarDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
103M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
59.3M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
108k
    reference operator*() const { return Current; }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
23.2k
    reference operator*() const { return Current; }
clang::Redeclarable<clang::TagDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
262M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
987
    reference operator*() const { return Current; }
257
    pointer operator->() const { return Current; }
258
259
125M
    redecl_iterator& operator++() {
260
125M
      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
125M
      if (Current->isFirstDecl()) {
264
116M
        if (PassedFirst) {
265
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
266
0
          Current = nullptr;
267
0
          return *this;
268
0
        }
269
116M
        PassedFirst = true;
270
116M
      }
271
272
      // Get either previous decl or latest decl.
273
125M
      decl_type *Next = Current->getNextRedeclaration();
274
125M
      Current = (Next != Starter) ? 
Next27.7M
:
nullptr97.4M
;
275
125M
      return *this;
276
125M
    }
clang::Redeclarable<clang::VarDecl>::redecl_iterator::operator++()
Line
Count
Source
259
55.5M
    redecl_iterator& operator++() {
260
55.5M
      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
55.5M
      if (Current->isFirstDecl()) {
264
49.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
49.7M
        PassedFirst = true;
270
49.7M
      }
271
272
      // Get either previous decl or latest decl.
273
55.5M
      decl_type *Next = Current->getNextRedeclaration();
274
55.5M
      Current = (Next != Starter) ? 
Next10.1M
:
nullptr45.3M
;
275
55.5M
      return *this;
276
55.5M
    }
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::operator++()
Line
Count
Source
259
30.4M
    redecl_iterator& operator++() {
260
30.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
30.4M
      if (Current->isFirstDecl()) {
264
29.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
29.7M
        PassedFirst = true;
270
29.7M
      }
271
272
      // Get either previous decl or latest decl.
273
30.4M
      decl_type *Next = Current->getNextRedeclaration();
274
30.4M
      Current = (Next != Starter) ? 
Next1.28M
:
nullptr29.1M
;
275
30.4M
      return *this;
276
30.4M
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::operator++()
Line
Count
Source
259
108k
    redecl_iterator& operator++() {
260
108k
      assert(Current && "Advancing while iterator has reached end");
261
      // Make sure we don't infinitely loop on an invalid redecl chain. This
262
      // should never happen.
263
108k
      if (Current->isFirstDecl()) {
264
74.6k
        if (PassedFirst) {
265
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
266
0
          Current = nullptr;
267
0
          return *this;
268
0
        }
269
74.6k
        PassedFirst = true;
270
74.6k
      }
271
272
      // Get either previous decl or latest decl.
273
108k
      decl_type *Next = Current->getNextRedeclaration();
274
108k
      Current = (Next != Starter) ? 
Next33.8k
:
nullptr74.6k
;
275
108k
      return *this;
276
108k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::operator++()
Line
Count
Source
259
23.2k
    redecl_iterator& operator++() {
260
23.2k
      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
23.2k
      if (Current->isFirstDecl()) {
264
18.4k
        if (PassedFirst) {
265
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
266
0
          Current = nullptr;
267
0
          return *this;
268
0
        }
269
18.4k
        PassedFirst = true;
270
18.4k
      }
271
272
      // Get either previous decl or latest decl.
273
23.2k
      decl_type *Next = Current->getNextRedeclaration();
274
23.2k
      Current = (Next != Starter) ? 
Next4.79k
:
nullptr18.4k
;
275
23.2k
      return *this;
276
23.2k
    }
clang::Redeclarable<clang::TagDecl>::redecl_iterator::operator++()
Line
Count
Source
259
39.1M
    redecl_iterator& operator++() {
260
39.1M
      assert(Current && "Advancing while iterator has reached end");
261
      // Make sure we don't infinitely loop on an invalid redecl chain. This
262
      // should never happen.
263
39.1M
      if (Current->isFirstDecl()) {
264
36.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
36.7M
        PassedFirst = true;
270
36.7M
      }
271
272
      // Get either previous decl or latest decl.
273
39.1M
      decl_type *Next = Current->getNextRedeclaration();
274
39.1M
      Current = (Next != Starter) ? 
Next16.3M
:
nullptr22.8M
;
275
39.1M
      return *this;
276
39.1M
    }
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::operator++()
Line
Count
Source
259
987
    redecl_iterator& operator++() {
260
987
      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
987
      if (Current->isFirstDecl()) {
264
979
        if (PassedFirst) {
265
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
266
0
          Current = nullptr;
267
0
          return *this;
268
0
        }
269
979
        PassedFirst = true;
270
979
      }
271
272
      // Get either previous decl or latest decl.
273
987
      decl_type *Next = Current->getNextRedeclaration();
274
987
      Current = (Next != Starter) ? 
Next8
:
nullptr979
;
275
987
      return *this;
276
987
    }
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
522M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
288
522M
      return x.Current != y.Current;
289
522M
    }
clang::operator!=(clang::Redeclarable<clang::VarDecl>::redecl_iterator, clang::Redeclarable<clang::VarDecl>::redecl_iterator)
Line
Count
Source
287
148M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
288
148M
      return x.Current != y.Current;
289
148M
    }
clang::operator!=(clang::Redeclarable<clang::FunctionDecl>::redecl_iterator, clang::Redeclarable<clang::FunctionDecl>::redecl_iterator)
Line
Count
Source
287
88.4M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
288
88.4M
      return x.Current != y.Current;
289
88.4M
    }
clang::operator!=(clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator, clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator)
Line
Count
Source
287
183k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
288
183k
      return x.Current != y.Current;
289
183k
    }
clang::operator!=(clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator, clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator)
Line
Count
Source
287
41.7k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
288
41.7k
      return x.Current != y.Current;
289
41.7k
    }
clang::operator!=(clang::Redeclarable<clang::TagDecl>::redecl_iterator, clang::Redeclarable<clang::TagDecl>::redecl_iterator)
Line
Count
Source
287
285M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
288
285M
      return x.Current != y.Current;
289
285M
    }
clang::operator!=(clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator, clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator)
Line
Count
Source
287
1.96k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
288
1.96k
      return x.Current != y.Current;
289
1.96k
    }
290
  };
291
292
  using redecl_range = llvm::iterator_range<redecl_iterator>;
293
294
  /// Returns an iterator range for all the redeclarations of the same
295
  /// decl. It will iterate at least once (when this decl is the only one).
296
397M
  redecl_range redecls() const {
297
397M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
298
397M
                            static_cast<const decl_type *>(this))),
299
397M
                        redecl_iterator());
300
397M
  }
clang::Redeclarable<clang::VarDecl>::redecls() const
Line
Count
Source
296
93.2M
  redecl_range redecls() const {
297
93.2M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
298
93.2M
                            static_cast<const decl_type *>(this))),
299
93.2M
                        redecl_iterator());
300
93.2M
  }
clang::Redeclarable<clang::FunctionDecl>::redecls() const
Line
Count
Source
296
58.0M
  redecl_range redecls() const {
297
58.0M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
298
58.0M
                            static_cast<const decl_type *>(this))),
299
58.0M
                        redecl_iterator());
300
58.0M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecls() const
Line
Count
Source
296
74.6k
  redecl_range redecls() const {
297
74.6k
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
298
74.6k
                            static_cast<const decl_type *>(this))),
299
74.6k
                        redecl_iterator());
300
74.6k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecls() const
Line
Count
Source
296
18.4k
  redecl_range redecls() const {
297
18.4k
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
298
18.4k
                            static_cast<const decl_type *>(this))),
299
18.4k
                        redecl_iterator());
300
18.4k
  }
clang::Redeclarable<clang::TagDecl>::redecls() const
Line
Count
Source
296
245M
  redecl_range redecls() const {
297
245M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
298
245M
                            static_cast<const decl_type *>(this))),
299
245M
                        redecl_iterator());
300
245M
  }
clang::Redeclarable<clang::UsingShadowDecl>::redecls() const
Line
Count
Source
296
979
  redecl_range redecls() const {
297
979
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
298
979
                            static_cast<const decl_type *>(this))),
299
979
                        redecl_iterator());
300
979
  }
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.20M
  decl_type *getFirstDecl() {
321
9.20M
    auto *D = static_cast<decl_type *>(this);
322
9.20M
    if (!D->isFromASTFile())
323
9.03M
      return D;
324
165k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
9.20M
  }
clang::Mergeable<clang::FieldDecl>::getFirstDecl()
Line
Count
Source
320
8.08M
  decl_type *getFirstDecl() {
321
8.08M
    auto *D = static_cast<decl_type *>(this);
322
8.08M
    if (!D->isFromASTFile())
323
7.94M
      return D;
324
146k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
8.08M
  }
clang::Mergeable<clang::EnumConstantDecl>::getFirstDecl()
Line
Count
Source
320
560k
  decl_type *getFirstDecl() {
321
560k
    auto *D = static_cast<decl_type *>(this);
322
560k
    if (!D->isFromASTFile())
323
552k
      return D;
324
7.50k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
560k
  }
clang::Mergeable<clang::IndirectFieldDecl>::getFirstDecl()
Line
Count
Source
320
16.7k
  decl_type *getFirstDecl() {
321
16.7k
    auto *D = static_cast<decl_type *>(this);
322
16.7k
    if (!D->isFromASTFile())
323
15.5k
      return D;
324
1.26k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
16.7k
  }
clang::Mergeable<clang::UsingDecl>::getFirstDecl()
Line
Count
Source
320
531k
  decl_type *getFirstDecl() {
321
531k
    auto *D = static_cast<decl_type *>(this);
322
531k
    if (!D->isFromASTFile())
323
521k
      return D;
324
10.1k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
531k
  }
clang::Mergeable<clang::UsingEnumDecl>::getFirstDecl()
Line
Count
Source
320
161
  decl_type *getFirstDecl() {
321
161
    auto *D = static_cast<decl_type *>(this);
322
161
    if (!D->isFromASTFile())
323
157
      return D;
324
4
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
161
  }
clang::Mergeable<clang::UsingPackDecl>::getFirstDecl()
Line
Count
Source
320
82
  decl_type *getFirstDecl() {
321
82
    auto *D = static_cast<decl_type *>(this);
322
82
    if (!D->isFromASTFile())
323
60
      return D;
324
22
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
82
  }
clang::Mergeable<clang::UnresolvedUsingValueDecl>::getFirstDecl()
Line
Count
Source
320
6.98k
  decl_type *getFirstDecl() {
321
6.98k
    auto *D = static_cast<decl_type *>(this);
322
6.98k
    if (!D->isFromASTFile())
323
6.75k
      return D;
324
232
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
6.98k
  }
clang::Mergeable<clang::UnresolvedUsingTypenameDecl>::getFirstDecl()
Line
Count
Source
320
965
  decl_type *getFirstDecl() {
321
965
    auto *D = static_cast<decl_type *>(this);
322
965
    if (!D->isFromASTFile())
323
491
      return D;
324
474
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
965
  }
clang::Mergeable<clang::TemplateParamObjectDecl>::getFirstDecl()
Line
Count
Source
320
1.16k
  decl_type *getFirstDecl() {
321
1.16k
    auto *D = static_cast<decl_type *>(this);
322
1.16k
    if (!D->isFromASTFile())
323
1.15k
      return D;
324
6
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
325
1.16k
  }
326
327
  /// Return the first declaration of this declaration or itself if this
328
  /// is the only declaration.
329
1.45M
  const decl_type *getFirstDecl() const {
330
1.45M
    const auto *D = static_cast<const decl_type *>(this);
331
1.45M
    if (!D->isFromASTFile())
332
1.40M
      return D;
333
51.0k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
334
1.45M
  }
clang::Mergeable<clang::FieldDecl>::getFirstDecl() const
Line
Count
Source
329
1.45M
  const decl_type *getFirstDecl() const {
330
1.45M
    const auto *D = static_cast<const decl_type *>(this);
331
1.45M
    if (!D->isFromASTFile())
332
1.40M
      return D;
333
50.8k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
334
1.45M
  }
clang::Mergeable<clang::EnumConstantDecl>::getFirstDecl() const
Line
Count
Source
329
118
  const decl_type *getFirstDecl() const {
330
118
    const auto *D = static_cast<const decl_type *>(this);
331
118
    if (!D->isFromASTFile())
332
99
      return D;
333
19
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
334
118
  }
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
46
  const decl_type *getFirstDecl() const {
330
46
    const auto *D = static_cast<const decl_type *>(this);
331
46
    if (!D->isFromASTFile())
332
41
      return D;
333
5
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
334
46
  }
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
2
  const decl_type *getFirstDecl() const {
330
2
    const auto *D = static_cast<const decl_type *>(this);
331
2
    if (!D->isFromASTFile())
332
2
      return D;
333
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
334
2
  }
clang::Mergeable<clang::UnresolvedUsingTypenameDecl>::getFirstDecl() const
Line
Count
Source
329
216
  const decl_type *getFirstDecl() const {
330
216
    const auto *D = static_cast<const decl_type *>(this);
331
216
    if (!D->isFromASTFile())
332
117
      return D;
333
99
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
334
216
  }
Unexecuted instantiation: clang::Mergeable<clang::LifetimeExtendedTemporaryDecl>::getFirstDecl() const
clang::Mergeable<clang::ConceptDecl>::getFirstDecl() const
Line
Count
Source
329
6
  const decl_type *getFirstDecl() const {
330
6
    const auto *D = static_cast<const decl_type *>(this);
331
6
    if (!D->isFromASTFile())
332
6
      return D;
333
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
334
6
  }
Unexecuted instantiation: clang::Mergeable<clang::MSGuidDecl>::getFirstDecl() const
Unexecuted instantiation: clang::Mergeable<clang::TemplateParamObjectDecl>::getFirstDecl() const
Unexecuted instantiation: clang::Mergeable<clang::UnnamedGlobalConstantDecl>::getFirstDecl() const
335
336
  /// Returns true if this is the first declaration.
337
  bool isFirstDecl() const { return getFirstDecl() == this; }
338
};
339
340
/// A wrapper class around a pointer that always points to its canonical
341
/// declaration.
342
///
343
/// CanonicalDeclPtr<decl_type> behaves just like decl_type*, except we call
344
/// decl_type::getCanonicalDecl() on construction.
345
///
346
/// This is useful for hashtables that you want to be keyed on a declaration's
347
/// canonical decl -- if you use CanonicalDeclPtr as the key, you don't need to
348
/// remember to call getCanonicalDecl() everywhere.
349
template <typename decl_type> class CanonicalDeclPtr {
350
public:
351
1.86M
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::FunctionDecl const>::CanonicalDeclPtr()
Line
Count
Source
351
153k
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::Decl const>::CanonicalDeclPtr()
Line
Count
Source
351
325k
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::Decl>::CanonicalDeclPtr()
Line
Count
Source
351
1.23M
  CanonicalDeclPtr() = default;
Unexecuted instantiation: clang::CanonicalDeclPtr<clang::VarDecl>::CanonicalDeclPtr()
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::CanonicalDeclPtr()
Line
Count
Source
351
56.3k
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::VarDecl const>::CanonicalDeclPtr()
Line
Count
Source
351
97.7k
  CanonicalDeclPtr() = default;
352
  CanonicalDeclPtr(decl_type *Ptr)
353
16.5M
      : Ptr(Ptr ? 
Ptr->getCanonicalDecl()16.4M
:
nullptr40.4k
) {}
clang::CanonicalDeclPtr<clang::FunctionDecl>::CanonicalDeclPtr(clang::FunctionDecl*)
Line
Count
Source
353
86.0k
      : Ptr(Ptr ? 
Ptr->getCanonicalDecl()47.6k
:
nullptr38.4k
) {}
clang::CanonicalDeclPtr<clang::Decl>::CanonicalDeclPtr(clang::Decl*)
Line
Count
Source
353
1.04M
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : 
nullptr0
) {}
clang::CanonicalDeclPtr<clang::FunctionDecl const>::CanonicalDeclPtr(clang::FunctionDecl const*)
Line
Count
Source
353
12.0M
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : 
nullptr0
) {}
clang::CanonicalDeclPtr<clang::Decl const>::CanonicalDeclPtr(clang::Decl const*)
Line
Count
Source
353
3.19M
      : Ptr(Ptr ? 
Ptr->getCanonicalDecl()3.19M
:
nullptr2.00k
) {}
clang::CanonicalDeclPtr<clang::VarDecl>::CanonicalDeclPtr(clang::VarDecl*)
Line
Count
Source
353
146k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : 
nullptr0
) {}
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::CanonicalDeclPtr(clang::CXXRecordDecl const*)
Line
Count
Source
353
10.6k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : 
nullptr0
) {}
clang::CanonicalDeclPtr<clang::VarDecl const>::CanonicalDeclPtr(clang::VarDecl const*)
Line
Count
Source
353
26.3k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : 
nullptr0
) {}
354
  CanonicalDeclPtr(const CanonicalDeclPtr &) = default;
355
  CanonicalDeclPtr &operator=(const CanonicalDeclPtr &) = default;
356
357
95.1k
  operator decl_type *() { return Ptr; }
clang::CanonicalDeclPtr<clang::FunctionDecl>::operator clang::FunctionDecl*()
Line
Count
Source
357
71.5k
  operator decl_type *() { return Ptr; }
clang::CanonicalDeclPtr<clang::VarDecl>::operator clang::VarDecl*()
Line
Count
Source
357
2.16k
  operator decl_type *() { return Ptr; }
clang::CanonicalDeclPtr<clang::Decl const>::operator clang::Decl const*()
Line
Count
Source
357
21.3k
  operator decl_type *() { return Ptr; }
clang::CanonicalDeclPtr<clang::VarDecl const>::operator clang::VarDecl const*()
Line
Count
Source
357
60
  operator decl_type *() { return Ptr; }
358
27.8M
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::FunctionDecl const>::operator clang::FunctionDecl const*() const
Line
Count
Source
358
1.19M
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::Decl const>::operator clang::Decl const*() const
Line
Count
Source
358
5.07M
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::Decl>::operator clang::Decl const*() const
Line
Count
Source
358
18.7M
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::operator clang::CXXRecordDecl const*() const
Line
Count
Source
358
1.17M
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::VarDecl const>::operator clang::VarDecl const*() const
Line
Count
Source
358
1.58M
  operator const decl_type *() const { return Ptr; }
359
360
40
  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.73k
  friend bool operator==(CanonicalDeclPtr LHS, CanonicalDeclPtr RHS) {
367
2.73k
    return LHS.Ptr == RHS.Ptr;
368
2.73k
  }
369
  friend bool operator!=(CanonicalDeclPtr LHS, CanonicalDeclPtr RHS) {
370
    return LHS.Ptr != RHS.Ptr;
371
  }
372
373
private:
374
  friend struct llvm::DenseMapInfo<CanonicalDeclPtr<decl_type>>;
375
  friend struct llvm::PointerLikeTypeTraits<CanonicalDeclPtr<decl_type>>;
376
377
  decl_type *Ptr = nullptr;
378
};
379
380
} // namespace clang
381
382
namespace llvm {
383
384
template <typename decl_type>
385
struct DenseMapInfo<clang::CanonicalDeclPtr<decl_type>> {
386
  using CanonicalDeclPtr = clang::CanonicalDeclPtr<decl_type>;
387
  using BaseInfo = DenseMapInfo<decl_type *>;
388
389
1.12M
  static CanonicalDeclPtr getEmptyKey() {
390
    // Construct our CanonicalDeclPtr this way because the regular constructor
391
    // would dereference P.Ptr, which is not allowed.
392
1.12M
    CanonicalDeclPtr P;
393
1.12M
    P.Ptr = BaseInfo::getEmptyKey();
394
1.12M
    return P;
395
1.12M
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl const>, void>::getEmptyKey()
Line
Count
Source
389
79.1k
  static CanonicalDeclPtr getEmptyKey() {
390
    // Construct our CanonicalDeclPtr this way because the regular constructor
391
    // would dereference P.Ptr, which is not allowed.
392
79.1k
    CanonicalDeclPtr P;
393
79.1k
    P.Ptr = BaseInfo::getEmptyKey();
394
79.1k
    return P;
395
79.1k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl const>, void>::getEmptyKey()
Line
Count
Source
389
196k
  static CanonicalDeclPtr getEmptyKey() {
390
    // Construct our CanonicalDeclPtr this way because the regular constructor
391
    // would dereference P.Ptr, which is not allowed.
392
196k
    CanonicalDeclPtr P;
393
196k
    P.Ptr = BaseInfo::getEmptyKey();
394
196k
    return P;
395
196k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl>, void>::getEmptyKey()
Line
Count
Source
389
753k
  static CanonicalDeclPtr getEmptyKey() {
390
    // Construct our CanonicalDeclPtr this way because the regular constructor
391
    // would dereference P.Ptr, which is not allowed.
392
753k
    CanonicalDeclPtr P;
393
753k
    P.Ptr = BaseInfo::getEmptyKey();
394
753k
    return P;
395
753k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const>, void>::getEmptyKey()
Line
Count
Source
389
37.5k
  static CanonicalDeclPtr getEmptyKey() {
390
    // Construct our CanonicalDeclPtr this way because the regular constructor
391
    // would dereference P.Ptr, which is not allowed.
392
37.5k
    CanonicalDeclPtr P;
393
37.5k
    P.Ptr = BaseInfo::getEmptyKey();
394
37.5k
    return P;
395
37.5k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::VarDecl const>, void>::getEmptyKey()
Line
Count
Source
389
61.9k
  static CanonicalDeclPtr getEmptyKey() {
390
    // Construct our CanonicalDeclPtr this way because the regular constructor
391
    // would dereference P.Ptr, which is not allowed.
392
61.9k
    CanonicalDeclPtr P;
393
61.9k
    P.Ptr = BaseInfo::getEmptyKey();
394
61.9k
    return P;
395
61.9k
  }
396
397
710k
  static CanonicalDeclPtr getTombstoneKey() {
398
710k
    CanonicalDeclPtr P;
399
710k
    P.Ptr = BaseInfo::getTombstoneKey();
400
710k
    return P;
401
710k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl const>, void>::getTombstoneKey()
Line
Count
Source
397
50.7k
  static CanonicalDeclPtr getTombstoneKey() {
398
50.7k
    CanonicalDeclPtr P;
399
50.7k
    P.Ptr = BaseInfo::getTombstoneKey();
400
50.7k
    return P;
401
50.7k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl const>, void>::getTombstoneKey()
Line
Count
Source
397
128k
  static CanonicalDeclPtr getTombstoneKey() {
398
128k
    CanonicalDeclPtr P;
399
128k
    P.Ptr = BaseInfo::getTombstoneKey();
400
128k
    return P;
401
128k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl>, void>::getTombstoneKey()
Line
Count
Source
397
476k
  static CanonicalDeclPtr getTombstoneKey() {
398
476k
    CanonicalDeclPtr P;
399
476k
    P.Ptr = BaseInfo::getTombstoneKey();
400
476k
    return P;
401
476k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const>, void>::getTombstoneKey()
Line
Count
Source
397
18.7k
  static CanonicalDeclPtr getTombstoneKey() {
398
18.7k
    CanonicalDeclPtr P;
399
18.7k
    P.Ptr = BaseInfo::getTombstoneKey();
400
18.7k
    return P;
401
18.7k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::VarDecl const>, void>::getTombstoneKey()
Line
Count
Source
397
35.7k
  static CanonicalDeclPtr getTombstoneKey() {
398
35.7k
    CanonicalDeclPtr P;
399
35.7k
    P.Ptr = BaseInfo::getTombstoneKey();
400
35.7k
    return P;
401
35.7k
  }
402
403
504k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
404
504k
    return BaseInfo::getHashValue(P);
405
504k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl const>, void>::getHashValue(clang::CanonicalDeclPtr<clang::FunctionDecl const> const&)
Line
Count
Source
403
46.6k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
404
46.6k
    return BaseInfo::getHashValue(P);
405
46.6k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl const>, void>::getHashValue(clang::CanonicalDeclPtr<clang::Decl const> const&)
Line
Count
Source
403
64.2k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
404
64.2k
    return BaseInfo::getHashValue(P);
405
64.2k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl>, void>::getHashValue(clang::CanonicalDeclPtr<clang::Decl> const&)
Line
Count
Source
403
357k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
404
357k
    return BaseInfo::getHashValue(P);
405
357k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const>, void>::getHashValue(clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&)
Line
Count
Source
403
10.6k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
404
10.6k
    return BaseInfo::getHashValue(P);
405
10.6k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::VarDecl const>, void>::getHashValue(clang::CanonicalDeclPtr<clang::VarDecl const> const&)
Line
Count
Source
403
25.4k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
404
25.4k
    return BaseInfo::getHashValue(P);
405
25.4k
  }
406
407
  static bool isEqual(const CanonicalDeclPtr &LHS,
408
13.6M
                      const CanonicalDeclPtr &RHS) {
409
13.6M
    return BaseInfo::isEqual(LHS, RHS);
410
13.6M
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl const>, void>::isEqual(clang::CanonicalDeclPtr<clang::FunctionDecl const> const&, clang::CanonicalDeclPtr<clang::FunctionDecl const> const&)
Line
Count
Source
408
571k
                      const CanonicalDeclPtr &RHS) {
409
571k
    return BaseInfo::isEqual(LHS, RHS);
410
571k
  }
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.50M
                      const CanonicalDeclPtr &RHS) {
409
2.50M
    return BaseInfo::isEqual(LHS, RHS);
410
2.50M
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl>, void>::isEqual(clang::CanonicalDeclPtr<clang::Decl> const&, clang::CanonicalDeclPtr<clang::Decl> const&)
Line
Count
Source
408
9.21M
                      const CanonicalDeclPtr &RHS) {
409
9.21M
    return BaseInfo::isEqual(LHS, RHS);
410
9.21M
  }
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
582k
                      const CanonicalDeclPtr &RHS) {
409
582k
    return BaseInfo::isEqual(LHS, RHS);
410
582k
  }
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
781k
                      const CanonicalDeclPtr &RHS) {
409
781k
    return BaseInfo::isEqual(LHS, RHS);
410
781k
  }
411
};
412
413
template <typename decl_type>
414
struct PointerLikeTypeTraits<clang::CanonicalDeclPtr<decl_type>> {
415
311k
  static inline void *getAsVoidPointer(clang::CanonicalDeclPtr<decl_type> P) {
416
311k
    return P.Ptr;
417
311k
  }
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