Coverage Report

Created: 2018-09-23 22:08

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/include/clang/AST/Redeclarable.h
Line
Count
Source (jump to first uncovered line)
1
//===- Redeclarable.h - Base for Decls that can be redeclared --*- C++ -*-====//
2
//
3
//                     The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
//
10
//  This file defines the Redeclarable interface.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#ifndef LLVM_CLANG_AST_REDECLARABLE_H
15
#define LLVM_CLANG_AST_REDECLARABLE_H
16
17
#include "clang/AST/ExternalASTSource.h"
18
#include "llvm/ADT/DenseMapInfo.h"
19
#include "llvm/ADT/PointerUnion.h"
20
#include "llvm/ADT/iterator_range.h"
21
#include "llvm/Support/Casting.h"
22
#include <cassert>
23
#include <cstddef>
24
#include <iterator>
25
26
namespace clang {
27
28
class ASTContext;
29
class Decl;
30
31
// Some notes on redeclarables:
32
//
33
//  - Every redeclarable is on a circular linked list.
34
//
35
//  - Every decl has a pointer to the first element of the chain _and_ a
36
//    DeclLink that may point to one of 3 possible states:
37
//      - the "previous" (temporal) element in the chain
38
//      - the "latest" (temporal) element in the chain
39
//      - the "uninitialized-latest" value (when newly-constructed)
40
//
41
//  - The first element is also often called the canonical element. Every
42
//    element has a pointer to it so that "getCanonical" can be fast.
43
//
44
//  - Most links in the chain point to previous, except the link out of
45
//    the first; it points to latest.
46
//
47
//  - Elements are called "first", "previous", "latest" or
48
//    "most-recent" when referring to temporal order: order of addition
49
//    to the chain.
50
//
51
//  - It's easiest to just ignore the implementation of DeclLink when making
52
//    sense of the redeclaration chain.
53
//
54
//  - There's also a "definition" link for several types of
55
//    redeclarable, where only one definition should exist at any given
56
//    time (and the defn pointer is stored in the decl's "data" which
57
//    is copied to every element on the chain when it's changed).
58
//
59
//    Here is some ASCII art:
60
//
61
//      "first"                                     "latest"
62
//      "canonical"                                 "most recent"
63
//      +------------+         first                +--------------+
64
//      |            | <--------------------------- |              |
65
//      |            |                              |              |
66
//      |            |                              |              |
67
//      |            |       +--------------+       |              |
68
//      |            | first |              |       |              |
69
//      |            | <---- |              |       |              |
70
//      |            |       |              |       |              |
71
//      | @class A   |  link | @interface A |  link | @class A     |
72
//      | seen first | <---- | seen second  | <---- | seen third   |
73
//      |            |       |              |       |              |
74
//      +------------+       +--------------+       +--------------+
75
//      | data       | defn  | data         |  defn | data         |
76
//      |            | ----> |              | <---- |              |
77
//      +------------+       +--------------+       +--------------+
78
//        |                     |     ^                  ^
79
//        |                     |defn |                  |
80
//        | link                +-----+                  |
81
//        +-->-------------------------------------------+
82
83
/// Provides common interface for the Decls that can be redeclared.
84
template<typename decl_type>
85
class Redeclarable {
86
protected:
87
  class DeclLink {
88
    /// A pointer to a known latest declaration, either statically known or
89
    /// generationally updated as decls are added by an external source.
90
    using KnownLatest =
91
        LazyGenerationalUpdatePtr<const Decl *, Decl *,
92
                                  &ExternalASTSource::CompleteRedeclChain>;
93
94
    /// We store a pointer to the ASTContext in the UninitializedLatest
95
    /// pointer, but to avoid circular type dependencies when we steal the low
96
    /// bits of this pointer, we use a raw void* here.
97
    using UninitializedLatest = const void *;
98
99
    using Previous = Decl *;
100
101
    /// A pointer to either an uninitialized latest declaration (where either
102
    /// we've not yet set the previous decl or there isn't one), or to a known
103
    /// previous declaration.
104
    using NotKnownLatest = llvm::PointerUnion<Previous, UninitializedLatest>;
105
106
    mutable llvm::PointerUnion<NotKnownLatest, KnownLatest> Link;
107
108
  public:
109
    enum PreviousTag { PreviousLink };
110
    enum LatestTag { LatestLink };
111
112
    DeclLink(LatestTag, const ASTContext &Ctx)
113
34.2M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
113
2.40M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::VarDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::VarDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
113
17.8M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::FunctionDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::FunctionDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
113
8.25M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::TagDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::TagDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
113
4.34M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
113
245
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::NamespaceDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
113
120k
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
113
160k
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
113
29.9k
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
113
3.82k
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
113
1.10M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
114
1.84M
    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
114
8.99k
    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
114
1.04M
    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
114
539k
    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
114
6.85k
    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
114
424
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::VarDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::VarDecl>::DeclLink::PreviousTag, clang::VarDecl*)
Line
Count
Source
114
76.7k
    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
114
74.1k
    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
114
15
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::PreviousTag, clang::UsingShadowDecl*)
Line
Count
Source
114
3.12k
    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
114
89.4k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
115
116
445M
    bool isFirst() const {
117
445M
      return Link.is<KnownLatest>() ||
118
445M
             // FIXME: 'template' is required on the next line due to an
119
445M
             // apparent clang bug.
120
445M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()283M
;
121
445M
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::isFirst() const
Line
Count
Source
116
11.4M
    bool isFirst() const {
117
11.4M
      return Link.is<KnownLatest>() ||
118
11.4M
             // FIXME: 'template' is required on the next line due to an
119
11.4M
             // apparent clang bug.
120
11.4M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()5.34M
;
121
11.4M
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::isFirst() const
Line
Count
Source
116
25.3M
    bool isFirst() const {
117
25.3M
      return Link.is<KnownLatest>() ||
118
25.3M
             // FIXME: 'template' is required on the next line due to an
119
25.3M
             // apparent clang bug.
120
25.3M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()7.74M
;
121
25.3M
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::isFirst() const
Line
Count
Source
116
24.8M
    bool isFirst() const {
117
24.8M
      return Link.is<KnownLatest>() ||
118
24.8M
             // FIXME: 'template' is required on the next line due to an
119
24.8M
             // apparent clang bug.
120
24.8M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()2.88M
;
121
24.8M
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::isFirst() const
Line
Count
Source
116
790k
    bool isFirst() const {
117
790k
      return Link.is<KnownLatest>() ||
118
790k
             // FIXME: 'template' is required on the next line due to an
119
790k
             // apparent clang bug.
120
790k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()305k
;
121
790k
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::isFirst() const
Line
Count
Source
116
18.4k
    bool isFirst() const {
117
18.4k
      return Link.is<KnownLatest>() ||
118
18.4k
             // FIXME: 'template' is required on the next line due to an
119
18.4k
             // apparent clang bug.
120
18.4k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()3.68k
;
121
18.4k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::isFirst() const
Line
Count
Source
116
3.86k
    bool isFirst() const {
117
3.86k
      return Link.is<KnownLatest>() ||
118
3.86k
             // FIXME: 'template' is required on the next line due to an
119
3.86k
             // apparent clang bug.
120
3.86k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()486
;
121
3.86k
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::isFirst() const
Line
Count
Source
116
381M
    bool isFirst() const {
117
381M
      return Link.is<KnownLatest>() ||
118
381M
             // FIXME: 'template' is required on the next line due to an
119
381M
             // apparent clang bug.
120
381M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()266M
;
121
381M
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::isFirst() const
Line
Count
Source
116
20
    bool isFirst() const {
117
20
      return Link.is<KnownLatest>() ||
118
20
             // FIXME: 'template' is required on the next line due to an
119
20
             // apparent clang bug.
120
20
             Link.get<NotKnownLatest>().template is<UninitializedLatest>();
121
20
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::isFirst() const
Line
Count
Source
116
1.03k
    bool isFirst() const {
117
1.03k
      return Link.is<KnownLatest>() ||
118
1.03k
             // FIXME: 'template' is required on the next line due to an
119
1.03k
             // apparent clang bug.
120
1.03k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()371
;
121
1.03k
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::isFirst() const
Line
Count
Source
116
1.28M
    bool isFirst() const {
117
1.28M
      return Link.is<KnownLatest>() ||
118
1.28M
             // FIXME: 'template' is required on the next line due to an
119
1.28M
             // apparent clang bug.
120
1.28M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()927k
;
121
1.28M
    }
122
123
463M
    decl_type *getPrevious(const decl_type *D) const {
124
463M
      if (Link.is<NotKnownLatest>()) {
125
24.6M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
24.6M
        if (NKL.is<Previous>())
127
6.80M
          return static_cast<decl_type*>(NKL.get<Previous>());
128
17.8M
129
17.8M
        // Allocate the generational 'most recent' cache now, if needed.
130
17.8M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
17.8M
                               NKL.get<UninitializedLatest>()),
132
17.8M
                           const_cast<decl_type *>(D));
133
17.8M
      }
134
463M
135
463M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))456M
;
136
463M
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::getPrevious(clang::TagDecl const*) const
Line
Count
Source
123
344M
    decl_type *getPrevious(const decl_type *D) const {
124
344M
      if (Link.is<NotKnownLatest>()) {
125
2.90M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
2.90M
        if (NKL.is<Previous>())
127
2.90M
          return static_cast<decl_type*>(NKL.get<Previous>());
128
0
129
0
        // Allocate the generational 'most recent' cache now, if needed.
130
0
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
0
                               NKL.get<UninitializedLatest>()),
132
0
                           const_cast<decl_type *>(D));
133
0
      }
134
344M
135
344M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))341M
;
136
344M
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::getPrevious(clang::VarDecl const*) const
Line
Count
Source
123
55.2M
    decl_type *getPrevious(const decl_type *D) const {
124
55.2M
      if (Link.is<NotKnownLatest>()) {
125
12.3M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
12.3M
        if (NKL.is<Previous>())
127
2.08M
          return static_cast<decl_type*>(NKL.get<Previous>());
128
10.2M
129
10.2M
        // Allocate the generational 'most recent' cache now, if needed.
130
10.2M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
10.2M
                               NKL.get<UninitializedLatest>()),
132
10.2M
                           const_cast<decl_type *>(D));
133
10.2M
      }
134
55.2M
135
55.2M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))53.1M
;
136
55.2M
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::getPrevious(clang::ObjCInterfaceDecl const*) const
Line
Count
Source
123
32.2k
    decl_type *getPrevious(const decl_type *D) const {
124
32.2k
      if (Link.is<NotKnownLatest>()) {
125
3.86k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
3.86k
        if (NKL.is<Previous>())
127
3.86k
          return static_cast<decl_type*>(NKL.get<Previous>());
128
0
129
0
        // Allocate the generational 'most recent' cache now, if needed.
130
0
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
0
                               NKL.get<UninitializedLatest>()),
132
0
                           const_cast<decl_type *>(D));
133
0
      }
134
32.2k
135
32.2k
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))28.3k
;
136
32.2k
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::getPrevious(clang::FunctionDecl const*) const
Line
Count
Source
123
47.0M
    decl_type *getPrevious(const decl_type *D) const {
124
47.0M
      if (Link.is<NotKnownLatest>()) {
125
7.94M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
7.94M
        if (NKL.is<Previous>())
127
1.22M
          return static_cast<decl_type*>(NKL.get<Previous>());
128
6.71M
129
6.71M
        // Allocate the generational 'most recent' cache now, if needed.
130
6.71M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
6.71M
                               NKL.get<UninitializedLatest>()),
132
6.71M
                           const_cast<decl_type *>(D));
133
6.71M
      }
134
47.0M
135
47.0M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))45.8M
;
136
47.0M
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::getPrevious(clang::ObjCProtocolDecl const*) const
Line
Count
Source
123
5.45k
    decl_type *getPrevious(const decl_type *D) const {
124
5.45k
      if (Link.is<NotKnownLatest>()) {
125
566
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
566
        if (NKL.is<Previous>())
127
566
          return static_cast<decl_type*>(NKL.get<Previous>());
128
0
129
0
        // Allocate the generational 'most recent' cache now, if needed.
130
0
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
0
                               NKL.get<UninitializedLatest>()),
132
0
                           const_cast<decl_type *>(D));
133
0
      }
134
5.45k
135
5.45k
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))4.89k
;
136
5.45k
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::getPrevious(clang::TypedefNameDecl const*) const
Line
Count
Source
123
969k
    decl_type *getPrevious(const decl_type *D) const {
124
969k
      if (Link.is<NotKnownLatest>()) {
125
319k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
319k
        if (NKL.is<Previous>())
127
9.62k
          return static_cast<decl_type*>(NKL.get<Previous>());
128
309k
129
309k
        // Allocate the generational 'most recent' cache now, if needed.
130
309k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
309k
                               NKL.get<UninitializedLatest>()),
132
309k
                           const_cast<decl_type *>(D));
133
309k
      }
134
969k
135
969k
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))960k
;
136
969k
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::getPrevious(clang::UsingShadowDecl const*) const
Line
Count
Source
123
483k
    decl_type *getPrevious(const decl_type *D) const {
124
483k
      if (Link.is<NotKnownLatest>()) {
125
6.15k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
6.15k
        if (NKL.is<Previous>())
127
6.14k
          return static_cast<decl_type*>(NKL.get<Previous>());
128
10
129
10
        // Allocate the generational 'most recent' cache now, if needed.
130
10
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
10
                               NKL.get<UninitializedLatest>()),
132
10
                           const_cast<decl_type *>(D));
133
10
      }
134
483k
135
483k
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))477k
;
136
483k
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::getPrevious(clang::RedeclarableTemplateDecl const*) const
Line
Count
Source
123
14.7M
    decl_type *getPrevious(const decl_type *D) const {
124
14.7M
      if (Link.is<NotKnownLatest>()) {
125
733k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
733k
        if (NKL.is<Previous>())
127
197k
          return static_cast<decl_type*>(NKL.get<Previous>());
128
535k
129
535k
        // Allocate the generational 'most recent' cache now, if needed.
130
535k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
535k
                               NKL.get<UninitializedLatest>()),
132
535k
                           const_cast<decl_type *>(D));
133
535k
      }
134
14.7M
135
14.7M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))14.5M
;
136
14.7M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::getPrevious(clang::NamespaceDecl const*) const
Line
Count
Source
123
575k
    decl_type *getPrevious(const decl_type *D) const {
124
575k
      if (Link.is<NotKnownLatest>()) {
125
367k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
367k
        if (NKL.is<Previous>())
127
367k
          return static_cast<decl_type*>(NKL.get<Previous>());
128
0
129
0
        // Allocate the generational 'most recent' cache now, if needed.
130
0
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
0
                               NKL.get<UninitializedLatest>()),
132
0
                           const_cast<decl_type *>(D));
133
0
      }
134
575k
135
575k
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))208k
;
136
575k
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::getPrevious(clang::NamespaceAliasDecl const*) const
Line
Count
Source
123
209
    decl_type *getPrevious(const decl_type *D) const {
124
209
      if (Link.is<NotKnownLatest>()) {
125
65
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
65
        if (NKL.is<Previous>())
127
1
          return static_cast<decl_type*>(NKL.get<Previous>());
128
64
129
64
        // Allocate the generational 'most recent' cache now, if needed.
130
64
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
64
                               NKL.get<UninitializedLatest>()),
132
64
                           const_cast<decl_type *>(D));
133
64
      }
134
209
135
209
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))208
;
136
209
    }
137
138
10.8k
    void setPrevious(decl_type *D) {
139
10.8k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
140
10.8k
      Link = Previous(D);
141
10.8k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::setPrevious(clang::VarDecl*)
Line
Count
Source
138
1.03k
    void setPrevious(decl_type *D) {
139
1.03k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
140
1.03k
      Link = Previous(D);
141
1.03k
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::setPrevious(clang::FunctionDecl*)
Line
Count
Source
138
1.70k
    void setPrevious(decl_type *D) {
139
1.70k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
140
1.70k
      Link = Previous(D);
141
1.70k
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::setPrevious(clang::NamespaceDecl*)
Line
Count
Source
138
376
    void setPrevious(decl_type *D) {
139
376
      assert(!isFirst() && "decl became non-canonical unexpectedly");
140
376
      Link = Previous(D);
141
376
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::setPrevious(clang::NamespaceAliasDecl*)
Line
Count
Source
138
3
    void setPrevious(decl_type *D) {
139
3
      assert(!isFirst() && "decl became non-canonical unexpectedly");
140
3
      Link = Previous(D);
141
3
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::setPrevious(clang::ObjCInterfaceDecl*)
Line
Count
Source
138
111
    void setPrevious(decl_type *D) {
139
111
      assert(!isFirst() && "decl became non-canonical unexpectedly");
140
111
      Link = Previous(D);
141
111
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::setPrevious(clang::ObjCProtocolDecl*)
Line
Count
Source
138
38
    void setPrevious(decl_type *D) {
139
38
      assert(!isFirst() && "decl became non-canonical unexpectedly");
140
38
      Link = Previous(D);
141
38
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::setPrevious(clang::RedeclarableTemplateDecl*)
Line
Count
Source
138
1.39k
    void setPrevious(decl_type *D) {
139
1.39k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
140
1.39k
      Link = Previous(D);
141
1.39k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::setPrevious(clang::TagDecl*)
Line
Count
Source
138
3.95k
    void setPrevious(decl_type *D) {
139
3.95k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
140
3.95k
      Link = Previous(D);
141
3.95k
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::setPrevious(clang::TypedefNameDecl*)
Line
Count
Source
138
2.20k
    void setPrevious(decl_type *D) {
139
2.20k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
140
2.20k
      Link = Previous(D);
141
2.20k
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::setPrevious(clang::UsingShadowDecl*)
Line
Count
Source
138
11
    void setPrevious(decl_type *D) {
139
11
      assert(!isFirst() && "decl became non-canonical unexpectedly");
140
11
      Link = Previous(D);
141
11
    }
142
143
5.82M
    void setLatest(decl_type *D) {
144
5.82M
      assert(isFirst() && "decl became canonical unexpectedly");
145
5.82M
      if (Link.is<NotKnownLatest>()) {
146
3.94M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
3.94M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
3.94M
                               NKL.get<UninitializedLatest>()),
149
3.94M
                           D);
150
3.94M
      } else {
151
1.87M
        auto Latest = Link.get<KnownLatest>();
152
1.87M
        Latest.set(D);
153
1.87M
        Link = Latest;
154
1.87M
      }
155
5.82M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::setLatest(clang::NamespaceDecl*)
Line
Count
Source
143
121k
    void setLatest(decl_type *D) {
144
121k
      assert(isFirst() && "decl became canonical unexpectedly");
145
121k
      if (Link.is<NotKnownLatest>()) {
146
46.4k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
46.4k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
46.4k
                               NKL.get<UninitializedLatest>()),
149
46.4k
                           D);
150
74.6k
      } else {
151
74.6k
        auto Latest = Link.get<KnownLatest>();
152
74.6k
        Latest.set(D);
153
74.6k
        Link = Latest;
154
74.6k
      }
155
121k
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::setLatest(clang::NamespaceAliasDecl*)
Line
Count
Source
143
32
    void setLatest(decl_type *D) {
144
32
      assert(isFirst() && "decl became canonical unexpectedly");
145
32
      if (Link.is<NotKnownLatest>()) {
146
17
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
17
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
17
                               NKL.get<UninitializedLatest>()),
149
17
                           D);
150
17
      } else {
151
15
        auto Latest = Link.get<KnownLatest>();
152
15
        Latest.set(D);
153
15
        Link = Latest;
154
15
      }
155
32
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::setLatest(clang::ObjCInterfaceDecl*)
Line
Count
Source
143
30.2k
    void setLatest(decl_type *D) {
144
30.2k
      assert(isFirst() && "decl became canonical unexpectedly");
145
30.2k
      if (Link.is<NotKnownLatest>()) {
146
23.1k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
23.1k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
23.1k
                               NKL.get<UninitializedLatest>()),
149
23.1k
                           D);
150
23.1k
      } else {
151
7.11k
        auto Latest = Link.get<KnownLatest>();
152
7.11k
        Latest.set(D);
153
7.11k
        Link = Latest;
154
7.11k
      }
155
30.2k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::setLatest(clang::ObjCProtocolDecl*)
Line
Count
Source
143
3.93k
    void setLatest(decl_type *D) {
144
3.93k
      assert(isFirst() && "decl became canonical unexpectedly");
145
3.93k
      if (Link.is<NotKnownLatest>()) {
146
3.44k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
3.44k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
3.44k
                               NKL.get<UninitializedLatest>()),
149
3.44k
                           D);
150
3.44k
      } else {
151
488
        auto Latest = Link.get<KnownLatest>();
152
488
        Latest.set(D);
153
488
        Link = Latest;
154
488
      }
155
3.93k
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::setLatest(clang::RedeclarableTemplateDecl*)
Line
Count
Source
143
349k
    void setLatest(decl_type *D) {
144
349k
      assert(isFirst() && "decl became canonical unexpectedly");
145
349k
      if (Link.is<NotKnownLatest>()) {
146
260k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
260k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
260k
                               NKL.get<UninitializedLatest>()),
149
260k
                           D);
150
260k
      } else {
151
89.2k
        auto Latest = Link.get<KnownLatest>();
152
89.2k
        Latest.set(D);
153
89.2k
        Link = Latest;
154
89.2k
      }
155
349k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::setLatest(clang::TagDecl*)
Line
Count
Source
143
4.37M
    void setLatest(decl_type *D) {
144
4.37M
      assert(isFirst() && "decl became canonical unexpectedly");
145
4.37M
      if (Link.is<NotKnownLatest>()) {
146
3.30M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
3.30M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
3.30M
                               NKL.get<UninitializedLatest>()),
149
3.30M
                           D);
150
3.30M
      } else {
151
1.07M
        auto Latest = Link.get<KnownLatest>();
152
1.07M
        Latest.set(D);
153
1.07M
        Link = Latest;
154
1.07M
      }
155
4.37M
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::setLatest(clang::TypedefNameDecl*)
Line
Count
Source
143
12.3k
    void setLatest(decl_type *D) {
144
12.3k
      assert(isFirst() && "decl became canonical unexpectedly");
145
12.3k
      if (Link.is<NotKnownLatest>()) {
146
5.49k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
5.49k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
5.49k
                               NKL.get<UninitializedLatest>()),
149
5.49k
                           D);
150
6.87k
      } else {
151
6.87k
        auto Latest = Link.get<KnownLatest>();
152
6.87k
        Latest.set(D);
153
6.87k
        Link = Latest;
154
6.87k
      }
155
12.3k
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::setLatest(clang::UsingShadowDecl*)
Line
Count
Source
143
160k
    void setLatest(decl_type *D) {
144
160k
      assert(isFirst() && "decl became canonical unexpectedly");
145
160k
      if (Link.is<NotKnownLatest>()) {
146
157k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
157k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
157k
                               NKL.get<UninitializedLatest>()),
149
157k
                           D);
150
157k
      } else {
151
3.11k
        auto Latest = Link.get<KnownLatest>();
152
3.11k
        Latest.set(D);
153
3.11k
        Link = Latest;
154
3.11k
      }
155
160k
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::setLatest(clang::FunctionDecl*)
Line
Count
Source
143
559k
    void setLatest(decl_type *D) {
144
559k
      assert(isFirst() && "decl became canonical unexpectedly");
145
559k
      if (Link.is<NotKnownLatest>()) {
146
20.2k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
20.2k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
20.2k
                               NKL.get<UninitializedLatest>()),
149
20.2k
                           D);
150
539k
      } else {
151
539k
        auto Latest = Link.get<KnownLatest>();
152
539k
        Latest.set(D);
153
539k
        Link = Latest;
154
539k
      }
155
559k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::setLatest(clang::VarDecl*)
Line
Count
Source
143
205k
    void setLatest(decl_type *D) {
144
205k
      assert(isFirst() && "decl became canonical unexpectedly");
145
205k
      if (Link.is<NotKnownLatest>()) {
146
129k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
129k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
129k
                               NKL.get<UninitializedLatest>()),
149
129k
                           D);
150
129k
      } else {
151
76.6k
        auto Latest = Link.get<KnownLatest>();
152
76.6k
        Latest.set(D);
153
76.6k
        Link = Latest;
154
76.6k
      }
155
205k
    }
156
157
5.48k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::markIncomplete()
Line
Count
Source
157
2
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
Unexecuted instantiation: clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::markIncomplete()
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::markIncomplete()
Line
Count
Source
157
125
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::markIncomplete()
Line
Count
Source
157
1
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
Unexecuted instantiation: clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::markIncomplete()
clang::Redeclarable<clang::TagDecl>::DeclLink::markIncomplete()
Line
Count
Source
157
4.02k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
Unexecuted instantiation: clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::markIncomplete()
Unexecuted instantiation: clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::markIncomplete()
clang::Redeclarable<clang::FunctionDecl>::DeclLink::markIncomplete()
Line
Count
Source
157
1.30k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::VarDecl>::DeclLink::markIncomplete()
Line
Count
Source
157
25
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
158
159
10.1k
    Decl *getLatestNotUpdated() const {
160
10.1k
      assert(isFirst() && "expected a canonical decl");
161
10.1k
      if (Link.is<NotKnownLatest>())
162
78
        return nullptr;
163
10.0k
      return Link.get<KnownLatest>().getNotUpdated();
164
10.0k
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
159
260
    Decl *getLatestNotUpdated() const {
160
260
      assert(isFirst() && "expected a canonical decl");
161
260
      if (Link.is<NotKnownLatest>())
162
0
        return nullptr;
163
260
      return Link.get<KnownLatest>().getNotUpdated();
164
260
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
159
3
    Decl *getLatestNotUpdated() const {
160
3
      assert(isFirst() && "expected a canonical decl");
161
3
      if (Link.is<NotKnownLatest>())
162
0
        return nullptr;
163
3
      return Link.get<KnownLatest>().getNotUpdated();
164
3
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
159
353
    Decl *getLatestNotUpdated() const {
160
353
      assert(isFirst() && "expected a canonical decl");
161
353
      if (Link.is<NotKnownLatest>())
162
0
        return nullptr;
163
353
      return Link.get<KnownLatest>().getNotUpdated();
164
353
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
159
79
    Decl *getLatestNotUpdated() const {
160
79
      assert(isFirst() && "expected a canonical decl");
161
79
      if (Link.is<NotKnownLatest>())
162
0
        return nullptr;
163
79
      return Link.get<KnownLatest>().getNotUpdated();
164
79
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
159
4.89k
    Decl *getLatestNotUpdated() const {
160
4.89k
      assert(isFirst() && "expected a canonical decl");
161
4.89k
      if (Link.is<NotKnownLatest>())
162
9
        return nullptr;
163
4.89k
      return Link.get<KnownLatest>().getNotUpdated();
164
4.89k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
159
2.37k
    Decl *getLatestNotUpdated() const {
160
2.37k
      assert(isFirst() && "expected a canonical decl");
161
2.37k
      if (Link.is<NotKnownLatest>())
162
0
        return nullptr;
163
2.37k
      return Link.get<KnownLatest>().getNotUpdated();
164
2.37k
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
159
108
    Decl *getLatestNotUpdated() const {
160
108
      assert(isFirst() && "expected a canonical decl");
161
108
      if (Link.is<NotKnownLatest>())
162
17
        return nullptr;
163
91
      return Link.get<KnownLatest>().getNotUpdated();
164
91
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
159
1
    Decl *getLatestNotUpdated() const {
160
1
      assert(isFirst() && "expected a canonical decl");
161
1
      if (Link.is<NotKnownLatest>())
162
0
        return nullptr;
163
1
      return Link.get<KnownLatest>().getNotUpdated();
164
1
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
159
1.19k
    Decl *getLatestNotUpdated() const {
160
1.19k
      assert(isFirst() && "expected a canonical decl");
161
1.19k
      if (Link.is<NotKnownLatest>())
162
52
        return nullptr;
163
1.13k
      return Link.get<KnownLatest>().getNotUpdated();
164
1.13k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
159
854
    Decl *getLatestNotUpdated() const {
160
854
      assert(isFirst() && "expected a canonical decl");
161
854
      if (Link.is<NotKnownLatest>())
162
0
        return nullptr;
163
854
      return Link.get<KnownLatest>().getNotUpdated();
164
854
    }
165
  };
166
167
1.84M
  static DeclLink PreviousDeclLink(decl_type *D) {
168
1.84M
    return DeclLink(DeclLink::PreviousLink, D);
169
1.84M
  }
clang::Redeclarable<clang::TypedefNameDecl>::PreviousDeclLink(clang::TypedefNameDecl*)
Line
Count
Source
167
8.99k
  static DeclLink PreviousDeclLink(decl_type *D) {
168
8.99k
    return DeclLink(DeclLink::PreviousLink, D);
169
8.99k
  }
clang::Redeclarable<clang::TagDecl>::PreviousDeclLink(clang::TagDecl*)
Line
Count
Source
167
1.04M
  static DeclLink PreviousDeclLink(decl_type *D) {
168
1.04M
    return DeclLink(DeclLink::PreviousLink, D);
169
1.04M
  }
clang::Redeclarable<clang::FunctionDecl>::PreviousDeclLink(clang::FunctionDecl*)
Line
Count
Source
167
539k
  static DeclLink PreviousDeclLink(decl_type *D) {
168
539k
    return DeclLink(DeclLink::PreviousLink, D);
169
539k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::PreviousDeclLink(clang::ObjCInterfaceDecl*)
Line
Count
Source
167
6.85k
  static DeclLink PreviousDeclLink(decl_type *D) {
168
6.85k
    return DeclLink(DeclLink::PreviousLink, D);
169
6.85k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::PreviousDeclLink(clang::ObjCProtocolDecl*)
Line
Count
Source
167
424
  static DeclLink PreviousDeclLink(decl_type *D) {
168
424
    return DeclLink(DeclLink::PreviousLink, D);
169
424
  }
clang::Redeclarable<clang::VarDecl>::PreviousDeclLink(clang::VarDecl*)
Line
Count
Source
167
76.7k
  static DeclLink PreviousDeclLink(decl_type *D) {
168
76.7k
    return DeclLink(DeclLink::PreviousLink, D);
169
76.7k
  }
clang::Redeclarable<clang::NamespaceDecl>::PreviousDeclLink(clang::NamespaceDecl*)
Line
Count
Source
167
74.1k
  static DeclLink PreviousDeclLink(decl_type *D) {
168
74.1k
    return DeclLink(DeclLink::PreviousLink, D);
169
74.1k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::PreviousDeclLink(clang::NamespaceAliasDecl*)
Line
Count
Source
167
15
  static DeclLink PreviousDeclLink(decl_type *D) {
168
15
    return DeclLink(DeclLink::PreviousLink, D);
169
15
  }
clang::Redeclarable<clang::UsingShadowDecl>::PreviousDeclLink(clang::UsingShadowDecl*)
Line
Count
Source
167
3.12k
  static DeclLink PreviousDeclLink(decl_type *D) {
168
3.12k
    return DeclLink(DeclLink::PreviousLink, D);
169
3.12k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::PreviousDeclLink(clang::RedeclarableTemplateDecl*)
Line
Count
Source
167
89.4k
  static DeclLink PreviousDeclLink(decl_type *D) {
168
89.4k
    return DeclLink(DeclLink::PreviousLink, D);
169
89.4k
  }
170
171
34.2M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
34.2M
    return DeclLink(DeclLink::LatestLink, Ctx);
173
34.2M
  }
clang::Redeclarable<clang::TypedefNameDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
2.40M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
2.40M
    return DeclLink(DeclLink::LatestLink, Ctx);
173
2.40M
  }
clang::Redeclarable<clang::VarDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
17.8M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
17.8M
    return DeclLink(DeclLink::LatestLink, Ctx);
173
17.8M
  }
clang::Redeclarable<clang::FunctionDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
8.25M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
8.25M
    return DeclLink(DeclLink::LatestLink, Ctx);
173
8.25M
  }
clang::Redeclarable<clang::TagDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
4.34M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
4.34M
    return DeclLink(DeclLink::LatestLink, Ctx);
173
4.34M
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
245
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
245
    return DeclLink(DeclLink::LatestLink, Ctx);
173
245
  }
clang::Redeclarable<clang::NamespaceDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
120k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
120k
    return DeclLink(DeclLink::LatestLink, Ctx);
173
120k
  }
clang::Redeclarable<clang::UsingShadowDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
160k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
160k
    return DeclLink(DeclLink::LatestLink, Ctx);
173
160k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
29.9k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
29.9k
    return DeclLink(DeclLink::LatestLink, Ctx);
173
29.9k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
3.82k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
3.82k
    return DeclLink(DeclLink::LatestLink, Ctx);
173
3.82k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
1.10M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
1.10M
    return DeclLink(DeclLink::LatestLink, Ctx);
173
1.10M
  }
174
175
  /// Points to the next redeclaration in the chain.
176
  ///
177
  /// If isFirst() is false, this is a link to the previous declaration
178
  /// of this same Decl. If isFirst() is true, this is the first
179
  /// declaration and Link points to the latest declaration. For example:
180
  ///
181
  ///  #1 int f(int x, int y = 1); // <pointer to #3, true>
182
  ///  #2 int f(int x = 0, int y); // <pointer to #1, false>
183
  ///  #3 int f(int x, int y) { return x + y; } // <pointer to #2, false>
184
  ///
185
  /// If there is only one declaration, it is <pointer to self, true>
186
  DeclLink RedeclLink;
187
188
  decl_type *First;
189
190
463M
  decl_type *getNextRedeclaration() const {
191
463M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
463M
  }
clang::Redeclarable<clang::TagDecl>::getNextRedeclaration() const
Line
Count
Source
190
344M
  decl_type *getNextRedeclaration() const {
191
344M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
344M
  }
clang::Redeclarable<clang::VarDecl>::getNextRedeclaration() const
Line
Count
Source
190
55.2M
  decl_type *getNextRedeclaration() const {
191
55.2M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
55.2M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getNextRedeclaration() const
Line
Count
Source
190
32.2k
  decl_type *getNextRedeclaration() const {
191
32.2k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
32.2k
  }
clang::Redeclarable<clang::FunctionDecl>::getNextRedeclaration() const
Line
Count
Source
190
47.0M
  decl_type *getNextRedeclaration() const {
191
47.0M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
47.0M
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getNextRedeclaration() const
Line
Count
Source
190
5.45k
  decl_type *getNextRedeclaration() const {
191
5.45k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
5.45k
  }
clang::Redeclarable<clang::NamespaceDecl>::getNextRedeclaration() const
Line
Count
Source
190
575k
  decl_type *getNextRedeclaration() const {
191
575k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
575k
  }
clang::Redeclarable<clang::TypedefNameDecl>::getNextRedeclaration() const
Line
Count
Source
190
969k
  decl_type *getNextRedeclaration() const {
191
969k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
969k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getNextRedeclaration() const
Line
Count
Source
190
209
  decl_type *getNextRedeclaration() const {
191
209
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
209
  }
clang::Redeclarable<clang::UsingShadowDecl>::getNextRedeclaration() const
Line
Count
Source
190
483k
  decl_type *getNextRedeclaration() const {
191
483k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
483k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getNextRedeclaration() const
Line
Count
Source
190
14.7M
  decl_type *getNextRedeclaration() const {
191
14.7M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
14.7M
  }
193
194
public:
195
  friend class ASTDeclReader;
196
  friend class ASTDeclWriter;
197
198
  Redeclarable(const ASTContext &Ctx)
199
      : RedeclLink(LatestDeclLink(Ctx)),
200
34.2M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::TypedefNameDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
2.40M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::VarDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
17.8M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::FunctionDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
8.25M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::TagDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
4.34M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::NamespaceAliasDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
245
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::NamespaceDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
120k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::UsingShadowDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
160k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
29.9k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
3.82k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::RedeclarableTemplateDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
1.10M
        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
13.0M
  decl_type *getPreviousDecl() {
205
13.0M
    if (!RedeclLink.isFirst())
206
2.25M
      return getNextRedeclaration();
207
10.7M
    return nullptr;
208
10.7M
  }
clang::Redeclarable<clang::VarDecl>::getPreviousDecl()
Line
Count
Source
204
499k
  decl_type *getPreviousDecl() {
205
499k
    if (!RedeclLink.isFirst())
206
30.1k
      return getNextRedeclaration();
207
469k
    return nullptr;
208
469k
  }
clang::Redeclarable<clang::FunctionDecl>::getPreviousDecl()
Line
Count
Source
204
5.31M
  decl_type *getPreviousDecl() {
205
5.31M
    if (!RedeclLink.isFirst())
206
314k
      return getNextRedeclaration();
207
5.00M
    return nullptr;
208
5.00M
  }
clang::Redeclarable<clang::TagDecl>::getPreviousDecl()
Line
Count
Source
204
5.11M
  decl_type *getPreviousDecl() {
205
5.11M
    if (!RedeclLink.isFirst())
206
1.73M
      return getNextRedeclaration();
207
3.37M
    return nullptr;
208
3.37M
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getPreviousDecl()
Line
Count
Source
204
1.27M
  decl_type *getPreviousDecl() {
205
1.27M
    if (!RedeclLink.isFirst())
206
160k
      return getNextRedeclaration();
207
1.11M
    return nullptr;
208
1.11M
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getPreviousDecl()
Line
Count
Source
204
317
  decl_type *getPreviousDecl() {
205
317
    if (!RedeclLink.isFirst())
206
171
      return getNextRedeclaration();
207
146
    return nullptr;
208
146
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getPreviousDecl()
Line
Count
Source
204
3.11k
  decl_type *getPreviousDecl() {
205
3.11k
    if (!RedeclLink.isFirst())
206
1.36k
      return getNextRedeclaration();
207
1.74k
    return nullptr;
208
1.74k
  }
clang::Redeclarable<clang::TypedefNameDecl>::getPreviousDecl()
Line
Count
Source
204
783k
  decl_type *getPreviousDecl() {
205
783k
    if (!RedeclLink.isFirst())
206
8.81k
      return getNextRedeclaration();
207
774k
    return nullptr;
208
774k
  }
clang::Redeclarable<clang::UsingShadowDecl>::getPreviousDecl()
Line
Count
Source
204
137
  decl_type *getPreviousDecl() {
205
137
    if (!RedeclLink.isFirst())
206
33
      return getNextRedeclaration();
207
104
    return nullptr;
208
104
  }
clang::Redeclarable<clang::NamespaceDecl>::getPreviousDecl()
Line
Count
Source
204
32.2k
  decl_type *getPreviousDecl() {
205
32.2k
    if (!RedeclLink.isFirst())
206
5.01k
      return getNextRedeclaration();
207
27.2k
    return nullptr;
208
27.2k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getPreviousDecl()
Line
Count
Source
204
4
  decl_type *getPreviousDecl() {
205
4
    if (!RedeclLink.isFirst())
206
0
      return getNextRedeclaration();
207
4
    return nullptr;
208
4
  }
209
2.45M
  const decl_type *getPreviousDecl() const {
210
2.45M
    return const_cast<decl_type *>(
211
2.45M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
2.45M
  }
clang::Redeclarable<clang::FunctionDecl>::getPreviousDecl() const
Line
Count
Source
209
1.35M
  const decl_type *getPreviousDecl() const {
210
1.35M
    return const_cast<decl_type *>(
211
1.35M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
1.35M
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getPreviousDecl() const
Line
Count
Source
209
630k
  const decl_type *getPreviousDecl() const {
210
630k
    return const_cast<decl_type *>(
211
630k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
630k
  }
clang::Redeclarable<clang::TagDecl>::getPreviousDecl() const
Line
Count
Source
209
1.76k
  const decl_type *getPreviousDecl() const {
210
1.76k
    return const_cast<decl_type *>(
211
1.76k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
1.76k
  }
clang::Redeclarable<clang::NamespaceDecl>::getPreviousDecl() const
Line
Count
Source
209
119
  const decl_type *getPreviousDecl() const {
210
119
    return const_cast<decl_type *>(
211
119
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
119
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getPreviousDecl() const
Line
Count
Source
209
4
  const decl_type *getPreviousDecl() const {
210
4
    return const_cast<decl_type *>(
211
4
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
4
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getPreviousDecl() const
Line
Count
Source
209
2.30k
  const decl_type *getPreviousDecl() const {
210
2.30k
    return const_cast<decl_type *>(
211
2.30k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
2.30k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getPreviousDecl() const
Line
Count
Source
209
21
  const decl_type *getPreviousDecl() const {
210
21
    return const_cast<decl_type *>(
211
21
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
21
  }
clang::Redeclarable<clang::TypedefNameDecl>::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::UsingShadowDecl>::getPreviousDecl() const
Line
Count
Source
209
22
  const decl_type *getPreviousDecl() const {
210
22
    return const_cast<decl_type *>(
211
22
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
22
  }
clang::Redeclarable<clang::VarDecl>::getPreviousDecl() const
Line
Count
Source
209
464k
  const decl_type *getPreviousDecl() const {
210
464k
    return const_cast<decl_type *>(
211
464k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
464k
  }
213
214
  /// Return the first declaration of this declaration or itself if this
215
  /// is the only declaration.
216
833M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::TagDecl>::getFirstDecl()
Line
Count
Source
216
360M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::VarDecl>::getFirstDecl()
Line
Count
Source
216
106M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getFirstDecl()
Line
Count
Source
216
169k
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::ObjCProtocolDecl>::getFirstDecl()
Line
Count
Source
216
14.1k
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::FunctionDecl>::getFirstDecl()
Line
Count
Source
216
276M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getFirstDecl()
Line
Count
Source
216
76.3M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::NamespaceDecl>::getFirstDecl()
Line
Count
Source
216
184k
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::NamespaceAliasDecl>::getFirstDecl()
Line
Count
Source
216
407
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::UsingShadowDecl>::getFirstDecl()
Line
Count
Source
216
1.31M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::TypedefNameDecl>::getFirstDecl()
Line
Count
Source
216
11.5M
  decl_type *getFirstDecl() { return First; }
217
218
  /// Return the first declaration of this declaration or itself if this
219
  /// is the only declaration.
220
40.2M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::TagDecl>::getFirstDecl() const
Line
Count
Source
220
209k
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::VarDecl>::getFirstDecl() const
Line
Count
Source
220
14.4M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getFirstDecl() const
Line
Count
Source
220
3.30k
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::ObjCProtocolDecl>::getFirstDecl() const
Line
Count
Source
220
773
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::FunctionDecl>::getFirstDecl() const
Line
Count
Source
220
19.7M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getFirstDecl() const
Line
Count
Source
220
5.87M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::TypedefNameDecl>::getFirstDecl() const
Line
Count
Source
220
67
  const decl_type *getFirstDecl() const { return First; }
Unexecuted instantiation: clang::Redeclarable<clang::NamespaceAliasDecl>::getFirstDecl() const
Unexecuted instantiation: clang::Redeclarable<clang::UsingShadowDecl>::getFirstDecl() const
221
222
  /// True if this is the first declaration in its redeclaration chain.
223
432M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::VarDecl>::isFirstDecl() const
Line
Count
Source
223
10.9M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::FunctionDecl>::isFirstDecl() const
Line
Count
Source
223
20.0M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::TagDecl>::isFirstDecl() const
Line
Count
Source
223
19.7M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::TypedefNameDecl>::isFirstDecl() const
Line
Count
Source
223
7.14k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::ObjCInterfaceDecl>::isFirstDecl() const
Line
Count
Source
223
15.3k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::ObjCProtocolDecl>::isFirstDecl() const
Line
Count
Source
223
3.54k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::NamespaceDecl>::isFirstDecl() const
Line
Count
Source
223
381M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::NamespaceAliasDecl>::isFirstDecl() const
Line
Count
Source
223
16
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::UsingShadowDecl>::isFirstDecl() const
Line
Count
Source
223
901
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::isFirstDecl() const
Line
Count
Source
223
9.55k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
224
225
  /// Returns the most recent (re)declaration of this declaration.
226
397M
  decl_type *getMostRecentDecl() {
227
397M
    return getFirstDecl()->getNextRedeclaration();
228
397M
  }
clang::Redeclarable<clang::TagDecl>::getMostRecentDecl()
Line
Count
Source
226
321M
  decl_type *getMostRecentDecl() {
227
321M
    return getFirstDecl()->getNextRedeclaration();
228
321M
  }
clang::Redeclarable<clang::VarDecl>::getMostRecentDecl()
Line
Count
Source
226
38.4M
  decl_type *getMostRecentDecl() {
227
38.4M
    return getFirstDecl()->getNextRedeclaration();
228
38.4M
  }
clang::Redeclarable<clang::FunctionDecl>::getMostRecentDecl()
Line
Count
Source
226
28.8M
  decl_type *getMostRecentDecl() {
227
28.8M
    return getFirstDecl()->getNextRedeclaration();
228
28.8M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getMostRecentDecl()
Line
Count
Source
226
4.69k
  decl_type *getMostRecentDecl() {
227
4.69k
    return getFirstDecl()->getNextRedeclaration();
228
4.69k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getMostRecentDecl()
Line
Count
Source
226
1.01k
  decl_type *getMostRecentDecl() {
227
1.01k
    return getFirstDecl()->getNextRedeclaration();
228
1.01k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getMostRecentDecl()
Line
Count
Source
226
7.85M
  decl_type *getMostRecentDecl() {
227
7.85M
    return getFirstDecl()->getNextRedeclaration();
228
7.85M
  }
clang::Redeclarable<clang::TypedefNameDecl>::getMostRecentDecl()
Line
Count
Source
226
645k
  decl_type *getMostRecentDecl() {
227
645k
    return getFirstDecl()->getNextRedeclaration();
228
645k
  }
clang::Redeclarable<clang::UsingShadowDecl>::getMostRecentDecl()
Line
Count
Source
226
315k
  decl_type *getMostRecentDecl() {
227
315k
    return getFirstDecl()->getNextRedeclaration();
228
315k
  }
clang::Redeclarable<clang::NamespaceDecl>::getMostRecentDecl()
Line
Count
Source
226
110k
  decl_type *getMostRecentDecl() {
227
110k
    return getFirstDecl()->getNextRedeclaration();
228
110k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getMostRecentDecl()
Line
Count
Source
226
127
  decl_type *getMostRecentDecl() {
227
127
    return getFirstDecl()->getNextRedeclaration();
228
127
  }
229
230
  /// Returns the most recent (re)declaration of this declaration.
231
6.72M
  const decl_type *getMostRecentDecl() const {
232
6.72M
    return getFirstDecl()->getNextRedeclaration();
233
6.72M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getMostRecentDecl() const
Line
Count
Source
231
3.30k
  const decl_type *getMostRecentDecl() const {
232
3.30k
    return getFirstDecl()->getNextRedeclaration();
233
3.30k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getMostRecentDecl() const
Line
Count
Source
231
152
  const decl_type *getMostRecentDecl() const {
232
152
    return getFirstDecl()->getNextRedeclaration();
233
152
  }
clang::Redeclarable<clang::FunctionDecl>::getMostRecentDecl() const
Line
Count
Source
231
851k
  const decl_type *getMostRecentDecl() const {
232
851k
    return getFirstDecl()->getNextRedeclaration();
233
851k
  }
clang::Redeclarable<clang::VarDecl>::getMostRecentDecl() const
Line
Count
Source
231
354
  const decl_type *getMostRecentDecl() const {
232
354
    return getFirstDecl()->getNextRedeclaration();
233
354
  }
clang::Redeclarable<clang::TagDecl>::getMostRecentDecl() const
Line
Count
Source
231
122
  const decl_type *getMostRecentDecl() const {
232
122
    return getFirstDecl()->getNextRedeclaration();
233
122
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getMostRecentDecl() const
Line
Count
Source
231
5.87M
  const decl_type *getMostRecentDecl() const {
232
5.87M
    return getFirstDecl()->getNextRedeclaration();
233
5.87M
  }
234
235
  /// Set the previous declaration. If PrevDecl is NULL, set this as the
236
  /// first and only declaration.
237
  void setPreviousDecl(decl_type *PrevDecl);
238
239
  /// Iterates through all the redeclarations of the same decl.
240
  class redecl_iterator {
241
    /// Current - The current declaration.
242
    decl_type *Current = nullptr;
243
    decl_type *Starter;
244
    bool PassedFirst = false;
245
246
  public:
247
    using value_type = decl_type *;
248
    using reference = decl_type *;
249
    using pointer = decl_type *;
250
    using iterator_category = std::forward_iterator_tag;
251
    using difference_type = std::ptrdiff_t;
252
253
302M
    redecl_iterator() = default;
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
25.3M
    redecl_iterator() = default;
clang::Redeclarable<clang::TagDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
250M
    redecl_iterator() = default;
clang::Redeclarable<clang::VarDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
26.2M
    redecl_iterator() = default;
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
570
    redecl_iterator() = default;
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
12.8k
    redecl_iterator() = default;
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
3.17k
    redecl_iterator() = default;
254
302M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::redecl_iterator(clang::FunctionDecl*)
Line
Count
Source
254
25.3M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::TagDecl>::redecl_iterator::redecl_iterator(clang::TagDecl*)
Line
Count
Source
254
250M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::VarDecl>::redecl_iterator::redecl_iterator(clang::VarDecl*)
Line
Count
Source
254
26.2M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::redecl_iterator(clang::UsingShadowDecl*)
Line
Count
Source
254
570
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::redecl_iterator(clang::ObjCInterfaceDecl*)
Line
Count
Source
254
12.8k
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::redecl_iterator(clang::ObjCProtocolDecl*)
Line
Count
Source
254
3.17k
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
255
256
321M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
27.3M
    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::VarDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
31.2M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
578
    reference operator*() const { return Current; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
15.1k
    reference operator*() const { return Current; }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
3.45k
    reference operator*() const { return Current; }
257
    pointer operator->() const { return Current; }
258
259
42.7M
    redecl_iterator& operator++() {
260
42.7M
      assert(Current && "Advancing while iterator has reached end");
261
42.7M
      // Sanity check to avoid infinite loop on invalid redecl chain.
262
42.7M
      if (Current->isFirstDecl()) {
263
38.7M
        if (PassedFirst) {
264
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
265
0
          Current = nullptr;
266
0
          return *this;
267
0
        }
268
38.7M
        PassedFirst = true;
269
38.7M
      }
270
42.7M
271
42.7M
      // Get either previous decl or latest decl.
272
42.7M
      decl_type *Next = Current->getNextRedeclaration();
273
42.7M
      Current = (Next != Starter) ? 
Next19.0M
:
nullptr23.7M
;
274
42.7M
      return *this;
275
42.7M
    }
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::operator++()
Line
Count
Source
259
14.4M
    redecl_iterator& operator++() {
260
14.4M
      assert(Current && "Advancing while iterator has reached end");
261
14.4M
      // Sanity check to avoid infinite loop on invalid redecl chain.
262
14.4M
      if (Current->isFirstDecl()) {
263
13.6M
        if (PassedFirst) {
264
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
265
0
          Current = nullptr;
266
0
          return *this;
267
0
        }
268
13.6M
        PassedFirst = true;
269
13.6M
      }
270
14.4M
271
14.4M
      // Get either previous decl or latest decl.
272
14.4M
      decl_type *Next = Current->getNextRedeclaration();
273
14.4M
      Current = (Next != Starter) ? 
Next2.00M
:
nullptr12.4M
;
274
14.4M
      return *this;
275
14.4M
    }
clang::Redeclarable<clang::TagDecl>::redecl_iterator::operator++()
Line
Count
Source
259
19.7M
    redecl_iterator& operator++() {
260
19.7M
      assert(Current && "Advancing while iterator has reached end");
261
19.7M
      // Sanity check to avoid infinite loop on invalid redecl chain.
262
19.7M
      if (Current->isFirstDecl()) {
263
18.5M
        if (PassedFirst) {
264
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
265
0
          Current = nullptr;
266
0
          return *this;
267
0
        }
268
18.5M
        PassedFirst = true;
269
18.5M
      }
270
19.7M
271
19.7M
      // Get either previous decl or latest decl.
272
19.7M
      decl_type *Next = Current->getNextRedeclaration();
273
19.7M
      Current = (Next != Starter) ? 
Next12.0M
:
nullptr7.64M
;
274
19.7M
      return *this;
275
19.7M
    }
clang::Redeclarable<clang::VarDecl>::redecl_iterator::operator++()
Line
Count
Source
259
8.56M
    redecl_iterator& operator++() {
260
8.56M
      assert(Current && "Advancing while iterator has reached end");
261
8.56M
      // Sanity check to avoid infinite loop on invalid redecl chain.
262
8.56M
      if (Current->isFirstDecl()) {
263
6.50M
        if (PassedFirst) {
264
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
265
0
          Current = nullptr;
266
0
          return *this;
267
0
        }
268
6.50M
        PassedFirst = true;
269
6.50M
      }
270
8.56M
271
8.56M
      // Get either previous decl or latest decl.
272
8.56M
      decl_type *Next = Current->getNextRedeclaration();
273
8.56M
      Current = (Next != Starter) ? 
Next4.95M
:
nullptr3.60M
;
274
8.56M
      return *this;
275
8.56M
    }
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::operator++()
Line
Count
Source
259
578
    redecl_iterator& operator++() {
260
578
      assert(Current && "Advancing while iterator has reached end");
261
578
      // Sanity check to avoid infinite loop on invalid redecl chain.
262
578
      if (Current->isFirstDecl()) {
263
570
        if (PassedFirst) {
264
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
265
0
          Current = nullptr;
266
0
          return *this;
267
0
        }
268
570
        PassedFirst = true;
269
570
      }
270
578
271
578
      // Get either previous decl or latest decl.
272
578
      decl_type *Next = Current->getNextRedeclaration();
273
578
      Current = (Next != Starter) ? 
Next8
:
nullptr570
;
274
578
      return *this;
275
578
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::operator++()
Line
Count
Source
259
15.1k
    redecl_iterator& operator++() {
260
15.1k
      assert(Current && "Advancing while iterator has reached end");
261
15.1k
      // Sanity check to avoid infinite loop on invalid redecl chain.
262
15.1k
      if (Current->isFirstDecl()) {
263
12.8k
        if (PassedFirst) {
264
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
265
0
          Current = nullptr;
266
0
          return *this;
267
0
        }
268
12.8k
        PassedFirst = true;
269
12.8k
      }
270
15.1k
271
15.1k
      // Get either previous decl or latest decl.
272
15.1k
      decl_type *Next = Current->getNextRedeclaration();
273
15.1k
      Current = (Next != Starter) ? 
Next2.25k
:
nullptr12.8k
;
274
15.1k
      return *this;
275
15.1k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::operator++()
Line
Count
Source
259
3.45k
    redecl_iterator& operator++() {
260
3.45k
      assert(Current && "Advancing while iterator has reached end");
261
3.45k
      // Sanity check to avoid infinite loop on invalid redecl chain.
262
3.45k
      if (Current->isFirstDecl()) {
263
3.17k
        if (PassedFirst) {
264
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
265
0
          Current = nullptr;
266
0
          return *this;
267
0
        }
268
3.17k
        PassedFirst = true;
269
3.17k
      }
270
3.45k
271
3.45k
      // Get either previous decl or latest decl.
272
3.45k
      decl_type *Next = Current->getNextRedeclaration();
273
3.45k
      Current = (Next != Starter) ? 
Next283
:
nullptr3.17k
;
274
3.45k
      return *this;
275
3.45k
    }
276
277
    redecl_iterator operator++(int) {
278
      redecl_iterator tmp(*this);
279
      ++(*this);
280
      return tmp;
281
    }
282
283
11
    friend bool operator==(redecl_iterator x, redecl_iterator y) {
284
11
      return x.Current == y.Current;
285
11
    }
286
344M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
287
344M
      return x.Current != y.Current;
288
344M
    }
clang::operator!=(clang::Redeclarable<clang::TagDecl>::redecl_iterator, clang::Redeclarable<clang::TagDecl>::redecl_iterator)
Line
Count
Source
286
270M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
287
270M
      return x.Current != y.Current;
288
270M
    }
clang::operator!=(clang::Redeclarable<clang::VarDecl>::redecl_iterator, clang::Redeclarable<clang::VarDecl>::redecl_iterator)
Line
Count
Source
286
34.8M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
287
34.8M
      return x.Current != y.Current;
288
34.8M
    }
clang::operator!=(clang::Redeclarable<clang::FunctionDecl>::redecl_iterator, clang::Redeclarable<clang::FunctionDecl>::redecl_iterator)
Line
Count
Source
286
39.8M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
287
39.8M
      return x.Current != y.Current;
288
39.8M
    }
clang::operator!=(clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator, clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator)
Line
Count
Source
286
1.14k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
287
1.14k
      return x.Current != y.Current;
288
1.14k
    }
clang::operator!=(clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator, clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator)
Line
Count
Source
286
27.9k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
287
27.9k
      return x.Current != y.Current;
288
27.9k
    }
clang::operator!=(clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator, clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator)
Line
Count
Source
286
6.62k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
287
6.62k
      return x.Current != y.Current;
288
6.62k
    }
289
  };
290
291
  using redecl_range = llvm::iterator_range<redecl_iterator>;
292
293
  /// Returns an iterator range for all the redeclarations of the same
294
  /// decl. It will iterate at least once (when this decl is the only one).
295
302M
  redecl_range redecls() const {
296
302M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
297
302M
                            static_cast<const decl_type *>(this))),
298
302M
                        redecl_iterator());
299
302M
  }
clang::Redeclarable<clang::VarDecl>::redecls() const
Line
Count
Source
295
26.2M
  redecl_range redecls() const {
296
26.2M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
297
26.2M
                            static_cast<const decl_type *>(this))),
298
26.2M
                        redecl_iterator());
299
26.2M
  }
clang::Redeclarable<clang::FunctionDecl>::redecls() const
Line
Count
Source
295
25.3M
  redecl_range redecls() const {
296
25.3M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
297
25.3M
                            static_cast<const decl_type *>(this))),
298
25.3M
                        redecl_iterator());
299
25.3M
  }
clang::Redeclarable<clang::TagDecl>::redecls() const
Line
Count
Source
295
250M
  redecl_range redecls() const {
296
250M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
297
250M
                            static_cast<const decl_type *>(this))),
298
250M
                        redecl_iterator());
299
250M
  }
clang::Redeclarable<clang::UsingShadowDecl>::redecls() const
Line
Count
Source
295
570
  redecl_range redecls() const {
296
570
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
297
570
                            static_cast<const decl_type *>(this))),
298
570
                        redecl_iterator());
299
570
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecls() const
Line
Count
Source
295
12.8k
  redecl_range redecls() const {
296
12.8k
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
297
12.8k
                            static_cast<const decl_type *>(this))),
298
12.8k
                        redecl_iterator());
299
12.8k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecls() const
Line
Count
Source
295
3.17k
  redecl_range redecls() const {
296
3.17k
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
297
3.17k
                            static_cast<const decl_type *>(this))),
298
3.17k
                        redecl_iterator());
299
3.17k
  }
300
301
  redecl_iterator redecls_begin() const { return redecls().begin(); }
302
11
  redecl_iterator redecls_end() const { return redecls().end(); }
303
};
304
305
/// Get the primary declaration for a declaration from an AST file. That
306
/// will be the first-loaded declaration.
307
Decl *getPrimaryMergedDecl(Decl *D);
308
309
/// Provides common interface for the Decls that cannot be redeclared,
310
/// but can be merged if the same declaration is brought in from multiple
311
/// modules.
312
template<typename decl_type>
313
class Mergeable {
314
public:
315
  Mergeable() = default;
316
317
  /// Return the first declaration of this declaration or itself if this
318
  /// is the only declaration.
319
6.39M
  decl_type *getFirstDecl() {
320
6.39M
    auto *D = static_cast<decl_type *>(this);
321
6.39M
    if (!D->isFromASTFile())
322
6.36M
      return D;
323
22.6k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
324
22.6k
  }
clang::Mergeable<clang::FieldDecl>::getFirstDecl()
Line
Count
Source
319
5.50M
  decl_type *getFirstDecl() {
320
5.50M
    auto *D = static_cast<decl_type *>(this);
321
5.50M
    if (!D->isFromASTFile())
322
5.48M
      return D;
323
20.9k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
324
20.9k
  }
clang::Mergeable<clang::UsingPackDecl>::getFirstDecl()
Line
Count
Source
319
3
  decl_type *getFirstDecl() {
320
3
    auto *D = static_cast<decl_type *>(this);
321
3
    if (!D->isFromASTFile())
322
2
      return D;
323
1
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
324
1
  }
clang::Mergeable<clang::UnresolvedUsingTypenameDecl>::getFirstDecl()
Line
Count
Source
319
375
  decl_type *getFirstDecl() {
320
375
    auto *D = static_cast<decl_type *>(this);
321
375
    if (!D->isFromASTFile())
322
271
      return D;
323
104
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
324
104
  }
clang::Mergeable<clang::UsingDecl>::getFirstDecl()
Line
Count
Source
319
222k
  decl_type *getFirstDecl() {
320
222k
    auto *D = static_cast<decl_type *>(this);
321
222k
    if (!D->isFromASTFile())
322
222k
      return D;
323
449
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
324
449
  }
clang::Mergeable<clang::EnumConstantDecl>::getFirstDecl()
Line
Count
Source
319
641k
  decl_type *getFirstDecl() {
320
641k
    auto *D = static_cast<decl_type *>(this);
321
641k
    if (!D->isFromASTFile())
322
640k
      return D;
323
865
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
324
865
  }
clang::Mergeable<clang::IndirectFieldDecl>::getFirstDecl()
Line
Count
Source
319
22.2k
  decl_type *getFirstDecl() {
320
22.2k
    auto *D = static_cast<decl_type *>(this);
321
22.2k
    if (!D->isFromASTFile())
322
22.0k
      return D;
323
165
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
324
165
  }
clang::Mergeable<clang::UnresolvedUsingValueDecl>::getFirstDecl()
Line
Count
Source
319
913
  decl_type *getFirstDecl() {
320
913
    auto *D = static_cast<decl_type *>(this);
321
913
    if (!D->isFromASTFile())
322
811
      return D;
323
102
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
324
102
  }
325
326
  /// Return the first declaration of this declaration or itself if this
327
  /// is the only declaration.
328
3.13M
  const decl_type *getFirstDecl() const {
329
3.13M
    const auto *D = static_cast<const decl_type *>(this);
330
3.13M
    if (!D->isFromASTFile())
331
3.10M
      return D;
332
24.9k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
333
24.9k
  }
clang::Mergeable<clang::FieldDecl>::getFirstDecl() const
Line
Count
Source
328
3.13M
  const decl_type *getFirstDecl() const {
329
3.13M
    const auto *D = static_cast<const decl_type *>(this);
330
3.13M
    if (!D->isFromASTFile())
331
3.10M
      return D;
332
24.9k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
333
24.9k
  }
Unexecuted instantiation: clang::Mergeable<clang::UsingPackDecl>::getFirstDecl() const
clang::Mergeable<clang::UnresolvedUsingTypenameDecl>::getFirstDecl() const
Line
Count
Source
328
2
  const decl_type *getFirstDecl() const {
329
2
    const auto *D = static_cast<const decl_type *>(this);
330
2
    if (!D->isFromASTFile())
331
2
      return D;
332
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
333
0
  }
clang::Mergeable<clang::UsingDecl>::getFirstDecl() const
Line
Count
Source
328
15
  const decl_type *getFirstDecl() const {
329
15
    const auto *D = static_cast<const decl_type *>(this);
330
15
    if (!D->isFromASTFile())
331
15
      return D;
332
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
333
0
  }
clang::Mergeable<clang::EnumConstantDecl>::getFirstDecl() const
Line
Count
Source
328
64
  const decl_type *getFirstDecl() const {
329
64
    const auto *D = static_cast<const decl_type *>(this);
330
64
    if (!D->isFromASTFile())
331
64
      return D;
332
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
333
0
  }
clang::Mergeable<clang::IndirectFieldDecl>::getFirstDecl() const
Line
Count
Source
328
9
  const decl_type *getFirstDecl() const {
329
9
    const auto *D = static_cast<const decl_type *>(this);
330
9
    if (!D->isFromASTFile())
331
9
      return D;
332
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
333
0
  }
clang::Mergeable<clang::UnresolvedUsingValueDecl>::getFirstDecl() const
Line
Count
Source
328
2
  const decl_type *getFirstDecl() const {
329
2
    const auto *D = static_cast<const decl_type *>(this);
330
2
    if (!D->isFromASTFile())
331
2
      return D;
332
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
333
0
  }
334
335
  /// Returns true if this is the first declaration.
336
  bool isFirstDecl() const { return getFirstDecl() == this; }
337
};
338
339
/// A wrapper class around a pointer that always points to its canonical
340
/// declaration.
341
///
342
/// CanonicalDeclPtr<decl_type> behaves just like decl_type*, except we call
343
/// decl_type::getCanonicalDecl() on construction.
344
///
345
/// This is useful for hashtables that you want to be keyed on a declaration's
346
/// canonical decl -- if you use CanonicalDeclPtr as the key, you don't need to
347
/// remember to call getCanonicalDecl() everywhere.
348
template <typename decl_type> class CanonicalDeclPtr {
349
public:
350
22.3k
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::CanonicalDeclPtr()
Line
Count
Source
350
750
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::FunctionDecl>::CanonicalDeclPtr()
Line
Count
Source
350
21.6k
  CanonicalDeclPtr() = default;
351
  CanonicalDeclPtr(decl_type *Ptr)
352
13.4k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::CanonicalDeclPtr(clang::CXXRecordDecl const*)
Line
Count
Source
352
137
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::FunctionDecl>::CanonicalDeclPtr(clang::FunctionDecl*)
Line
Count
Source
352
13.3k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
353
  CanonicalDeclPtr(const CanonicalDeclPtr &) = default;
354
  CanonicalDeclPtr &operator=(const CanonicalDeclPtr &) = default;
355
356
179
  operator decl_type *() { return Ptr; }
357
164k
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::operator clang::CXXRecordDecl const*() const
Line
Count
Source
357
15.8k
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::FunctionDecl>::operator clang::FunctionDecl const*() const
Line
Count
Source
357
148k
  operator const decl_type *() const { return Ptr; }
358
359
  decl_type *operator->() { return Ptr; }
360
  const decl_type *operator->() const { return Ptr; }
361
362
  decl_type &operator*() { return *Ptr; }
363
  const decl_type &operator*() const { return *Ptr; }
364
365
private:
366
  friend struct llvm::DenseMapInfo<CanonicalDeclPtr<decl_type>>;
367
368
  decl_type *Ptr = nullptr;
369
};
370
371
} // namespace clang
372
373
namespace llvm {
374
375
template <typename decl_type>
376
struct DenseMapInfo<clang::CanonicalDeclPtr<decl_type>> {
377
  using CanonicalDeclPtr = clang::CanonicalDeclPtr<decl_type>;
378
  using BaseInfo = DenseMapInfo<decl_type *>;
379
380
12.1k
  static CanonicalDeclPtr getEmptyKey() {
381
12.1k
    // Construct our CanonicalDeclPtr this way because the regular constructor
382
12.1k
    // would dereference P.Ptr, which is not allowed.
383
12.1k
    CanonicalDeclPtr P;
384
12.1k
    P.Ptr = BaseInfo::getEmptyKey();
385
12.1k
    return P;
386
12.1k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::getEmptyKey()
Line
Count
Source
380
499
  static CanonicalDeclPtr getEmptyKey() {
381
499
    // Construct our CanonicalDeclPtr this way because the regular constructor
382
499
    // would dereference P.Ptr, which is not allowed.
383
499
    CanonicalDeclPtr P;
384
499
    P.Ptr = BaseInfo::getEmptyKey();
385
499
    return P;
386
499
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::getEmptyKey()
Line
Count
Source
380
11.6k
  static CanonicalDeclPtr getEmptyKey() {
381
11.6k
    // Construct our CanonicalDeclPtr this way because the regular constructor
382
11.6k
    // would dereference P.Ptr, which is not allowed.
383
11.6k
    CanonicalDeclPtr P;
384
11.6k
    P.Ptr = BaseInfo::getEmptyKey();
385
11.6k
    return P;
386
11.6k
  }
387
388
8.64k
  static CanonicalDeclPtr getTombstoneKey() {
389
8.64k
    CanonicalDeclPtr P;
390
8.64k
    P.Ptr = BaseInfo::getTombstoneKey();
391
8.64k
    return P;
392
8.64k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::getTombstoneKey()
Line
Count
Source
388
251
  static CanonicalDeclPtr getTombstoneKey() {
389
251
    CanonicalDeclPtr P;
390
251
    P.Ptr = BaseInfo::getTombstoneKey();
391
251
    return P;
392
251
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::getTombstoneKey()
Line
Count
Source
388
8.39k
  static CanonicalDeclPtr getTombstoneKey() {
389
8.39k
    CanonicalDeclPtr P;
390
8.39k
    P.Ptr = BaseInfo::getTombstoneKey();
391
8.39k
    return P;
392
8.39k
  }
393
394
7.78k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
395
7.78k
    return BaseInfo::getHashValue(P);
396
7.78k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::getHashValue(clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&)
Line
Count
Source
394
137
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
395
137
    return BaseInfo::getHashValue(P);
396
137
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::getHashValue(clang::CanonicalDeclPtr<clang::FunctionDecl> const&)
Line
Count
Source
394
7.64k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
395
7.64k
    return BaseInfo::getHashValue(P);
396
7.64k
  }
397
398
  static bool isEqual(const CanonicalDeclPtr &LHS,
399
76.1k
                      const CanonicalDeclPtr &RHS) {
400
76.1k
    return BaseInfo::isEqual(LHS, RHS);
401
76.1k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::isEqual(clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&, clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&)
Line
Count
Source
399
7.83k
                      const CanonicalDeclPtr &RHS) {
400
7.83k
    return BaseInfo::isEqual(LHS, RHS);
401
7.83k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::isEqual(clang::CanonicalDeclPtr<clang::FunctionDecl> const&, clang::CanonicalDeclPtr<clang::FunctionDecl> const&)
Line
Count
Source
399
68.3k
                      const CanonicalDeclPtr &RHS) {
400
68.3k
    return BaseInfo::isEqual(LHS, RHS);
401
68.3k
  }
402
};
403
404
} // namespace llvm
405
406
#endif // LLVM_CLANG_AST_REDECLARABLE_H