Coverage Report

Created: 2018-11-16 02:38

/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.4M
        : 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.41M
        : 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.9M
        : 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.30M
        : 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.35M
        : 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
258
        : 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
121k
        : 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
30.0k
        : 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
9.05k
    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
541k
    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.8k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::NamespaceDecl>::DeclLink::PreviousTag, clang::NamespaceDecl*)
Line
Count
Source
114
75.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.6k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
115
116
446M
    bool isFirst() const {
117
446M
      return Link.is<KnownLatest>() ||
118
446M
             // FIXME: 'template' is required on the next line due to an
119
446M
             // apparent clang bug.
120
446M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()284M
;
121
446M
    }
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.33M
;
121
11.4M
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::isFirst() const
Line
Count
Source
116
25.5M
    bool isFirst() const {
117
25.5M
      return Link.is<KnownLatest>() ||
118
25.5M
             // FIXME: 'template' is required on the next line due to an
119
25.5M
             // apparent clang bug.
120
25.5M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()7.71M
;
121
25.5M
    }
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.85k
    bool isFirst() const {
117
3.85k
      return Link.is<KnownLatest>() ||
118
3.85k
             // FIXME: 'template' is required on the next line due to an
119
3.85k
             // apparent clang bug.
120
3.85k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()486
;
121
3.85k
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::isFirst() const
Line
Count
Source
116
382M
    bool isFirst() const {
117
382M
      return Link.is<KnownLatest>() ||
118
382M
             // FIXME: 'template' is required on the next line due to an
119
382M
             // apparent clang bug.
120
382M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()267M
;
121
382M
    }
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.04k
    bool isFirst() const {
117
1.04k
      return Link.is<KnownLatest>() ||
118
1.04k
             // FIXME: 'template' is required on the next line due to an
119
1.04k
             // apparent clang bug.
120
1.04k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()371
;
121
1.04k
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::isFirst() const
Line
Count
Source
116
1.29M
    bool isFirst() const {
117
1.29M
      return Link.is<KnownLatest>() ||
118
1.29M
             // FIXME: 'template' is required on the next line due to an
119
1.29M
             // apparent clang bug.
120
1.29M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()929k
;
121
1.29M
    }
122
123
464M
    decl_type *getPrevious(const decl_type *D) const {
124
464M
      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
464M
135
464M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))457M
;
136
464M
    }
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.89M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
2.89M
        if (NKL.is<Previous>())
127
2.89M
          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.5M
    decl_type *getPrevious(const decl_type *D) const {
124
55.5M
      if (Link.is<NotKnownLatest>()) {
125
12.4M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
12.4M
        if (NKL.is<Previous>())
127
2.07M
          return static_cast<decl_type*>(NKL.get<Previous>());
128
10.3M
129
10.3M
        // Allocate the generational 'most recent' cache now, if needed.
130
10.3M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
10.3M
                               NKL.get<UninitializedLatest>()),
132
10.3M
                           const_cast<decl_type *>(D));
133
10.3M
      }
134
55.5M
135
55.5M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))53.5M
;
136
55.5M
    }
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.3M
    decl_type *getPrevious(const decl_type *D) const {
124
47.3M
      if (Link.is<NotKnownLatest>()) {
125
7.91M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
7.91M
        if (NKL.is<Previous>())
127
1.24M
          return static_cast<decl_type*>(NKL.get<Previous>());
128
6.67M
129
6.67M
        // Allocate the generational 'most recent' cache now, if needed.
130
6.67M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
6.67M
                               NKL.get<UninitializedLatest>()),
132
6.67M
                           const_cast<decl_type *>(D));
133
6.67M
      }
134
47.3M
135
47.3M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))46.1M
;
136
47.3M
    }
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.88k
;
136
5.45k
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::getPrevious(clang::TypedefNameDecl const*) const
Line
Count
Source
123
975k
    decl_type *getPrevious(const decl_type *D) const {
124
975k
      if (Link.is<NotKnownLatest>()) {
125
321k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
321k
        if (NKL.is<Previous>())
127
9.62k
          return static_cast<decl_type*>(NKL.get<Previous>());
128
311k
129
311k
        // Allocate the generational 'most recent' cache now, if needed.
130
311k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
311k
                               NKL.get<UninitializedLatest>()),
132
311k
                           const_cast<decl_type *>(D));
133
311k
      }
134
975k
135
975k
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))966k
;
136
975k
    }
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
735k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
735k
        if (NKL.is<Previous>())
127
198k
          return static_cast<decl_type*>(NKL.get<Previous>());
128
536k
129
536k
        // Allocate the generational 'most recent' cache now, if needed.
130
536k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
536k
                               NKL.get<UninitializedLatest>()),
132
536k
                           const_cast<decl_type *>(D));
133
536k
      }
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
576k
    decl_type *getPrevious(const decl_type *D) const {
124
576k
      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
576k
135
576k
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))209k
;
136
576k
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::getPrevious(clang::NamespaceAliasDecl const*) const
Line
Count
Source
123
212
    decl_type *getPrevious(const decl_type *D) const {
124
212
      if (Link.is<NotKnownLatest>()) {
125
66
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
126
66
        if (NKL.is<Previous>())
127
1
          return static_cast<decl_type*>(NKL.get<Previous>());
128
65
129
65
        // Allocate the generational 'most recent' cache now, if needed.
130
65
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
131
65
                               NKL.get<UninitializedLatest>()),
132
65
                           const_cast<decl_type *>(D));
133
65
      }
134
212
135
212
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))211
;
136
212
    }
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.25k
    void setPrevious(decl_type *D) {
139
2.25k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
140
2.25k
      Link = Previous(D);
141
2.25k
    }
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.84M
    void setLatest(decl_type *D) {
144
5.84M
      assert(isFirst() && "decl became canonical unexpectedly");
145
5.84M
      if (Link.is<NotKnownLatest>()) {
146
3.96M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
3.96M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
3.96M
                               NKL.get<UninitializedLatest>()),
149
3.96M
                           D);
150
3.96M
      } 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.84M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::setLatest(clang::NamespaceDecl*)
Line
Count
Source
143
122k
    void setLatest(decl_type *D) {
144
122k
      assert(isFirst() && "decl became canonical unexpectedly");
145
122k
      if (Link.is<NotKnownLatest>()) {
146
46.5k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
46.5k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
46.5k
                               NKL.get<UninitializedLatest>()),
149
46.5k
                           D);
150
75.6k
      } else {
151
75.6k
        auto Latest = Link.get<KnownLatest>();
152
75.6k
        Latest.set(D);
153
75.6k
        Link = Latest;
154
75.6k
      }
155
122k
    }
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.4k
    void setLatest(decl_type *D) {
144
30.4k
      assert(isFirst() && "decl became canonical unexpectedly");
145
30.4k
      if (Link.is<NotKnownLatest>()) {
146
23.2k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
23.2k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
23.2k
                               NKL.get<UninitializedLatest>()),
149
23.2k
                           D);
150
23.2k
      } 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.4k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::setLatest(clang::ObjCProtocolDecl*)
Line
Count
Source
143
3.92k
    void setLatest(decl_type *D) {
144
3.92k
      assert(isFirst() && "decl became canonical unexpectedly");
145
3.92k
      if (Link.is<NotKnownLatest>()) {
146
3.43k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
3.43k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
3.43k
                               NKL.get<UninitializedLatest>()),
149
3.43k
                           D);
150
3.43k
      } else {
151
488
        auto Latest = Link.get<KnownLatest>();
152
488
        Latest.set(D);
153
488
        Link = Latest;
154
488
      }
155
3.92k
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::setLatest(clang::RedeclarableTemplateDecl*)
Line
Count
Source
143
350k
    void setLatest(decl_type *D) {
144
350k
      assert(isFirst() && "decl became canonical unexpectedly");
145
350k
      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.4k
        auto Latest = Link.get<KnownLatest>();
152
89.4k
        Latest.set(D);
153
89.4k
        Link = Latest;
154
89.4k
      }
155
350k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::setLatest(clang::TagDecl*)
Line
Count
Source
143
4.38M
    void setLatest(decl_type *D) {
144
4.38M
      assert(isFirst() && "decl became canonical unexpectedly");
145
4.38M
      if (Link.is<NotKnownLatest>()) {
146
3.31M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
3.31M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
3.31M
                               NKL.get<UninitializedLatest>()),
149
3.31M
                           D);
150
3.31M
      } 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.38M
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::setLatest(clang::TypedefNameDecl*)
Line
Count
Source
143
12.4k
    void setLatest(decl_type *D) {
144
12.4k
      assert(isFirst() && "decl became canonical unexpectedly");
145
12.4k
      if (Link.is<NotKnownLatest>()) {
146
5.61k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
5.61k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
5.61k
                               NKL.get<UninitializedLatest>()),
149
5.61k
                           D);
150
6.88k
      } else {
151
6.88k
        auto Latest = Link.get<KnownLatest>();
152
6.88k
        Latest.set(D);
153
6.88k
        Link = Latest;
154
6.88k
      }
155
12.4k
    }
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
562k
    void setLatest(decl_type *D) {
144
562k
      assert(isFirst() && "decl became canonical unexpectedly");
145
562k
      if (Link.is<NotKnownLatest>()) {
146
20.8k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
20.8k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
20.8k
                               NKL.get<UninitializedLatest>()),
149
20.8k
                           D);
150
541k
      } else {
151
541k
        auto Latest = Link.get<KnownLatest>();
152
541k
        Latest.set(D);
153
541k
        Link = Latest;
154
541k
      }
155
562k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::setLatest(clang::VarDecl*)
Line
Count
Source
143
209k
    void setLatest(decl_type *D) {
144
209k
      assert(isFirst() && "decl became canonical unexpectedly");
145
209k
      if (Link.is<NotKnownLatest>()) {
146
133k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
147
133k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
148
133k
                               NKL.get<UninitializedLatest>()),
149
133k
                           D);
150
133k
      } else {
151
76.6k
        auto Latest = Link.get<KnownLatest>();
152
76.6k
        Latest.set(D);
153
76.6k
        Link = Latest;
154
76.6k
      }
155
209k
    }
156
157
5.50k
    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.04k
    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
130
        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.90k
    Decl *getLatestNotUpdated() const {
160
4.90k
      assert(isFirst() && "expected a canonical decl");
161
4.90k
      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
160
    Decl *getLatestNotUpdated() const {
160
160
      assert(isFirst() && "expected a canonical decl");
161
160
      if (Link.is<NotKnownLatest>())
162
69
        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
9.05k
  static DeclLink PreviousDeclLink(decl_type *D) {
168
9.05k
    return DeclLink(DeclLink::PreviousLink, D);
169
9.05k
  }
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
541k
  static DeclLink PreviousDeclLink(decl_type *D) {
168
541k
    return DeclLink(DeclLink::PreviousLink, D);
169
541k
  }
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.8k
  static DeclLink PreviousDeclLink(decl_type *D) {
168
76.8k
    return DeclLink(DeclLink::PreviousLink, D);
169
76.8k
  }
clang::Redeclarable<clang::NamespaceDecl>::PreviousDeclLink(clang::NamespaceDecl*)
Line
Count
Source
167
75.1k
  static DeclLink PreviousDeclLink(decl_type *D) {
168
75.1k
    return DeclLink(DeclLink::PreviousLink, D);
169
75.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.6k
  static DeclLink PreviousDeclLink(decl_type *D) {
168
89.6k
    return DeclLink(DeclLink::PreviousLink, D);
169
89.6k
  }
170
171
34.4M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
34.4M
    return DeclLink(DeclLink::LatestLink, Ctx);
173
34.4M
  }
clang::Redeclarable<clang::TypedefNameDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
2.41M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
2.41M
    return DeclLink(DeclLink::LatestLink, Ctx);
173
2.41M
  }
clang::Redeclarable<clang::VarDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
17.9M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
17.9M
    return DeclLink(DeclLink::LatestLink, Ctx);
173
17.9M
  }
clang::Redeclarable<clang::FunctionDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
8.30M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
8.30M
    return DeclLink(DeclLink::LatestLink, Ctx);
173
8.30M
  }
clang::Redeclarable<clang::TagDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
4.35M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
4.35M
    return DeclLink(DeclLink::LatestLink, Ctx);
173
4.35M
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
258
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
258
    return DeclLink(DeclLink::LatestLink, Ctx);
173
258
  }
clang::Redeclarable<clang::NamespaceDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
171
121k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
121k
    return DeclLink(DeclLink::LatestLink, Ctx);
173
121k
  }
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
30.0k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
172
30.0k
    return DeclLink(DeclLink::LatestLink, Ctx);
173
30.0k
  }
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
464M
  decl_type *getNextRedeclaration() const {
191
464M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
464M
  }
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.5M
  decl_type *getNextRedeclaration() const {
191
55.5M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
55.5M
  }
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.3M
  decl_type *getNextRedeclaration() const {
191
47.3M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
47.3M
  }
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
576k
  decl_type *getNextRedeclaration() const {
191
576k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
576k
  }
clang::Redeclarable<clang::TypedefNameDecl>::getNextRedeclaration() const
Line
Count
Source
190
975k
  decl_type *getNextRedeclaration() const {
191
975k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
975k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getNextRedeclaration() const
Line
Count
Source
190
212
  decl_type *getNextRedeclaration() const {
191
212
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
192
212
  }
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.4M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::TypedefNameDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
2.41M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::VarDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
17.9M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::FunctionDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
8.30M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::TagDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
4.35M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::NamespaceAliasDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
258
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::NamespaceDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
200
121k
        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
30.0k
        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.27M
      return getNextRedeclaration();
207
10.7M
    return nullptr;
208
10.7M
  }
clang::Redeclarable<clang::VarDecl>::getPreviousDecl()
Line
Count
Source
204
495k
  decl_type *getPreviousDecl() {
205
495k
    if (!RedeclLink.isFirst())
206
30.1k
      return getNextRedeclaration();
207
465k
    return nullptr;
208
465k
  }
clang::Redeclarable<clang::FunctionDecl>::getPreviousDecl()
Line
Count
Source
204
5.33M
  decl_type *getPreviousDecl() {
205
5.33M
    if (!RedeclLink.isFirst())
206
319k
      return getNextRedeclaration();
207
5.01M
    return nullptr;
208
5.01M
  }
clang::Redeclarable<clang::TagDecl>::getPreviousDecl()
Line
Count
Source
204
5.12M
  decl_type *getPreviousDecl() {
205
5.12M
    if (!RedeclLink.isFirst())
206
1.74M
      return getNextRedeclaration();
207
3.38M
    return nullptr;
208
3.38M
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getPreviousDecl()
Line
Count
Source
204
1.28M
  decl_type *getPreviousDecl() {
205
1.28M
    if (!RedeclLink.isFirst())
206
161k
      return getNextRedeclaration();
207
1.12M
    return nullptr;
208
1.12M
  }
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
782k
  decl_type *getPreviousDecl() {
205
782k
    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.3k
  decl_type *getPreviousDecl() {
205
32.3k
    if (!RedeclLink.isFirst())
206
5.02k
      return getNextRedeclaration();
207
27.3k
    return nullptr;
208
27.3k
  }
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.31k
  const decl_type *getPreviousDecl() const {
210
2.31k
    return const_cast<decl_type *>(
211
2.31k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
2.31k
  }
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
665
  const decl_type *getPreviousDecl() const {
210
665
    return const_cast<decl_type *>(
211
665
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
665
  }
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
460k
  const decl_type *getPreviousDecl() const {
210
460k
    return const_cast<decl_type *>(
211
460k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
212
460k
  }
213
214
  /// Return the first declaration of this declaration or itself if this
215
  /// is the only declaration.
216
835M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::TagDecl>::getFirstDecl()
Line
Count
Source
216
361M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::VarDecl>::getFirstDecl()
Line
Count
Source
216
108M
  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
277M
  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
185k
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::NamespaceAliasDecl>::getFirstDecl()
Line
Count
Source
216
419
  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.6M
  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.3M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::TagDecl>::getFirstDecl() const
Line
Count
Source
220
208k
  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.32k
  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.86M
  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
433M
  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.1M
  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.20k
  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.53k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::NamespaceDecl>::isFirstDecl() const
Line
Count
Source
223
382M
  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
908
  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
398M
  decl_type *getMostRecentDecl() {
227
398M
    return getFirstDecl()->getNextRedeclaration();
228
398M
  }
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.6M
  decl_type *getMostRecentDecl() {
227
38.6M
    return getFirstDecl()->getNextRedeclaration();
228
38.6M
  }
clang::Redeclarable<clang::FunctionDecl>::getMostRecentDecl()
Line
Count
Source
226
29.0M
  decl_type *getMostRecentDecl() {
227
29.0M
    return getFirstDecl()->getNextRedeclaration();
228
29.0M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getMostRecentDecl()
Line
Count
Source
226
4.70k
  decl_type *getMostRecentDecl() {
227
4.70k
    return getFirstDecl()->getNextRedeclaration();
228
4.70k
  }
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.86M
  decl_type *getMostRecentDecl() {
227
7.86M
    return getFirstDecl()->getNextRedeclaration();
228
7.86M
  }
clang::Redeclarable<clang::TypedefNameDecl>::getMostRecentDecl()
Line
Count
Source
226
650k
  decl_type *getMostRecentDecl() {
227
650k
    return getFirstDecl()->getNextRedeclaration();
228
650k
  }
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
129
  decl_type *getMostRecentDecl() {
227
129
    return getFirstDecl()->getNextRedeclaration();
228
129
  }
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.32k
  const decl_type *getMostRecentDecl() const {
232
3.32k
    return getFirstDecl()->getNextRedeclaration();
233
3.32k
  }
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
857k
  const decl_type *getMostRecentDecl() const {
232
857k
    return getFirstDecl()->getNextRedeclaration();
233
857k
  }
clang::Redeclarable<clang::VarDecl>::getMostRecentDecl() const
Line
Count
Source
231
355
  const decl_type *getMostRecentDecl() const {
232
355
    return getFirstDecl()->getNextRedeclaration();
233
355
  }
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.85M
  const decl_type *getMostRecentDecl() const {
232
5.85M
    return getFirstDecl()->getNextRedeclaration();
233
5.85M
  }
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.6M
    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.3M
    redecl_iterator() = default;
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
253
577
    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.16k
    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.6M
    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.3M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::redecl_iterator(clang::UsingShadowDecl*)
Line
Count
Source
254
577
    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.16k
    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.6M
    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.3M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::operator*() const
Line
Count
Source
256
585
    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.44k
    reference operator*() const { return Current; }
257
    pointer operator->() const { return Current; }
258
259
42.9M
    redecl_iterator& operator++() {
260
42.9M
      assert(Current && "Advancing while iterator has reached end");
261
42.9M
      // Sanity check to avoid infinite loop on invalid redecl chain.
262
42.9M
      if (Current->isFirstDecl()) {
263
38.8M
        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.8M
        PassedFirst = true;
269
38.8M
      }
270
42.9M
271
42.9M
      // Get either previous decl or latest decl.
272
42.9M
      decl_type *Next = Current->getNextRedeclaration();
273
42.9M
      Current = (Next != Starter) ? 
Next19.0M
:
nullptr23.8M
;
274
42.9M
      return *this;
275
42.9M
    }
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::operator++()
Line
Count
Source
259
14.6M
    redecl_iterator& operator++() {
260
14.6M
      assert(Current && "Advancing while iterator has reached end");
261
14.6M
      // Sanity check to avoid infinite loop on invalid redecl chain.
262
14.6M
      if (Current->isFirstDecl()) {
263
13.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
13.7M
        PassedFirst = true;
269
13.7M
      }
270
14.6M
271
14.6M
      // Get either previous decl or latest decl.
272
14.6M
      decl_type *Next = Current->getNextRedeclaration();
273
14.6M
      Current = (Next != Starter) ? 
Next2.02M
:
nullptr12.6M
;
274
14.6M
      return *this;
275
14.6M
    }
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.61M
;
274
19.7M
      return *this;
275
19.7M
    }
clang::Redeclarable<clang::VarDecl>::redecl_iterator::operator++()
Line
Count
Source
259
8.55M
    redecl_iterator& operator++() {
260
8.55M
      assert(Current && "Advancing while iterator has reached end");
261
8.55M
      // Sanity check to avoid infinite loop on invalid redecl chain.
262
8.55M
      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.55M
271
8.55M
      // Get either previous decl or latest decl.
272
8.55M
      decl_type *Next = Current->getNextRedeclaration();
273
8.55M
      Current = (Next != Starter) ? 
Next4.93M
:
nullptr3.61M
;
274
8.55M
      return *this;
275
8.55M
    }
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::operator++()
Line
Count
Source
259
585
    redecl_iterator& operator++() {
260
585
      assert(Current && "Advancing while iterator has reached end");
261
585
      // Sanity check to avoid infinite loop on invalid redecl chain.
262
585
      if (Current->isFirstDecl()) {
263
577
        if (PassedFirst) {
264
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
265
0
          Current = nullptr;
266
0
          return *this;
267
0
        }
268
577
        PassedFirst = true;
269
577
      }
270
585
271
585
      // Get either previous decl or latest decl.
272
585
      decl_type *Next = Current->getNextRedeclaration();
273
585
      Current = (Next != Starter) ? 
Next8
:
nullptr577
;
274
585
      return *this;
275
585
    }
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.44k
    redecl_iterator& operator++() {
260
3.44k
      assert(Current && "Advancing while iterator has reached end");
261
3.44k
      // Sanity check to avoid infinite loop on invalid redecl chain.
262
3.44k
      if (Current->isFirstDecl()) {
263
3.16k
        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.16k
        PassedFirst = true;
269
3.16k
      }
270
3.44k
271
3.44k
      // Get either previous decl or latest decl.
272
3.44k
      decl_type *Next = Current->getNextRedeclaration();
273
3.44k
      Current = (Next != Starter) ? 
Next283
:
nullptr3.16k
;
274
3.44k
      return *this;
275
3.44k
    }
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
345M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
287
345M
      return x.Current != y.Current;
288
345M
    }
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.9M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
287
34.9M
      return x.Current != y.Current;
288
34.9M
    }
clang::operator!=(clang::Redeclarable<clang::FunctionDecl>::redecl_iterator, clang::Redeclarable<clang::FunctionDecl>::redecl_iterator)
Line
Count
Source
286
40.2M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
287
40.2M
      return x.Current != y.Current;
288
40.2M
    }
clang::operator!=(clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator, clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator)
Line
Count
Source
286
1.16k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
287
1.16k
      return x.Current != y.Current;
288
1.16k
    }
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.61k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
287
6.61k
      return x.Current != y.Current;
288
6.61k
    }
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.3M
  redecl_range redecls() const {
296
26.3M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
297
26.3M
                            static_cast<const decl_type *>(this))),
298
26.3M
                        redecl_iterator());
299
26.3M
  }
clang::Redeclarable<clang::FunctionDecl>::redecls() const
Line
Count
Source
295
25.6M
  redecl_range redecls() const {
296
25.6M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
297
25.6M
                            static_cast<const decl_type *>(this))),
298
25.6M
                        redecl_iterator());
299
25.6M
  }
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
577
  redecl_range redecls() const {
296
577
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
297
577
                            static_cast<const decl_type *>(this))),
298
577
                        redecl_iterator());
299
577
  }
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.16k
  redecl_range redecls() const {
296
3.16k
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
297
3.16k
                            static_cast<const decl_type *>(this))),
298
3.16k
                        redecl_iterator());
299
3.16k
  }
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.40M
  decl_type *getFirstDecl() {
320
6.40M
    auto *D = static_cast<decl_type *>(this);
321
6.40M
    if (!D->isFromASTFile())
322
6.37M
      return D;
323
22.8k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
324
22.8k
  }
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
21.1k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
324
21.1k
  }
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
377
  decl_type *getFirstDecl() {
320
377
    auto *D = static_cast<decl_type *>(this);
321
377
    if (!D->isFromASTFile())
322
273
      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
645k
  decl_type *getFirstDecl() {
320
645k
    auto *D = static_cast<decl_type *>(this);
321
645k
    if (!D->isFromASTFile())
322
644k
      return D;
323
864
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
324
864
  }
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
915
  decl_type *getFirstDecl() {
320
915
    auto *D = static_cast<decl_type *>(this);
321
915
    if (!D->isFromASTFile())
322
813
      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.11M
      return D;
332
25.3k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
333
25.3k
  }
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.11M
      return D;
332
25.3k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
333
25.3k
  }
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.7k
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::CanonicalDeclPtr()
Line
Count
Source
350
750
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::FunctionDecl>::CanonicalDeclPtr()
Line
Count
Source
350
22.0k
  CanonicalDeclPtr() = default;
351
  CanonicalDeclPtr(decl_type *Ptr)
352
13.6k
      : 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.5k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
353
  CanonicalDeclPtr(const CanonicalDeclPtr &) = default;
354
  CanonicalDeclPtr &operator=(const CanonicalDeclPtr &) = default;
355
356
189
  operator decl_type *() { return Ptr; }
357
166k
  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
150k
  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.4k
  static CanonicalDeclPtr getEmptyKey() {
381
12.4k
    // Construct our CanonicalDeclPtr this way because the regular constructor
382
12.4k
    // would dereference P.Ptr, which is not allowed.
383
12.4k
    CanonicalDeclPtr P;
384
12.4k
    P.Ptr = BaseInfo::getEmptyKey();
385
12.4k
    return P;
386
12.4k
  }
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.9k
  static CanonicalDeclPtr getEmptyKey() {
381
11.9k
    // Construct our CanonicalDeclPtr this way because the regular constructor
382
11.9k
    // would dereference P.Ptr, which is not allowed.
383
11.9k
    CanonicalDeclPtr P;
384
11.9k
    P.Ptr = BaseInfo::getEmptyKey();
385
11.9k
    return P;
386
11.9k
  }
387
388
8.81k
  static CanonicalDeclPtr getTombstoneKey() {
389
8.81k
    CanonicalDeclPtr P;
390
8.81k
    P.Ptr = BaseInfo::getTombstoneKey();
391
8.81k
    return P;
392
8.81k
  }
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.56k
  static CanonicalDeclPtr getTombstoneKey() {
389
8.56k
    CanonicalDeclPtr P;
390
8.56k
    P.Ptr = BaseInfo::getTombstoneKey();
391
8.56k
    return P;
392
8.56k
  }
393
394
7.92k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
395
7.92k
    return BaseInfo::getHashValue(P);
396
7.92k
  }
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.78k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
395
7.78k
    return BaseInfo::getHashValue(P);
396
7.78k
  }
397
398
  static bool isEqual(const CanonicalDeclPtr &LHS,
399
77.0k
                      const CanonicalDeclPtr &RHS) {
400
77.0k
    return BaseInfo::isEqual(LHS, RHS);
401
77.0k
  }
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.84k
                      const CanonicalDeclPtr &RHS) {
400
7.84k
    return BaseInfo::isEqual(LHS, RHS);
401
7.84k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::isEqual(clang::CanonicalDeclPtr<clang::FunctionDecl> const&, clang::CanonicalDeclPtr<clang::FunctionDecl> const&)
Line
Count
Source
399
69.2k
                      const CanonicalDeclPtr &RHS) {
400
69.2k
    return BaseInfo::isEqual(LHS, RHS);
401
69.2k
  }
402
};
403
404
} // namespace llvm
405
406
#endif // LLVM_CLANG_AST_REDECLARABLE_H