Coverage Report

Created: 2020-02-15 09:57

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/include/clang/AST/Redeclarable.h
Line
Count
Source (jump to first uncovered line)
1
//===- Redeclarable.h - Base for Decls that can be redeclared --*- C++ -*-====//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
//  This file defines the Redeclarable interface.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_CLANG_AST_REDECLARABLE_H
14
#define LLVM_CLANG_AST_REDECLARABLE_H
15
16
#include "clang/AST/ExternalASTSource.h"
17
#include "llvm/ADT/DenseMapInfo.h"
18
#include "llvm/ADT/PointerUnion.h"
19
#include "llvm/ADT/iterator_range.h"
20
#include "llvm/Support/Casting.h"
21
#include <cassert>
22
#include <cstddef>
23
#include <iterator>
24
25
namespace clang {
26
27
class ASTContext;
28
class Decl;
29
30
// Some notes on redeclarables:
31
//
32
//  - Every redeclarable is on a circular linked list.
33
//
34
//  - Every decl has a pointer to the first element of the chain _and_ a
35
//    DeclLink that may point to one of 3 possible states:
36
//      - the "previous" (temporal) element in the chain
37
//      - the "latest" (temporal) element in the chain
38
//      - the "uninitialized-latest" value (when newly-constructed)
39
//
40
//  - The first element is also often called the canonical element. Every
41
//    element has a pointer to it so that "getCanonical" can be fast.
42
//
43
//  - Most links in the chain point to previous, except the link out of
44
//    the first; it points to latest.
45
//
46
//  - Elements are called "first", "previous", "latest" or
47
//    "most-recent" when referring to temporal order: order of addition
48
//    to the chain.
49
//
50
//  - It's easiest to just ignore the implementation of DeclLink when making
51
//    sense of the redeclaration chain.
52
//
53
//  - There's also a "definition" link for several types of
54
//    redeclarable, where only one definition should exist at any given
55
//    time (and the defn pointer is stored in the decl's "data" which
56
//    is copied to every element on the chain when it's changed).
57
//
58
//    Here is some ASCII art:
59
//
60
//      "first"                                     "latest"
61
//      "canonical"                                 "most recent"
62
//      +------------+         first                +--------------+
63
//      |            | <--------------------------- |              |
64
//      |            |                              |              |
65
//      |            |                              |              |
66
//      |            |       +--------------+       |              |
67
//      |            | first |              |       |              |
68
//      |            | <---- |              |       |              |
69
//      |            |       |              |       |              |
70
//      | @class A   |  link | @interface A |  link | @class A     |
71
//      | seen first | <---- | seen second  | <---- | seen third   |
72
//      |            |       |              |       |              |
73
//      +------------+       +--------------+       +--------------+
74
//      | data       | defn  | data         |  defn | data         |
75
//      |            | ----> |              | <---- |              |
76
//      +------------+       +--------------+       +--------------+
77
//        |                     |     ^                  ^
78
//        |                     |defn |                  |
79
//        | link                +-----+                  |
80
//        +-->-------------------------------------------+
81
82
/// Provides common interface for the Decls that can be redeclared.
83
template<typename decl_type>
84
class Redeclarable {
85
protected:
86
  class DeclLink {
87
    /// A pointer to a known latest declaration, either statically known or
88
    /// generationally updated as decls are added by an external source.
89
    using KnownLatest =
90
        LazyGenerationalUpdatePtr<const Decl *, Decl *,
91
                                  &ExternalASTSource::CompleteRedeclChain>;
92
93
    /// We store a pointer to the ASTContext in the UninitializedLatest
94
    /// pointer, but to avoid circular type dependencies when we steal the low
95
    /// bits of this pointer, we use a raw void* here.
96
    using UninitializedLatest = const void *;
97
98
    using Previous = Decl *;
99
100
    /// A pointer to either an uninitialized latest declaration (where either
101
    /// we've not yet set the previous decl or there isn't one), or to a known
102
    /// previous declaration.
103
    using NotKnownLatest = llvm::PointerUnion<Previous, UninitializedLatest>;
104
105
    mutable llvm::PointerUnion<NotKnownLatest, KnownLatest> Link;
106
107
  public:
108
    enum PreviousTag { PreviousLink };
109
    enum LatestTag { LatestLink };
110
111
    DeclLink(LatestTag, const ASTContext &Ctx)
112
47.9M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
112
3.18M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::VarDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::VarDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
112
27.3M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::FunctionDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::FunctionDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
112
8.85M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::TagDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::TagDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
112
6.49M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
112
314
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::NamespaceDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
112
255k
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
112
155k
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
112
341k
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
112
30.8k
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::LatestTag, clang::ASTContext const&)
Line
Count
Source
112
1.34M
        : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
113
2.71M
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::FunctionDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::FunctionDecl>::DeclLink::PreviousTag, clang::FunctionDecl*)
Line
Count
Source
113
312k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::PreviousTag, clang::RedeclarableTemplateDecl*)
Line
Count
Source
113
159k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::TagDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::TagDecl>::DeclLink::PreviousTag, clang::TagDecl*)
Line
Count
Source
113
1.70M
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::NamespaceDecl>::DeclLink::PreviousTag, clang::NamespaceDecl*)
Line
Count
Source
113
214k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::PreviousTag, clang::ObjCInterfaceDecl*)
Line
Count
Source
113
214k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::PreviousTag, clang::ObjCProtocolDecl*)
Line
Count
Source
113
7.04k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::PreviousTag, clang::TypedefNameDecl*)
Line
Count
Source
113
18.9k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::VarDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::VarDecl>::DeclLink::PreviousTag, clang::VarDecl*)
Line
Count
Source
113
72.0k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::PreviousTag, clang::NamespaceAliasDecl*)
Line
Count
Source
113
15
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::PreviousTag, clang::UsingShadowDecl*)
Line
Count
Source
113
3.53k
    DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
114
115
418M
    bool isFirst() const {
116
418M
      return Link.is<KnownLatest>() ||
117
418M
             // FIXME: 'template' is required on the next line due to an
118
418M
             // apparent clang bug.
119
418M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()247M
;
120
418M
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::isFirst() const
Line
Count
Source
115
25.4M
    bool isFirst() const {
116
25.4M
      return Link.is<KnownLatest>() ||
117
25.4M
             // FIXME: 'template' is required on the next line due to an
118
25.4M
             // apparent clang bug.
119
25.4M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()8.34M
;
120
25.4M
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::isFirst() const
Line
Count
Source
115
26.5M
    bool isFirst() const {
116
26.5M
      return Link.is<KnownLatest>() ||
117
26.5M
             // FIXME: 'template' is required on the next line due to an
118
26.5M
             // apparent clang bug.
119
26.5M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()7.93M
;
120
26.5M
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::isFirst() const
Line
Count
Source
115
936k
    bool isFirst() const {
116
936k
      return Link.is<KnownLatest>() ||
117
936k
             // FIXME: 'template' is required on the next line due to an
118
936k
             // apparent clang bug.
119
936k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()453k
;
120
936k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::isFirst() const
Line
Count
Source
115
60.8M
    bool isFirst() const {
116
60.8M
      return Link.is<KnownLatest>() ||
117
60.8M
             // FIXME: 'template' is required on the next line due to an
118
60.8M
             // apparent clang bug.
119
60.8M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()19.7M
;
120
60.8M
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::isFirst() const
Line
Count
Source
115
317k
    bool isFirst() const {
116
317k
      return Link.is<KnownLatest>() ||
117
317k
             // FIXME: 'template' is required on the next line due to an
118
317k
             // apparent clang bug.
119
317k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()308k
;
120
317k
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::isFirst() const
Line
Count
Source
115
1.24M
    bool isFirst() const {
116
1.24M
      return Link.is<KnownLatest>() ||
117
1.24M
             // FIXME: 'template' is required on the next line due to an
118
1.24M
             // apparent clang bug.
119
1.24M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()771k
;
120
1.24M
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::isFirst() const
Line
Count
Source
115
110k
    bool isFirst() const {
116
110k
      return Link.is<KnownLatest>() ||
117
110k
             // FIXME: 'template' is required on the next line due to an
118
110k
             // apparent clang bug.
119
110k
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()65.8k
;
120
110k
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::isFirst() const
Line
Count
Source
115
3.65M
    bool isFirst() const {
116
3.65M
      return Link.is<KnownLatest>() ||
117
3.65M
             // FIXME: 'template' is required on the next line due to an
118
3.65M
             // apparent clang bug.
119
3.65M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()2.53M
;
120
3.65M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::isFirst() const
Line
Count
Source
115
299M
    bool isFirst() const {
116
299M
      return Link.is<KnownLatest>() ||
117
299M
             // FIXME: 'template' is required on the next line due to an
118
299M
             // apparent clang bug.
119
299M
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()207M
;
120
299M
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::isFirst() const
Line
Count
Source
115
82
    bool isFirst() const {
116
82
      return Link.is<KnownLatest>() ||
117
82
             // FIXME: 'template' is required on the next line due to an
118
82
             // apparent clang bug.
119
82
             
Link.get<NotKnownLatest>().template is<UninitializedLatest>()58
;
120
82
    }
121
122
443M
    decl_type *getPrevious(const decl_type *D) const {
123
443M
      if (Link.is<NotKnownLatest>()) {
124
36.4M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
36.4M
        if (NKL.is<Previous>())
126
12.3M
          return static_cast<decl_type*>(NKL.get<Previous>());
127
24.0M
128
24.0M
        // Allocate the generational 'most recent' cache now, if needed.
129
24.0M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
24.0M
                               NKL.get<UninitializedLatest>()),
131
24.0M
                           const_cast<decl_type *>(D));
132
24.0M
      }
133
443M
134
443M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))430M
;
135
443M
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::getPrevious(clang::VarDecl const*) const
Line
Count
Source
122
83.9M
    decl_type *getPrevious(const decl_type *D) const {
123
83.9M
      if (Link.is<NotKnownLatest>()) {
124
18.1M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
18.1M
        if (NKL.is<Previous>())
126
2.72M
          return static_cast<decl_type*>(NKL.get<Previous>());
127
15.3M
128
15.3M
        // Allocate the generational 'most recent' cache now, if needed.
129
15.3M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
15.3M
                               NKL.get<UninitializedLatest>()),
131
15.3M
                           const_cast<decl_type *>(D));
132
15.3M
      }
133
83.9M
134
83.9M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))81.2M
;
135
83.9M
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::getPrevious(clang::FunctionDecl const*) const
Line
Count
Source
122
43.3M
    decl_type *getPrevious(const decl_type *D) const {
123
43.3M
      if (Link.is<NotKnownLatest>()) {
124
8.56M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
8.56M
        if (NKL.is<Previous>())
126
977k
          return static_cast<decl_type*>(NKL.get<Previous>());
127
7.58M
128
7.58M
        // Allocate the generational 'most recent' cache now, if needed.
129
7.58M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
7.58M
                               NKL.get<UninitializedLatest>()),
131
7.58M
                           const_cast<decl_type *>(D));
132
7.58M
      }
133
43.3M
134
43.3M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))42.3M
;
135
43.3M
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::getPrevious(clang::TypedefNameDecl const*) const
Line
Count
Source
122
1.41M
    decl_type *getPrevious(const decl_type *D) const {
123
1.41M
      if (Link.is<NotKnownLatest>()) {
124
443k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
443k
        if (NKL.is<Previous>())
126
18.4k
          return static_cast<decl_type*>(NKL.get<Previous>());
127
425k
128
425k
        // Allocate the generational 'most recent' cache now, if needed.
129
425k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
425k
                               NKL.get<UninitializedLatest>()),
131
425k
                           const_cast<decl_type *>(D));
132
425k
      }
133
1.41M
134
1.41M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))1.39M
;
135
1.41M
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::getPrevious(clang::TagDecl const*) const
Line
Count
Source
122
288M
    decl_type *getPrevious(const decl_type *D) const {
123
288M
      if (Link.is<NotKnownLatest>()) {
124
6.98M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
6.98M
        if (NKL.is<Previous>())
126
6.98M
          return static_cast<decl_type*>(NKL.get<Previous>());
127
0
128
0
        // Allocate the generational 'most recent' cache now, if needed.
129
0
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
0
                               NKL.get<UninitializedLatest>()),
131
0
                           const_cast<decl_type *>(D));
132
0
      }
133
288M
134
288M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))281M
;
135
288M
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::getPrevious(clang::UsingShadowDecl const*) const
Line
Count
Source
122
536k
    decl_type *getPrevious(const decl_type *D) const {
123
536k
      if (Link.is<NotKnownLatest>()) {
124
7.97k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
7.97k
        if (NKL.is<Previous>())
126
7.96k
          return static_cast<decl_type*>(NKL.get<Previous>());
127
10
128
10
        // Allocate the generational 'most recent' cache now, if needed.
129
10
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
10
                               NKL.get<UninitializedLatest>()),
131
10
                           const_cast<decl_type *>(D));
132
10
      }
133
536k
134
536k
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))528k
;
135
536k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::getPrevious(clang::ObjCProtocolDecl const*) const
Line
Count
Source
122
292k
    decl_type *getPrevious(const decl_type *D) const {
123
292k
      if (Link.is<NotKnownLatest>()) {
124
11.1k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
11.1k
        if (NKL.is<Previous>())
126
11.1k
          return static_cast<decl_type*>(NKL.get<Previous>());
127
0
128
0
        // Allocate the generational 'most recent' cache now, if needed.
129
0
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
0
                               NKL.get<UninitializedLatest>()),
131
0
                           const_cast<decl_type *>(D));
132
0
      }
133
292k
134
292k
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))281k
;
135
292k
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::getPrevious(clang::ObjCInterfaceDecl const*) const
Line
Count
Source
122
881k
    decl_type *getPrevious(const decl_type *D) const {
123
881k
      if (Link.is<NotKnownLatest>()) {
124
282k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
282k
        if (NKL.is<Previous>())
126
282k
          return static_cast<decl_type*>(NKL.get<Previous>());
127
0
128
0
        // Allocate the generational 'most recent' cache now, if needed.
129
0
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
0
                               NKL.get<UninitializedLatest>()),
131
0
                           const_cast<decl_type *>(D));
132
0
      }
133
881k
134
881k
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))598k
;
135
881k
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::getPrevious(clang::RedeclarableTemplateDecl const*) const
Line
Count
Source
122
15.2M
    decl_type *getPrevious(const decl_type *D) const {
123
15.2M
      if (Link.is<NotKnownLatest>()) {
124
1.02M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
1.02M
        if (NKL.is<Previous>())
126
398k
          return static_cast<decl_type*>(NKL.get<Previous>());
127
623k
128
623k
        // Allocate the generational 'most recent' cache now, if needed.
129
623k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
623k
                               NKL.get<UninitializedLatest>()),
131
623k
                           const_cast<decl_type *>(D));
132
623k
      }
133
15.2M
134
15.2M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))14.8M
;
135
15.2M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::getPrevious(clang::NamespaceDecl const*) const
Line
Count
Source
122
8.63M
    decl_type *getPrevious(const decl_type *D) const {
123
8.63M
      if (Link.is<NotKnownLatest>()) {
124
977k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
977k
        if (NKL.is<Previous>())
126
977k
          return static_cast<decl_type*>(NKL.get<Previous>());
127
0
128
0
        // Allocate the generational 'most recent' cache now, if needed.
129
0
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
0
                               NKL.get<UninitializedLatest>()),
131
0
                           const_cast<decl_type *>(D));
132
0
      }
133
8.63M
134
8.63M
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))7.66M
;
135
8.63M
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::getPrevious(clang::NamespaceAliasDecl const*) const
Line
Count
Source
122
207
    decl_type *getPrevious(const decl_type *D) const {
123
207
      if (Link.is<NotKnownLatest>()) {
124
62
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
125
62
        if (NKL.is<Previous>())
126
2
          return static_cast<decl_type*>(NKL.get<Previous>());
127
60
128
60
        // Allocate the generational 'most recent' cache now, if needed.
129
60
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
130
60
                               NKL.get<UninitializedLatest>()),
131
60
                           const_cast<decl_type *>(D));
132
60
      }
133
207
134
207
      
return static_cast<decl_type*>(Link.get<KnownLatest>().get(D))205
;
135
207
    }
136
137
1.28M
    void setPrevious(decl_type *D) {
138
1.28M
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
1.28M
      Link = Previous(D);
140
1.28M
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::setPrevious(clang::VarDecl*)
Line
Count
Source
137
3.66k
    void setPrevious(decl_type *D) {
138
3.66k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
3.66k
      Link = Previous(D);
140
3.66k
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::setPrevious(clang::FunctionDecl*)
Line
Count
Source
137
68.7k
    void setPrevious(decl_type *D) {
138
68.7k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
68.7k
      Link = Previous(D);
140
68.7k
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::setPrevious(clang::NamespaceDecl*)
Line
Count
Source
137
174k
    void setPrevious(decl_type *D) {
138
174k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
174k
      Link = Previous(D);
140
174k
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::setPrevious(clang::NamespaceAliasDecl*)
Line
Count
Source
137
3
    void setPrevious(decl_type *D) {
138
3
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
3
      Link = Previous(D);
140
3
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::setPrevious(clang::ObjCInterfaceDecl*)
Line
Count
Source
137
52.4k
    void setPrevious(decl_type *D) {
138
52.4k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
52.4k
      Link = Previous(D);
140
52.4k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::setPrevious(clang::ObjCProtocolDecl*)
Line
Count
Source
137
642
    void setPrevious(decl_type *D) {
138
642
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
642
      Link = Previous(D);
140
642
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::setPrevious(clang::RedeclarableTemplateDecl*)
Line
Count
Source
137
81.6k
    void setPrevious(decl_type *D) {
138
81.6k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
81.6k
      Link = Previous(D);
140
81.6k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::setPrevious(clang::TagDecl*)
Line
Count
Source
137
893k
    void setPrevious(decl_type *D) {
138
893k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
893k
      Link = Previous(D);
140
893k
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::setPrevious(clang::TypedefNameDecl*)
Line
Count
Source
137
13.0k
    void setPrevious(decl_type *D) {
138
13.0k
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
13.0k
      Link = Previous(D);
140
13.0k
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::setPrevious(clang::UsingShadowDecl*)
Line
Count
Source
137
108
    void setPrevious(decl_type *D) {
138
108
      assert(!isFirst() && "decl became non-canonical unexpectedly");
139
108
      Link = Previous(D);
140
108
    }
141
142
10.6M
    void setLatest(decl_type *D) {
143
10.6M
      assert(isFirst() && "decl became canonical unexpectedly");
144
10.6M
      if (Link.is<NotKnownLatest>()) {
145
8.07M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
8.07M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
8.07M
                               NKL.get<UninitializedLatest>()),
148
8.07M
                           D);
149
8.07M
      } else {
150
2.52M
        auto Latest = Link.get<KnownLatest>();
151
2.52M
        Latest.set(D);
152
2.52M
        Link = Latest;
153
2.52M
      }
154
10.6M
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::setLatest(clang::FunctionDecl*)
Line
Count
Source
142
649k
    void setLatest(decl_type *D) {
143
649k
      assert(isFirst() && "decl became canonical unexpectedly");
144
649k
      if (Link.is<NotKnownLatest>()) {
145
404k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
404k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
404k
                               NKL.get<UninitializedLatest>()),
148
404k
                           D);
149
404k
      } else {
150
245k
        auto Latest = Link.get<KnownLatest>();
151
245k
        Latest.set(D);
152
245k
        Link = Latest;
153
245k
      }
154
649k
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::setLatest(clang::RedeclarableTemplateDecl*)
Line
Count
Source
142
483k
    void setLatest(decl_type *D) {
143
483k
      assert(isFirst() && "decl became canonical unexpectedly");
144
483k
      if (Link.is<NotKnownLatest>()) {
145
405k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
405k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
405k
                               NKL.get<UninitializedLatest>()),
148
405k
                           D);
149
405k
      } else {
150
78.6k
        auto Latest = Link.get<KnownLatest>();
151
78.6k
        Latest.set(D);
152
78.6k
        Link = Latest;
153
78.6k
      }
154
483k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::setLatest(clang::TagDecl*)
Line
Count
Source
142
7.56M
    void setLatest(decl_type *D) {
143
7.56M
      assert(isFirst() && "decl became canonical unexpectedly");
144
7.56M
      if (Link.is<NotKnownLatest>()) {
145
5.68M
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
5.68M
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
5.68M
                               NKL.get<UninitializedLatest>()),
148
5.68M
                           D);
149
5.68M
      } else {
150
1.88M
        auto Latest = Link.get<KnownLatest>();
151
1.88M
        Latest.set(D);
152
1.88M
        Link = Latest;
153
1.88M
      }
154
7.56M
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::setLatest(clang::NamespaceDecl*)
Line
Count
Source
142
263k
    void setLatest(decl_type *D) {
143
263k
      assert(isFirst() && "decl became canonical unexpectedly");
144
263k
      if (Link.is<NotKnownLatest>()) {
145
214k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
214k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
214k
                               NKL.get<UninitializedLatest>()),
148
214k
                           D);
149
214k
      } else {
150
48.9k
        auto Latest = Link.get<KnownLatest>();
151
48.9k
        Latest.set(D);
152
48.9k
        Link = Latest;
153
48.9k
      }
154
263k
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::setLatest(clang::ObjCInterfaceDecl*)
Line
Count
Source
142
351k
    void setLatest(decl_type *D) {
143
351k
      assert(isFirst() && "decl became canonical unexpectedly");
144
351k
      if (Link.is<NotKnownLatest>()) {
145
179k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
179k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
179k
                               NKL.get<UninitializedLatest>()),
148
179k
                           D);
149
179k
      } else {
150
171k
        auto Latest = Link.get<KnownLatest>();
151
171k
        Latest.set(D);
152
171k
        Link = Latest;
153
171k
      }
154
351k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::setLatest(clang::ObjCProtocolDecl*)
Line
Count
Source
142
33.1k
    void setLatest(decl_type *D) {
143
33.1k
      assert(isFirst() && "decl became canonical unexpectedly");
144
33.1k
      if (Link.is<NotKnownLatest>()) {
145
24.4k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
24.4k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
24.4k
                               NKL.get<UninitializedLatest>()),
148
24.4k
                           D);
149
24.4k
      } else {
150
8.67k
        auto Latest = Link.get<KnownLatest>();
151
8.67k
        Latest.set(D);
152
8.67k
        Link = Latest;
153
8.67k
      }
154
33.1k
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::setLatest(clang::NamespaceAliasDecl*)
Line
Count
Source
142
32
    void setLatest(decl_type *D) {
143
32
      assert(isFirst() && "decl became canonical unexpectedly");
144
32
      if (Link.is<NotKnownLatest>()) {
145
17
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
17
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
17
                               NKL.get<UninitializedLatest>()),
148
17
                           D);
149
17
      } else {
150
15
        auto Latest = Link.get<KnownLatest>();
151
15
        Latest.set(D);
152
15
        Link = Latest;
153
15
      }
154
32
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::setLatest(clang::TypedefNameDecl*)
Line
Count
Source
142
139k
    void setLatest(decl_type *D) {
143
139k
      assert(isFirst() && "decl became canonical unexpectedly");
144
139k
      if (Link.is<NotKnownLatest>()) {
145
132k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
132k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
132k
                               NKL.get<UninitializedLatest>()),
148
132k
                           D);
149
132k
      } else {
150
7.04k
        auto Latest = Link.get<KnownLatest>();
151
7.04k
        Latest.set(D);
152
7.04k
        Link = Latest;
153
7.04k
      }
154
139k
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::setLatest(clang::UsingShadowDecl*)
Line
Count
Source
142
155k
    void setLatest(decl_type *D) {
143
155k
      assert(isFirst() && "decl became canonical unexpectedly");
144
155k
      if (Link.is<NotKnownLatest>()) {
145
152k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
152k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
152k
                               NKL.get<UninitializedLatest>()),
148
152k
                           D);
149
152k
      } else {
150
3.42k
        auto Latest = Link.get<KnownLatest>();
151
3.42k
        Latest.set(D);
152
3.42k
        Link = Latest;
153
3.42k
      }
154
155k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::setLatest(clang::VarDecl*)
Line
Count
Source
142
954k
    void setLatest(decl_type *D) {
143
954k
      assert(isFirst() && "decl became canonical unexpectedly");
144
954k
      if (Link.is<NotKnownLatest>()) {
145
885k
        NotKnownLatest NKL = Link.get<NotKnownLatest>();
146
885k
        Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
147
885k
                               NKL.get<UninitializedLatest>()),
148
885k
                           D);
149
885k
      } else {
150
69.1k
        auto Latest = Link.get<KnownLatest>();
151
69.1k
        Latest.set(D);
152
69.1k
        Link = Latest;
153
69.1k
      }
154
954k
    }
155
156
205k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
2
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
Unexecuted instantiation: clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::markIncomplete()
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
9.15k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
2
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
Unexecuted instantiation: clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::markIncomplete()
clang::Redeclarable<clang::TagDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
6.89k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
6
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
Unexecuted instantiation: clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::markIncomplete()
clang::Redeclarable<clang::FunctionDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
189k
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
clang::Redeclarable<clang::VarDecl>::DeclLink::markIncomplete()
Line
Count
Source
156
26
    void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
157
158
219k
    Decl *getLatestNotUpdated() const {
159
219k
      assert(isFirst() && "expected a canonical decl");
160
219k
      if (Link.is<NotKnownLatest>())
161
869
        return nullptr;
162
218k
      return Link.get<KnownLatest>().getNotUpdated();
163
218k
    }
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
1.80k
    Decl *getLatestNotUpdated() const {
159
1.80k
      assert(isFirst() && "expected a canonical decl");
160
1.80k
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
1.80k
      return Link.get<KnownLatest>().getNotUpdated();
163
1.80k
    }
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
3
    Decl *getLatestNotUpdated() const {
159
3
      assert(isFirst() && "expected a canonical decl");
160
3
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
3
      return Link.get<KnownLatest>().getNotUpdated();
163
3
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
9.13k
    Decl *getLatestNotUpdated() const {
159
9.13k
      assert(isFirst() && "expected a canonical decl");
160
9.13k
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
9.13k
      return Link.get<KnownLatest>().getNotUpdated();
163
9.13k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
2.24k
    Decl *getLatestNotUpdated() const {
159
2.24k
      assert(isFirst() && "expected a canonical decl");
160
2.24k
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
2.24k
      return Link.get<KnownLatest>().getNotUpdated();
163
2.24k
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
171k
    Decl *getLatestNotUpdated() const {
159
171k
      assert(isFirst() && "expected a canonical decl");
160
171k
      if (Link.is<NotKnownLatest>())
161
7
        return nullptr;
162
171k
      return Link.get<KnownLatest>().getNotUpdated();
163
171k
    }
clang::Redeclarable<clang::TagDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
30.3k
    Decl *getLatestNotUpdated() const {
159
30.3k
      assert(isFirst() && "expected a canonical decl");
160
30.3k
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
30.3k
      return Link.get<KnownLatest>().getNotUpdated();
163
30.3k
    }
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
2.00k
    Decl *getLatestNotUpdated() const {
159
2.00k
      assert(isFirst() && "expected a canonical decl");
160
2.00k
      if (Link.is<NotKnownLatest>())
161
862
        return nullptr;
162
1.14k
      return Link.get<KnownLatest>().getNotUpdated();
163
1.14k
    }
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
1
    Decl *getLatestNotUpdated() const {
159
1
      assert(isFirst() && "expected a canonical decl");
160
1
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
1
      return Link.get<KnownLatest>().getNotUpdated();
163
1
    }
clang::Redeclarable<clang::FunctionDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
1.25k
    Decl *getLatestNotUpdated() const {
159
1.25k
      assert(isFirst() && "expected a canonical decl");
160
1.25k
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
1.25k
      return Link.get<KnownLatest>().getNotUpdated();
163
1.25k
    }
clang::Redeclarable<clang::VarDecl>::DeclLink::getLatestNotUpdated() const
Line
Count
Source
158
859
    Decl *getLatestNotUpdated() const {
159
859
      assert(isFirst() && "expected a canonical decl");
160
859
      if (Link.is<NotKnownLatest>())
161
0
        return nullptr;
162
859
      return Link.get<KnownLatest>().getNotUpdated();
163
859
    }
164
  };
165
166
2.71M
  static DeclLink PreviousDeclLink(decl_type *D) {
167
2.71M
    return DeclLink(DeclLink::PreviousLink, D);
168
2.71M
  }
clang::Redeclarable<clang::FunctionDecl>::PreviousDeclLink(clang::FunctionDecl*)
Line
Count
Source
166
312k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
312k
    return DeclLink(DeclLink::PreviousLink, D);
168
312k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::PreviousDeclLink(clang::RedeclarableTemplateDecl*)
Line
Count
Source
166
159k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
159k
    return DeclLink(DeclLink::PreviousLink, D);
168
159k
  }
clang::Redeclarable<clang::TagDecl>::PreviousDeclLink(clang::TagDecl*)
Line
Count
Source
166
1.70M
  static DeclLink PreviousDeclLink(decl_type *D) {
167
1.70M
    return DeclLink(DeclLink::PreviousLink, D);
168
1.70M
  }
clang::Redeclarable<clang::NamespaceDecl>::PreviousDeclLink(clang::NamespaceDecl*)
Line
Count
Source
166
214k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
214k
    return DeclLink(DeclLink::PreviousLink, D);
168
214k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::PreviousDeclLink(clang::ObjCInterfaceDecl*)
Line
Count
Source
166
214k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
214k
    return DeclLink(DeclLink::PreviousLink, D);
168
214k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::PreviousDeclLink(clang::ObjCProtocolDecl*)
Line
Count
Source
166
7.04k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
7.04k
    return DeclLink(DeclLink::PreviousLink, D);
168
7.04k
  }
clang::Redeclarable<clang::TypedefNameDecl>::PreviousDeclLink(clang::TypedefNameDecl*)
Line
Count
Source
166
18.9k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
18.9k
    return DeclLink(DeclLink::PreviousLink, D);
168
18.9k
  }
clang::Redeclarable<clang::VarDecl>::PreviousDeclLink(clang::VarDecl*)
Line
Count
Source
166
72.0k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
72.0k
    return DeclLink(DeclLink::PreviousLink, D);
168
72.0k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::PreviousDeclLink(clang::NamespaceAliasDecl*)
Line
Count
Source
166
15
  static DeclLink PreviousDeclLink(decl_type *D) {
167
15
    return DeclLink(DeclLink::PreviousLink, D);
168
15
  }
clang::Redeclarable<clang::UsingShadowDecl>::PreviousDeclLink(clang::UsingShadowDecl*)
Line
Count
Source
166
3.53k
  static DeclLink PreviousDeclLink(decl_type *D) {
167
3.53k
    return DeclLink(DeclLink::PreviousLink, D);
168
3.53k
  }
169
170
47.9M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
47.9M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
47.9M
  }
clang::Redeclarable<clang::TypedefNameDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
3.18M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
3.18M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
3.18M
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
314
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
314
    return DeclLink(DeclLink::LatestLink, Ctx);
172
314
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
1.34M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
1.34M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
1.34M
  }
clang::Redeclarable<clang::VarDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
27.3M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
27.3M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
27.3M
  }
clang::Redeclarable<clang::FunctionDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
8.85M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
8.85M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
8.85M
  }
clang::Redeclarable<clang::TagDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
6.49M
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
6.49M
    return DeclLink(DeclLink::LatestLink, Ctx);
172
6.49M
  }
clang::Redeclarable<clang::NamespaceDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
255k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
255k
    return DeclLink(DeclLink::LatestLink, Ctx);
172
255k
  }
clang::Redeclarable<clang::UsingShadowDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
155k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
155k
    return DeclLink(DeclLink::LatestLink, Ctx);
172
155k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
341k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
341k
    return DeclLink(DeclLink::LatestLink, Ctx);
172
341k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::LatestDeclLink(clang::ASTContext const&)
Line
Count
Source
170
30.8k
  static DeclLink LatestDeclLink(const ASTContext &Ctx) {
171
30.8k
    return DeclLink(DeclLink::LatestLink, Ctx);
172
30.8k
  }
173
174
  /// Points to the next redeclaration in the chain.
175
  ///
176
  /// If isFirst() is false, this is a link to the previous declaration
177
  /// of this same Decl. If isFirst() is true, this is the first
178
  /// declaration and Link points to the latest declaration. For example:
179
  ///
180
  ///  #1 int f(int x, int y = 1); // <pointer to #3, true>
181
  ///  #2 int f(int x = 0, int y); // <pointer to #1, false>
182
  ///  #3 int f(int x, int y) { return x + y; } // <pointer to #2, false>
183
  ///
184
  /// If there is only one declaration, it is <pointer to self, true>
185
  DeclLink RedeclLink;
186
187
  decl_type *First;
188
189
443M
  decl_type *getNextRedeclaration() const {
190
443M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
443M
  }
clang::Redeclarable<clang::VarDecl>::getNextRedeclaration() const
Line
Count
Source
189
83.9M
  decl_type *getNextRedeclaration() const {
190
83.9M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
83.9M
  }
clang::Redeclarable<clang::FunctionDecl>::getNextRedeclaration() const
Line
Count
Source
189
43.3M
  decl_type *getNextRedeclaration() const {
190
43.3M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
43.3M
  }
clang::Redeclarable<clang::TypedefNameDecl>::getNextRedeclaration() const
Line
Count
Source
189
1.41M
  decl_type *getNextRedeclaration() const {
190
1.41M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
1.41M
  }
clang::Redeclarable<clang::TagDecl>::getNextRedeclaration() const
Line
Count
Source
189
288M
  decl_type *getNextRedeclaration() const {
190
288M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
288M
  }
clang::Redeclarable<clang::UsingShadowDecl>::getNextRedeclaration() const
Line
Count
Source
189
536k
  decl_type *getNextRedeclaration() const {
190
536k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
536k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getNextRedeclaration() const
Line
Count
Source
189
292k
  decl_type *getNextRedeclaration() const {
190
292k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
292k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getNextRedeclaration() const
Line
Count
Source
189
881k
  decl_type *getNextRedeclaration() const {
190
881k
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
881k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getNextRedeclaration() const
Line
Count
Source
189
15.2M
  decl_type *getNextRedeclaration() const {
190
15.2M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
15.2M
  }
clang::Redeclarable<clang::NamespaceDecl>::getNextRedeclaration() const
Line
Count
Source
189
8.63M
  decl_type *getNextRedeclaration() const {
190
8.63M
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
8.63M
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getNextRedeclaration() const
Line
Count
Source
189
207
  decl_type *getNextRedeclaration() const {
190
207
    return RedeclLink.getPrevious(static_cast<const decl_type *>(this));
191
207
  }
192
193
public:
194
  friend class ASTDeclReader;
195
  friend class ASTDeclWriter;
196
197
  Redeclarable(const ASTContext &Ctx)
198
      : RedeclLink(LatestDeclLink(Ctx)),
199
47.9M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::TypedefNameDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
3.18M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::VarDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
27.3M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::FunctionDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
8.85M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::TagDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
6.49M
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::NamespaceAliasDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
314
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::NamespaceDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
255k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::UsingShadowDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
155k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
341k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
30.8k
        First(static_cast<decl_type *>(this)) {}
clang::Redeclarable<clang::RedeclarableTemplateDecl>::Redeclarable(clang::ASTContext const&)
Line
Count
Source
199
1.34M
        First(static_cast<decl_type *>(this)) {}
200
201
  /// Return the previous declaration of this declaration or NULL if this
202
  /// is the first declaration.
203
18.4M
  decl_type *getPreviousDecl() {
204
18.4M
    if (!RedeclLink.isFirst())
205
3.27M
      return getNextRedeclaration();
206
15.1M
    return nullptr;
207
15.1M
  }
clang::Redeclarable<clang::VarDecl>::getPreviousDecl()
Line
Count
Source
203
2.65M
  decl_type *getPreviousDecl() {
204
2.65M
    if (!RedeclLink.isFirst())
205
25.8k
      return getNextRedeclaration();
206
2.62M
    return nullptr;
207
2.62M
  }
clang::Redeclarable<clang::FunctionDecl>::getPreviousDecl()
Line
Count
Source
203
6.08M
  decl_type *getPreviousDecl() {
204
6.08M
    if (!RedeclLink.isFirst())
205
261k
      return getNextRedeclaration();
206
5.82M
    return nullptr;
207
5.82M
  }
clang::Redeclarable<clang::TypedefNameDecl>::getPreviousDecl()
Line
Count
Source
203
657k
  decl_type *getPreviousDecl() {
204
657k
    if (!RedeclLink.isFirst())
205
14.4k
      return getNextRedeclaration();
206
643k
    return nullptr;
207
643k
  }
clang::Redeclarable<clang::TagDecl>::getPreviousDecl()
Line
Count
Source
203
7.23M
  decl_type *getPreviousDecl() {
204
7.23M
    if (!RedeclLink.isFirst())
205
2.56M
      return getNextRedeclaration();
206
4.66M
    return nullptr;
207
4.66M
  }
clang::Redeclarable<clang::UsingShadowDecl>::getPreviousDecl()
Line
Count
Source
203
1.33k
  decl_type *getPreviousDecl() {
204
1.33k
    if (!RedeclLink.isFirst())
205
843
      return getNextRedeclaration();
206
489
    return nullptr;
207
489
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getPreviousDecl()
Line
Count
Source
203
139k
  decl_type *getPreviousDecl() {
204
139k
    if (!RedeclLink.isFirst())
205
102k
      return getNextRedeclaration();
206
37.2k
    return nullptr;
207
37.2k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getPreviousDecl()
Line
Count
Source
203
6.98k
  decl_type *getPreviousDecl() {
204
6.98k
    if (!RedeclLink.isFirst())
205
3.14k
      return getNextRedeclaration();
206
3.84k
    return nullptr;
207
3.84k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getPreviousDecl()
Line
Count
Source
203
1.58M
  decl_type *getPreviousDecl() {
204
1.58M
    if (!RedeclLink.isFirst())
205
260k
      return getNextRedeclaration();
206
1.32M
    return nullptr;
207
1.32M
  }
clang::Redeclarable<clang::NamespaceDecl>::getPreviousDecl()
Line
Count
Source
203
62.4k
  decl_type *getPreviousDecl() {
204
62.4k
    if (!RedeclLink.isFirst())
205
37.2k
      return getNextRedeclaration();
206
25.2k
    return nullptr;
207
25.2k
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getPreviousDecl()
Line
Count
Source
203
4
  decl_type *getPreviousDecl() {
204
4
    if (!RedeclLink.isFirst())
205
0
      return getNextRedeclaration();
206
4
    return nullptr;
207
4
  }
208
4.03M
  const decl_type *getPreviousDecl() const {
209
4.03M
    return const_cast<decl_type *>(
210
4.03M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
4.03M
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getPreviousDecl() const
Line
Count
Source
208
625k
  const decl_type *getPreviousDecl() const {
209
625k
    return const_cast<decl_type *>(
210
625k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
625k
  }
clang::Redeclarable<clang::VarDecl>::getPreviousDecl() const
Line
Count
Source
208
1.44M
  const decl_type *getPreviousDecl() const {
209
1.44M
    return const_cast<decl_type *>(
210
1.44M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
1.44M
  }
clang::Redeclarable<clang::FunctionDecl>::getPreviousDecl() const
Line
Count
Source
208
1.91M
  const decl_type *getPreviousDecl() const {
209
1.91M
    return const_cast<decl_type *>(
210
1.91M
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
1.91M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getPreviousDecl() const
Line
Count
Source
208
42.5k
  const decl_type *getPreviousDecl() const {
209
42.5k
    return const_cast<decl_type *>(
210
42.5k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
42.5k
  }
clang::Redeclarable<clang::NamespaceDecl>::getPreviousDecl() const
Line
Count
Source
208
130
  const decl_type *getPreviousDecl() const {
209
130
    return const_cast<decl_type *>(
210
130
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
130
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getPreviousDecl() const
Line
Count
Source
208
4
  const decl_type *getPreviousDecl() const {
209
4
    return const_cast<decl_type *>(
210
4
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
4
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getPreviousDecl() const
Line
Count
Source
208
22
  const decl_type *getPreviousDecl() const {
209
22
    return const_cast<decl_type *>(
210
22
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
22
  }
clang::Redeclarable<clang::TagDecl>::getPreviousDecl() const
Line
Count
Source
208
2.95k
  const decl_type *getPreviousDecl() const {
209
2.95k
    return const_cast<decl_type *>(
210
2.95k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
2.95k
  }
clang::Redeclarable<clang::TypedefNameDecl>::getPreviousDecl() const
Line
Count
Source
208
1.58k
  const decl_type *getPreviousDecl() const {
209
1.58k
    return const_cast<decl_type *>(
210
1.58k
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
1.58k
  }
clang::Redeclarable<clang::UsingShadowDecl>::getPreviousDecl() const
Line
Count
Source
208
27
  const decl_type *getPreviousDecl() const {
209
27
    return const_cast<decl_type *>(
210
27
                 static_cast<const decl_type*>(this))->getPreviousDecl();
211
27
  }
212
213
  /// Return the first declaration of this declaration or itself if this
214
  /// is the only declaration.
215
760M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::VarDecl>::getFirstDecl()
Line
Count
Source
215
145M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::FunctionDecl>::getFirstDecl()
Line
Count
Source
215
230M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::TypedefNameDecl>::getFirstDecl()
Line
Count
Source
215
16.2M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::TagDecl>::getFirstDecl()
Line
Count
Source
215
285M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::NamespaceAliasDecl>::getFirstDecl()
Line
Count
Source
215
409
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::UsingShadowDecl>::getFirstDecl()
Line
Count
Source
215
1.43M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getFirstDecl()
Line
Count
Source
215
2.88M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::ObjCProtocolDecl>::getFirstDecl()
Line
Count
Source
215
366k
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getFirstDecl()
Line
Count
Source
215
69.9M
  decl_type *getFirstDecl() { return First; }
clang::Redeclarable<clang::NamespaceDecl>::getFirstDecl()
Line
Count
Source
215
7.79M
  decl_type *getFirstDecl() { return First; }
216
217
  /// Return the first declaration of this declaration or itself if this
218
  /// is the only declaration.
219
34.2M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::TypedefNameDecl>::getFirstDecl() const
Line
Count
Source
219
107
  const decl_type *getFirstDecl() const { return First; }
Unexecuted instantiation: clang::Redeclarable<clang::NamespaceAliasDecl>::getFirstDecl() const
Unexecuted instantiation: clang::Redeclarable<clang::UsingShadowDecl>::getFirstDecl() const
clang::Redeclarable<clang::ObjCProtocolDecl>::getFirstDecl() const
Line
Count
Source
219
2.18k
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getFirstDecl() const
Line
Count
Source
219
66.6k
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::VarDecl>::getFirstDecl() const
Line
Count
Source
219
13.9M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::FunctionDecl>::getFirstDecl() const
Line
Count
Source
219
14.9M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getFirstDecl() const
Line
Count
Source
219
5.05M
  const decl_type *getFirstDecl() const { return First; }
clang::Redeclarable<clang::TagDecl>::getFirstDecl() const
Line
Count
Source
219
290k
  const decl_type *getFirstDecl() const { return First; }
220
221
  /// True if this is the first declaration in its redeclaration chain.
222
378M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::TagDecl>::isFirstDecl() const
Line
Count
Source
222
37.8M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::VarDecl>::isFirstDecl() const
Line
Count
Source
222
21.6M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::FunctionDecl>::isFirstDecl() const
Line
Count
Source
222
19.2M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::NamespaceDecl>::isFirstDecl() const
Line
Count
Source
222
298M
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::ObjCInterfaceDecl>::isFirstDecl() const
Line
Count
Source
222
192k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::ObjCProtocolDecl>::isFirstDecl() const
Line
Count
Source
222
30.1k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::TypedefNameDecl>::isFirstDecl() const
Line
Count
Source
222
112k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::NamespaceAliasDecl>::isFirstDecl() const
Line
Count
Source
222
16
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::UsingShadowDecl>::isFirstDecl() const
Line
Count
Source
222
1.58k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::isFirstDecl() const
Line
Count
Source
222
944k
  bool isFirstDecl() const { return RedeclLink.isFirst(); }
223
224
  /// Returns the most recent (re)declaration of this declaration.
225
339M
  decl_type *getMostRecentDecl() {
226
339M
    return getFirstDecl()->getNextRedeclaration();
227
339M
  }
clang::Redeclarable<clang::VarDecl>::getMostRecentDecl()
Line
Count
Source
225
48.6M
  decl_type *getMostRecentDecl() {
226
48.6M
    return getFirstDecl()->getNextRedeclaration();
227
48.6M
  }
clang::Redeclarable<clang::FunctionDecl>::getMostRecentDecl()
Line
Count
Source
225
25.2M
  decl_type *getMostRecentDecl() {
226
25.2M
    return getFirstDecl()->getNextRedeclaration();
227
25.2M
  }
clang::Redeclarable<clang::TypedefNameDecl>::getMostRecentDecl()
Line
Count
Source
225
1.08M
  decl_type *getMostRecentDecl() {
226
1.08M
    return getFirstDecl()->getNextRedeclaration();
227
1.08M
  }
clang::Redeclarable<clang::TagDecl>::getMostRecentDecl()
Line
Count
Source
225
247M
  decl_type *getMostRecentDecl() {
226
247M
    return getFirstDecl()->getNextRedeclaration();
227
247M
  }
clang::Redeclarable<clang::UsingShadowDecl>::getMostRecentDecl()
Line
Count
Source
225
349k
  decl_type *getMostRecentDecl() {
226
349k
    return getFirstDecl()->getNextRedeclaration();
227
349k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getMostRecentDecl()
Line
Count
Source
225
271k
  decl_type *getMostRecentDecl() {
226
271k
    return getFirstDecl()->getNextRedeclaration();
227
271k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getMostRecentDecl()
Line
Count
Source
225
250k
  decl_type *getMostRecentDecl() {
226
250k
    return getFirstDecl()->getNextRedeclaration();
227
250k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getMostRecentDecl()
Line
Count
Source
225
8.57M
  decl_type *getMostRecentDecl() {
226
8.57M
    return getFirstDecl()->getNextRedeclaration();
227
8.57M
  }
clang::Redeclarable<clang::NamespaceDecl>::getMostRecentDecl()
Line
Count
Source
225
7.57M
  decl_type *getMostRecentDecl() {
226
7.57M
    return getFirstDecl()->getNextRedeclaration();
227
7.57M
  }
clang::Redeclarable<clang::NamespaceAliasDecl>::getMostRecentDecl()
Line
Count
Source
225
115
  decl_type *getMostRecentDecl() {
226
115
    return getFirstDecl()->getNextRedeclaration();
227
115
  }
228
229
  /// Returns the most recent (re)declaration of this declaration.
230
5.53M
  const decl_type *getMostRecentDecl() const {
231
5.53M
    return getFirstDecl()->getNextRedeclaration();
232
5.53M
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::getMostRecentDecl() const
Line
Count
Source
230
1.56k
  const decl_type *getMostRecentDecl() const {
231
1.56k
    return getFirstDecl()->getNextRedeclaration();
232
1.56k
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::getMostRecentDecl() const
Line
Count
Source
230
66.6k
  const decl_type *getMostRecentDecl() const {
231
66.6k
    return getFirstDecl()->getNextRedeclaration();
232
66.6k
  }
clang::Redeclarable<clang::FunctionDecl>::getMostRecentDecl() const
Line
Count
Source
230
518k
  const decl_type *getMostRecentDecl() const {
231
518k
    return getFirstDecl()->getNextRedeclaration();
232
518k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getMostRecentDecl() const
Line
Count
Source
230
4.94M
  const decl_type *getMostRecentDecl() const {
231
4.94M
    return getFirstDecl()->getNextRedeclaration();
232
4.94M
  }
clang::Redeclarable<clang::VarDecl>::getMostRecentDecl() const
Line
Count
Source
230
833
  const decl_type *getMostRecentDecl() const {
231
833
    return getFirstDecl()->getNextRedeclaration();
232
833
  }
clang::Redeclarable<clang::TagDecl>::getMostRecentDecl() const
Line
Count
Source
230
135
  const decl_type *getMostRecentDecl() const {
231
135
    return getFirstDecl()->getNextRedeclaration();
232
135
  }
233
234
  /// Set the previous declaration. If PrevDecl is NULL, set this as the
235
  /// first and only declaration.
236
  void setPreviousDecl(decl_type *PrevDecl);
237
238
  /// Iterates through all the redeclarations of the same decl.
239
  class redecl_iterator {
240
    /// Current - The current declaration.
241
    decl_type *Current = nullptr;
242
    decl_type *Starter;
243
    bool PassedFirst = false;
244
245
  public:
246
    using value_type = decl_type *;
247
    using reference = decl_type *;
248
    using pointer = decl_type *;
249
    using iterator_category = std::forward_iterator_tag;
250
    using difference_type = std::ptrdiff_t;
251
252
231M
    redecl_iterator() = default;
clang::Redeclarable<clang::VarDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
252
35.0M
    redecl_iterator() = default;
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
252
23.1M
    redecl_iterator() = default;
clang::Redeclarable<clang::TagDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
252
173M
    redecl_iterator() = default;
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
252
88.5k
    redecl_iterator() = default;
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
252
21.1k
    redecl_iterator() = default;
clang::Redeclarable<clang::RedeclarableTemplateDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
252
441k
    redecl_iterator() = default;
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::redecl_iterator()
Line
Count
Source
252
883
    redecl_iterator() = default;
253
231M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::VarDecl>::redecl_iterator::redecl_iterator(clang::VarDecl*)
Line
Count
Source
253
35.0M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::redecl_iterator(clang::FunctionDecl*)
Line
Count
Source
253
23.1M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::TagDecl>::redecl_iterator::redecl_iterator(clang::TagDecl*)
Line
Count
Source
253
173M
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::redecl_iterator(clang::ObjCInterfaceDecl*)
Line
Count
Source
253
88.5k
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::redecl_iterator(clang::ObjCProtocolDecl*)
Line
Count
Source
253
21.1k
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::RedeclarableTemplateDecl>::redecl_iterator::redecl_iterator(clang::RedeclarableTemplateDecl*)
Line
Count
Source
253
441k
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::redecl_iterator(clang::UsingShadowDecl*)
Line
Count
Source
253
883
    explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
254
255
249M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::VarDecl>::redecl_iterator::operator*() const
Line
Count
Source
255
40.6M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::operator*() const
Line
Count
Source
255
24.3M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::TagDecl>::redecl_iterator::operator*() const
Line
Count
Source
255
184M
    reference operator*() const { return Current; }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::operator*() const
Line
Count
Source
255
132k
    reference operator*() const { return Current; }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::operator*() const
Line
Count
Source
255
27.2k
    reference operator*() const { return Current; }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::redecl_iterator::operator*() const
Line
Count
Source
255
490k
    reference operator*() const { return Current; }
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::operator*() const
Line
Count
Source
255
891
    reference operator*() const { return Current; }
256
    pointer operator->() const { return Current; }
257
258
66.5M
    redecl_iterator& operator++() {
259
66.5M
      assert(Current && "Advancing while iterator has reached end");
260
66.5M
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
66.5M
      if (Current->isFirstDecl()) {
262
60.0M
        if (PassedFirst) {
263
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
264
0
          Current = nullptr;
265
0
          return *this;
266
0
        }
267
60.0M
        PassedFirst = true;
268
60.0M
      }
269
66.5M
270
66.5M
      // Get either previous decl or latest decl.
271
66.5M
      decl_type *Next = Current->getNextRedeclaration();
272
66.5M
      Current = (Next != Starter) ? 
Next18.0M
:
nullptr48.5M
;
273
66.5M
      return *this;
274
66.5M
    }
clang::Redeclarable<clang::VarDecl>::redecl_iterator::operator++()
Line
Count
Source
258
19.0M
    redecl_iterator& operator++() {
259
19.0M
      assert(Current && "Advancing while iterator has reached end");
260
19.0M
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
19.0M
      if (Current->isFirstDecl()) {
262
16.4M
        if (PassedFirst) {
263
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
264
0
          Current = nullptr;
265
0
          return *this;
266
0
        }
267
16.4M
        PassedFirst = true;
268
16.4M
      }
269
19.0M
270
19.0M
      // Get either previous decl or latest decl.
271
19.0M
      decl_type *Next = Current->getNextRedeclaration();
272
19.0M
      Current = (Next != Starter) ? 
Next5.60M
:
nullptr13.4M
;
273
19.0M
      return *this;
274
19.0M
    }
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::operator++()
Line
Count
Source
258
12.5M
    redecl_iterator& operator++() {
259
12.5M
      assert(Current && "Advancing while iterator has reached end");
260
12.5M
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
12.5M
      if (Current->isFirstDecl()) {
262
12.0M
        if (PassedFirst) {
263
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
264
0
          Current = nullptr;
265
0
          return *this;
266
0
        }
267
12.0M
        PassedFirst = true;
268
12.0M
      }
269
12.5M
270
12.5M
      // Get either previous decl or latest decl.
271
12.5M
      decl_type *Next = Current->getNextRedeclaration();
272
12.5M
      Current = (Next != Starter) ? 
Next1.17M
:
nullptr11.3M
;
273
12.5M
      return *this;
274
12.5M
    }
clang::Redeclarable<clang::TagDecl>::redecl_iterator::operator++()
Line
Count
Source
258
34.2M
    redecl_iterator& operator++() {
259
34.2M
      assert(Current && "Advancing while iterator has reached end");
260
34.2M
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
34.2M
      if (Current->isFirstDecl()) {
262
30.9M
        if (PassedFirst) {
263
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
264
0
          Current = nullptr;
265
0
          return *this;
266
0
        }
267
30.9M
        PassedFirst = true;
268
30.9M
      }
269
34.2M
270
34.2M
      // Get either previous decl or latest decl.
271
34.2M
      decl_type *Next = Current->getNextRedeclaration();
272
34.2M
      Current = (Next != Starter) ? 
Next11.1M
:
nullptr23.1M
;
273
34.2M
      return *this;
274
34.2M
    }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::operator++()
Line
Count
Source
258
132k
    redecl_iterator& operator++() {
259
132k
      assert(Current && "Advancing while iterator has reached end");
260
132k
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
132k
      if (Current->isFirstDecl()) {
262
88.5k
        if (PassedFirst) {
263
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
264
0
          Current = nullptr;
265
0
          return *this;
266
0
        }
267
88.5k
        PassedFirst = true;
268
88.5k
      }
269
132k
270
132k
      // Get either previous decl or latest decl.
271
132k
      decl_type *Next = Current->getNextRedeclaration();
272
132k
      Current = (Next != Starter) ? 
Next43.5k
:
nullptr88.5k
;
273
132k
      return *this;
274
132k
    }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::operator++()
Line
Count
Source
258
27.2k
    redecl_iterator& operator++() {
259
27.2k
      assert(Current && "Advancing while iterator has reached end");
260
27.2k
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
27.2k
      if (Current->isFirstDecl()) {
262
21.1k
        if (PassedFirst) {
263
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
264
0
          Current = nullptr;
265
0
          return *this;
266
0
        }
267
21.1k
        PassedFirst = true;
268
21.1k
      }
269
27.2k
270
27.2k
      // Get either previous decl or latest decl.
271
27.2k
      decl_type *Next = Current->getNextRedeclaration();
272
27.2k
      Current = (Next != Starter) ? 
Next6.15k
:
nullptr21.1k
;
273
27.2k
      return *this;
274
27.2k
    }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::redecl_iterator::operator++()
Line
Count
Source
258
490k
    redecl_iterator& operator++() {
259
490k
      assert(Current && "Advancing while iterator has reached end");
260
490k
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
490k
      if (Current->isFirstDecl()) {
262
441k
        if (PassedFirst) {
263
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
264
0
          Current = nullptr;
265
0
          return *this;
266
0
        }
267
441k
        PassedFirst = true;
268
441k
      }
269
490k
270
490k
      // Get either previous decl or latest decl.
271
490k
      decl_type *Next = Current->getNextRedeclaration();
272
490k
      Current = (Next != Starter) ? 
Next49.0k
:
nullptr441k
;
273
490k
      return *this;
274
490k
    }
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::operator++()
Line
Count
Source
258
891
    redecl_iterator& operator++() {
259
891
      assert(Current && "Advancing while iterator has reached end");
260
891
      // Sanity check to avoid infinite loop on invalid redecl chain.
261
891
      if (Current->isFirstDecl()) {
262
883
        if (PassedFirst) {
263
0
          assert(0 && "Passed first decl twice, invalid redecl chain!");
264
0
          Current = nullptr;
265
0
          return *this;
266
0
        }
267
883
        PassedFirst = true;
268
883
      }
269
891
270
891
      // Get either previous decl or latest decl.
271
891
      decl_type *Next = Current->getNextRedeclaration();
272
891
      Current = (Next != Starter) ? 
Next8
:
nullptr883
;
273
891
      return *this;
274
891
    }
275
276
    redecl_iterator operator++(int) {
277
      redecl_iterator tmp(*this);
278
      ++(*this);
279
      return tmp;
280
    }
281
282
11
    friend bool operator==(redecl_iterator x, redecl_iterator y) {
283
11
      return x.Current == y.Current;
284
11
    }
285
298M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
286
298M
      return x.Current != y.Current;
287
298M
    }
clang::operator!=(clang::Redeclarable<clang::VarDecl>::redecl_iterator, clang::Redeclarable<clang::VarDecl>::redecl_iterator)
Line
Count
Source
285
54.1M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
286
54.1M
      return x.Current != y.Current;
287
54.1M
    }
clang::operator!=(clang::Redeclarable<clang::FunctionDecl>::redecl_iterator, clang::Redeclarable<clang::FunctionDecl>::redecl_iterator)
Line
Count
Source
285
35.7M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
286
35.7M
      return x.Current != y.Current;
287
35.7M
    }
clang::operator!=(clang::Redeclarable<clang::TagDecl>::redecl_iterator, clang::Redeclarable<clang::TagDecl>::redecl_iterator)
Line
Count
Source
285
207M
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
286
207M
      return x.Current != y.Current;
287
207M
    }
clang::operator!=(clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator, clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator)
Line
Count
Source
285
220k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
286
220k
      return x.Current != y.Current;
287
220k
    }
clang::operator!=(clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator, clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator)
Line
Count
Source
285
48.4k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
286
48.4k
      return x.Current != y.Current;
287
48.4k
    }
clang::operator!=(clang::Redeclarable<clang::RedeclarableTemplateDecl>::redecl_iterator, clang::Redeclarable<clang::RedeclarableTemplateDecl>::redecl_iterator)
Line
Count
Source
285
931k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
286
931k
      return x.Current != y.Current;
287
931k
    }
clang::operator!=(clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator, clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator)
Line
Count
Source
285
1.77k
    friend bool operator!=(redecl_iterator x, redecl_iterator y) {
286
1.77k
      return x.Current != y.Current;
287
1.77k
    }
288
  };
289
290
  using redecl_range = llvm::iterator_range<redecl_iterator>;
291
292
  /// Returns an iterator range for all the redeclarations of the same
293
  /// decl. It will iterate at least once (when this decl is the only one).
294
231M
  redecl_range redecls() const {
295
231M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
296
231M
                            static_cast<const decl_type *>(this))),
297
231M
                        redecl_iterator());
298
231M
  }
clang::Redeclarable<clang::VarDecl>::redecls() const
Line
Count
Source
294
35.0M
  redecl_range redecls() const {
295
35.0M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
296
35.0M
                            static_cast<const decl_type *>(this))),
297
35.0M
                        redecl_iterator());
298
35.0M
  }
clang::Redeclarable<clang::FunctionDecl>::redecls() const
Line
Count
Source
294
23.1M
  redecl_range redecls() const {
295
23.1M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
296
23.1M
                            static_cast<const decl_type *>(this))),
297
23.1M
                        redecl_iterator());
298
23.1M
  }
clang::Redeclarable<clang::TagDecl>::redecls() const
Line
Count
Source
294
173M
  redecl_range redecls() const {
295
173M
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
296
173M
                            static_cast<const decl_type *>(this))),
297
173M
                        redecl_iterator());
298
173M
  }
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecls() const
Line
Count
Source
294
88.5k
  redecl_range redecls() const {
295
88.5k
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
296
88.5k
                            static_cast<const decl_type *>(this))),
297
88.5k
                        redecl_iterator());
298
88.5k
  }
clang::Redeclarable<clang::ObjCProtocolDecl>::redecls() const
Line
Count
Source
294
21.1k
  redecl_range redecls() const {
295
21.1k
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
296
21.1k
                            static_cast<const decl_type *>(this))),
297
21.1k
                        redecl_iterator());
298
21.1k
  }
clang::Redeclarable<clang::RedeclarableTemplateDecl>::redecls() const
Line
Count
Source
294
441k
  redecl_range redecls() const {
295
441k
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
296
441k
                            static_cast<const decl_type *>(this))),
297
441k
                        redecl_iterator());
298
441k
  }
clang::Redeclarable<clang::UsingShadowDecl>::redecls() const
Line
Count
Source
294
883
  redecl_range redecls() const {
295
883
    return redecl_range(redecl_iterator(const_cast<decl_type *>(
296
883
                            static_cast<const decl_type *>(this))),
297
883
                        redecl_iterator());
298
883
  }
299
300
  redecl_iterator redecls_begin() const { return redecls().begin(); }
301
11
  redecl_iterator redecls_end() const { return redecls().end(); }
302
};
303
304
/// Get the primary declaration for a declaration from an AST file. That
305
/// will be the first-loaded declaration.
306
Decl *getPrimaryMergedDecl(Decl *D);
307
308
/// Provides common interface for the Decls that cannot be redeclared,
309
/// but can be merged if the same declaration is brought in from multiple
310
/// modules.
311
template<typename decl_type>
312
class Mergeable {
313
public:
314
  Mergeable() = default;
315
316
  /// Return the first declaration of this declaration or itself if this
317
  /// is the only declaration.
318
8.70M
  decl_type *getFirstDecl() {
319
8.70M
    auto *D = static_cast<decl_type *>(this);
320
8.70M
    if (!D->isFromASTFile())
321
8.65M
      return D;
322
47.8k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
323
47.8k
  }
clang::Mergeable<clang::FieldDecl>::getFirstDecl()
Line
Count
Source
318
7.61M
  decl_type *getFirstDecl() {
319
7.61M
    auto *D = static_cast<decl_type *>(this);
320
7.61M
    if (!D->isFromASTFile())
321
7.57M
      return D;
322
40.8k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
323
40.8k
  }
clang::Mergeable<clang::EnumConstantDecl>::getFirstDecl()
Line
Count
Source
318
815k
  decl_type *getFirstDecl() {
319
815k
    auto *D = static_cast<decl_type *>(this);
320
815k
    if (!D->isFromASTFile())
321
809k
      return D;
322
5.27k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
323
5.27k
  }
clang::Mergeable<clang::IndirectFieldDecl>::getFirstDecl()
Line
Count
Source
318
9.45k
  decl_type *getFirstDecl() {
319
9.45k
    auto *D = static_cast<decl_type *>(this);
320
9.45k
    if (!D->isFromASTFile())
321
9.10k
      return D;
322
345
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
323
345
  }
clang::Mergeable<clang::UsingDecl>::getFirstDecl()
Line
Count
Source
318
256k
  decl_type *getFirstDecl() {
319
256k
    auto *D = static_cast<decl_type *>(this);
320
256k
    if (!D->isFromASTFile())
321
255k
      return D;
322
816
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
323
816
  }
clang::Mergeable<clang::UsingPackDecl>::getFirstDecl()
Line
Count
Source
318
3
  decl_type *getFirstDecl() {
319
3
    auto *D = static_cast<decl_type *>(this);
320
3
    if (!D->isFromASTFile())
321
2
      return D;
322
1
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
323
1
  }
clang::Mergeable<clang::UnresolvedUsingValueDecl>::getFirstDecl()
Line
Count
Source
318
1.46k
  decl_type *getFirstDecl() {
319
1.46k
    auto *D = static_cast<decl_type *>(this);
320
1.46k
    if (!D->isFromASTFile())
321
1.33k
      return D;
322
132
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
323
132
  }
clang::Mergeable<clang::UnresolvedUsingTypenameDecl>::getFirstDecl()
Line
Count
Source
318
1.41k
  decl_type *getFirstDecl() {
319
1.41k
    auto *D = static_cast<decl_type *>(this);
320
1.41k
    if (!D->isFromASTFile())
321
988
      return D;
322
428
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
323
428
  }
324
325
  /// Return the first declaration of this declaration or itself if this
326
  /// is the only declaration.
327
1.13M
  const decl_type *getFirstDecl() const {
328
1.13M
    const auto *D = static_cast<const decl_type *>(this);
329
1.13M
    if (!D->isFromASTFile())
330
1.08M
      return D;
331
44.4k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
332
44.4k
  }
clang::Mergeable<clang::FieldDecl>::getFirstDecl() const
Line
Count
Source
327
1.13M
  const decl_type *getFirstDecl() const {
328
1.13M
    const auto *D = static_cast<const decl_type *>(this);
329
1.13M
    if (!D->isFromASTFile())
330
1.08M
      return D;
331
44.4k
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
332
44.4k
  }
clang::Mergeable<clang::EnumConstantDecl>::getFirstDecl() const
Line
Count
Source
327
80
  const decl_type *getFirstDecl() const {
328
80
    const auto *D = static_cast<const decl_type *>(this);
329
80
    if (!D->isFromASTFile())
330
80
      return D;
331
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
332
0
  }
clang::Mergeable<clang::IndirectFieldDecl>::getFirstDecl() const
Line
Count
Source
327
41
  const decl_type *getFirstDecl() const {
328
41
    const auto *D = static_cast<const decl_type *>(this);
329
41
    if (!D->isFromASTFile())
330
41
      return D;
331
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
332
0
  }
clang::Mergeable<clang::UsingDecl>::getFirstDecl() const
Line
Count
Source
327
22
  const decl_type *getFirstDecl() const {
328
22
    const auto *D = static_cast<const decl_type *>(this);
329
22
    if (!D->isFromASTFile())
330
22
      return D;
331
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
332
0
  }
Unexecuted instantiation: clang::Mergeable<clang::UsingPackDecl>::getFirstDecl() const
clang::Mergeable<clang::UnresolvedUsingValueDecl>::getFirstDecl() const
Line
Count
Source
327
1
  const decl_type *getFirstDecl() const {
328
1
    const auto *D = static_cast<const decl_type *>(this);
329
1
    if (!D->isFromASTFile())
330
1
      return D;
331
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
332
0
  }
clang::Mergeable<clang::UnresolvedUsingTypenameDecl>::getFirstDecl() const
Line
Count
Source
327
1
  const decl_type *getFirstDecl() const {
328
1
    const auto *D = static_cast<const decl_type *>(this);
329
1
    if (!D->isFromASTFile())
330
1
      return D;
331
0
    return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D)));
332
0
  }
Unexecuted instantiation: clang::Mergeable<clang::LifetimeExtendedTemporaryDecl>::getFirstDecl() const
Unexecuted instantiation: clang::Mergeable<clang::ConceptDecl>::getFirstDecl() const
333
334
  /// Returns true if this is the first declaration.
335
  bool isFirstDecl() const { return getFirstDecl() == this; }
336
};
337
338
/// A wrapper class around a pointer that always points to its canonical
339
/// declaration.
340
///
341
/// CanonicalDeclPtr<decl_type> behaves just like decl_type*, except we call
342
/// decl_type::getCanonicalDecl() on construction.
343
///
344
/// This is useful for hashtables that you want to be keyed on a declaration's
345
/// canonical decl -- if you use CanonicalDeclPtr as the key, you don't need to
346
/// remember to call getCanonicalDecl() everywhere.
347
template <typename decl_type> class CanonicalDeclPtr {
348
public:
349
1.17M
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::FunctionDecl>::CanonicalDeclPtr()
Line
Count
Source
349
500k
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::Decl>::CanonicalDeclPtr()
Line
Count
Source
349
397k
  CanonicalDeclPtr() = default;
Unexecuted instantiation: clang::CanonicalDeclPtr<clang::VarDecl>::CanonicalDeclPtr()
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::CanonicalDeclPtr()
Line
Count
Source
349
211k
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::Decl const>::CanonicalDeclPtr()
Line
Count
Source
349
26.8k
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::FunctionDecl const>::CanonicalDeclPtr()
Line
Count
Source
349
2.03k
  CanonicalDeclPtr() = default;
clang::CanonicalDeclPtr<clang::VarDecl const>::CanonicalDeclPtr()
Line
Count
Source
349
36.9k
  CanonicalDeclPtr() = default;
350
  CanonicalDeclPtr(decl_type *Ptr)
351
676k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::FunctionDecl>::CanonicalDeclPtr(clang::FunctionDecl*)
Line
Count
Source
351
416k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::Decl>::CanonicalDeclPtr(clang::Decl*)
Line
Count
Source
351
117k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::VarDecl>::CanonicalDeclPtr(clang::VarDecl*)
Line
Count
Source
351
77.3k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::CanonicalDeclPtr(clang::CXXRecordDecl const*)
Line
Count
Source
351
36.8k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::VarDecl const>::CanonicalDeclPtr(clang::VarDecl const*)
Line
Count
Source
351
11.4k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::Decl const>::CanonicalDeclPtr(clang::Decl const*)
Line
Count
Source
351
15.6k
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
clang::CanonicalDeclPtr<clang::FunctionDecl const>::CanonicalDeclPtr(clang::FunctionDecl const*)
Line
Count
Source
351
644
      : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
352
  CanonicalDeclPtr(const CanonicalDeclPtr &) = default;
353
  CanonicalDeclPtr &operator=(const CanonicalDeclPtr &) = default;
354
355
3.60k
  operator decl_type *() { return Ptr; }
clang::CanonicalDeclPtr<clang::FunctionDecl>::operator clang::FunctionDecl*()
Line
Count
Source
355
371
  operator decl_type *() { return Ptr; }
clang::CanonicalDeclPtr<clang::VarDecl>::operator clang::VarDecl*()
Line
Count
Source
355
881
  operator decl_type *() { return Ptr; }
clang::CanonicalDeclPtr<clang::Decl const>::operator clang::Decl const*()
Line
Count
Source
355
2.35k
  operator decl_type *() { return Ptr; }
356
17.0M
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::FunctionDecl>::operator clang::FunctionDecl const*() const
Line
Count
Source
356
3.54M
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::Decl>::operator clang::Decl const*() const
Line
Count
Source
356
7.86M
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::operator clang::CXXRecordDecl const*() const
Line
Count
Source
356
4.78M
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::Decl const>::operator clang::Decl const*() const
Line
Count
Source
356
360k
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::FunctionDecl const>::operator clang::FunctionDecl const*() const
Line
Count
Source
356
14.7k
  operator const decl_type *() const { return Ptr; }
clang::CanonicalDeclPtr<clang::VarDecl const>::operator clang::VarDecl const*() const
Line
Count
Source
356
523k
  operator const decl_type *() const { return Ptr; }
357
358
  decl_type *operator->() { return Ptr; }
359
20.6k
  const decl_type *operator->() const { return Ptr; }
clang::CanonicalDeclPtr<clang::FunctionDecl>::operator->() const
Line
Count
Source
359
20.6k
  const decl_type *operator->() const { return Ptr; }
clang::CanonicalDeclPtr<clang::Decl const>::operator->() const
Line
Count
Source
359
4
  const decl_type *operator->() const { return Ptr; }
360
361
  decl_type &operator*() { return *Ptr; }
362
  const decl_type &operator*() const { return *Ptr; }
363
364
3.04k
  friend bool operator==(CanonicalDeclPtr LHS, CanonicalDeclPtr RHS) {
365
3.04k
    return LHS.Ptr == RHS.Ptr;
366
3.04k
  }
clang::operator==(clang::CanonicalDeclPtr<clang::FunctionDecl>, clang::CanonicalDeclPtr<clang::FunctionDecl>)
Line
Count
Source
364
3.01k
  friend bool operator==(CanonicalDeclPtr LHS, CanonicalDeclPtr RHS) {
365
3.01k
    return LHS.Ptr == RHS.Ptr;
366
3.01k
  }
clang::operator==(clang::CanonicalDeclPtr<clang::Decl>, clang::CanonicalDeclPtr<clang::Decl>)
Line
Count
Source
364
36
  friend bool operator==(CanonicalDeclPtr LHS, CanonicalDeclPtr RHS) {
365
36
    return LHS.Ptr == RHS.Ptr;
366
36
  }
367
  friend bool operator!=(CanonicalDeclPtr LHS, CanonicalDeclPtr RHS) {
368
    return LHS.Ptr != RHS.Ptr;
369
  }
370
371
private:
372
  friend struct llvm::DenseMapInfo<CanonicalDeclPtr<decl_type>>;
373
374
  decl_type *Ptr = nullptr;
375
};
376
377
} // namespace clang
378
379
namespace llvm {
380
381
template <typename decl_type>
382
struct DenseMapInfo<clang::CanonicalDeclPtr<decl_type>> {
383
  using CanonicalDeclPtr = clang::CanonicalDeclPtr<decl_type>;
384
  using BaseInfo = DenseMapInfo<decl_type *>;
385
386
712k
  static CanonicalDeclPtr getEmptyKey() {
387
712k
    // Construct our CanonicalDeclPtr this way because the regular constructor
388
712k
    // would dereference P.Ptr, which is not allowed.
389
712k
    CanonicalDeclPtr P;
390
712k
    P.Ptr = BaseInfo::getEmptyKey();
391
712k
    return P;
392
712k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::getEmptyKey()
Line
Count
Source
386
267k
  static CanonicalDeclPtr getEmptyKey() {
387
267k
    // Construct our CanonicalDeclPtr this way because the regular constructor
388
267k
    // would dereference P.Ptr, which is not allowed.
389
267k
    CanonicalDeclPtr P;
390
267k
    P.Ptr = BaseInfo::getEmptyKey();
391
267k
    return P;
392
267k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl> >::getEmptyKey()
Line
Count
Source
386
264k
  static CanonicalDeclPtr getEmptyKey() {
387
264k
    // Construct our CanonicalDeclPtr this way because the regular constructor
388
264k
    // would dereference P.Ptr, which is not allowed.
389
264k
    CanonicalDeclPtr P;
390
264k
    P.Ptr = BaseInfo::getEmptyKey();
391
264k
    return P;
392
264k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::getEmptyKey()
Line
Count
Source
386
141k
  static CanonicalDeclPtr getEmptyKey() {
387
141k
    // Construct our CanonicalDeclPtr this way because the regular constructor
388
141k
    // would dereference P.Ptr, which is not allowed.
389
141k
    CanonicalDeclPtr P;
390
141k
    P.Ptr = BaseInfo::getEmptyKey();
391
141k
    return P;
392
141k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl const> >::getEmptyKey()
Line
Count
Source
386
15.4k
  static CanonicalDeclPtr getEmptyKey() {
387
15.4k
    // Construct our CanonicalDeclPtr this way because the regular constructor
388
15.4k
    // would dereference P.Ptr, which is not allowed.
389
15.4k
    CanonicalDeclPtr P;
390
15.4k
    P.Ptr = BaseInfo::getEmptyKey();
391
15.4k
    return P;
392
15.4k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl const> >::getEmptyKey()
Line
Count
Source
386
1.11k
  static CanonicalDeclPtr getEmptyKey() {
387
1.11k
    // Construct our CanonicalDeclPtr this way because the regular constructor
388
1.11k
    // would dereference P.Ptr, which is not allowed.
389
1.11k
    CanonicalDeclPtr P;
390
1.11k
    P.Ptr = BaseInfo::getEmptyKey();
391
1.11k
    return P;
392
1.11k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::VarDecl const> >::getEmptyKey()
Line
Count
Source
386
22.9k
  static CanonicalDeclPtr getEmptyKey() {
387
22.9k
    // Construct our CanonicalDeclPtr this way because the regular constructor
388
22.9k
    // would dereference P.Ptr, which is not allowed.
389
22.9k
    CanonicalDeclPtr P;
390
22.9k
    P.Ptr = BaseInfo::getEmptyKey();
391
22.9k
    return P;
392
22.9k
  }
393
394
460k
  static CanonicalDeclPtr getTombstoneKey() {
395
460k
    CanonicalDeclPtr P;
396
460k
    P.Ptr = BaseInfo::getTombstoneKey();
397
460k
    return P;
398
460k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::getTombstoneKey()
Line
Count
Source
394
229k
  static CanonicalDeclPtr getTombstoneKey() {
395
229k
    CanonicalDeclPtr P;
396
229k
    P.Ptr = BaseInfo::getTombstoneKey();
397
229k
    return P;
398
229k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl> >::getTombstoneKey()
Line
Count
Source
394
133k
  static CanonicalDeclPtr getTombstoneKey() {
395
133k
    CanonicalDeclPtr P;
396
133k
    P.Ptr = BaseInfo::getTombstoneKey();
397
133k
    return P;
398
133k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::getTombstoneKey()
Line
Count
Source
394
70.5k
  static CanonicalDeclPtr getTombstoneKey() {
395
70.5k
    CanonicalDeclPtr P;
396
70.5k
    P.Ptr = BaseInfo::getTombstoneKey();
397
70.5k
    return P;
398
70.5k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl const> >::getTombstoneKey()
Line
Count
Source
394
11.3k
  static CanonicalDeclPtr getTombstoneKey() {
395
11.3k
    CanonicalDeclPtr P;
396
11.3k
    P.Ptr = BaseInfo::getTombstoneKey();
397
11.3k
    return P;
398
11.3k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl const> >::getTombstoneKey()
Line
Count
Source
394
920
  static CanonicalDeclPtr getTombstoneKey() {
395
920
    CanonicalDeclPtr P;
396
920
    P.Ptr = BaseInfo::getTombstoneKey();
397
920
    return P;
398
920
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::VarDecl const> >::getTombstoneKey()
Line
Count
Source
394
14.0k
  static CanonicalDeclPtr getTombstoneKey() {
395
14.0k
    CanonicalDeclPtr P;
396
14.0k
    P.Ptr = BaseInfo::getTombstoneKey();
397
14.0k
    return P;
398
14.0k
  }
399
400
345k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
401
345k
    return BaseInfo::getHashValue(P);
402
345k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::getHashValue(clang::CanonicalDeclPtr<clang::FunctionDecl> const&)
Line
Count
Source
400
210k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
401
210k
    return BaseInfo::getHashValue(P);
402
210k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl> >::getHashValue(clang::CanonicalDeclPtr<clang::Decl> const&)
Line
Count
Source
400
80.0k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
401
80.0k
    return BaseInfo::getHashValue(P);
402
80.0k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::getHashValue(clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&)
Line
Count
Source
400
36.8k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
401
36.8k
    return BaseInfo::getHashValue(P);
402
36.8k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::VarDecl const> >::getHashValue(clang::CanonicalDeclPtr<clang::VarDecl const> const&)
Line
Count
Source
400
10.8k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
401
10.8k
    return BaseInfo::getHashValue(P);
402
10.8k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl const> >::getHashValue(clang::CanonicalDeclPtr<clang::Decl const> const&)
Line
Count
Source
400
6.60k
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
401
6.60k
    return BaseInfo::getHashValue(P);
402
6.60k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl const> >::getHashValue(clang::CanonicalDeclPtr<clang::FunctionDecl const> const&)
Line
Count
Source
400
650
  static unsigned getHashValue(const CanonicalDeclPtr &P) {
401
650
    return BaseInfo::getHashValue(P);
402
650
  }
403
404
  static bool isEqual(const CanonicalDeclPtr &LHS,
405
8.37M
                      const CanonicalDeclPtr &RHS) {
406
8.37M
    return BaseInfo::isEqual(LHS, RHS);
407
8.37M
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::isEqual(clang::CanonicalDeclPtr<clang::FunctionDecl> const&, clang::CanonicalDeclPtr<clang::FunctionDecl> const&)
Line
Count
Source
405
1.66M
                      const CanonicalDeclPtr &RHS) {
406
1.66M
    return BaseInfo::isEqual(LHS, RHS);
407
1.66M
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl> >::isEqual(clang::CanonicalDeclPtr<clang::Decl> const&, clang::CanonicalDeclPtr<clang::Decl> const&)
Line
Count
Source
405
3.89M
                      const CanonicalDeclPtr &RHS) {
406
3.89M
    return BaseInfo::isEqual(LHS, RHS);
407
3.89M
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::isEqual(clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&, clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&)
Line
Count
Source
405
2.37M
                      const CanonicalDeclPtr &RHS) {
406
2.37M
    return BaseInfo::isEqual(LHS, RHS);
407
2.37M
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl const> >::isEqual(clang::CanonicalDeclPtr<clang::Decl const> const&, clang::CanonicalDeclPtr<clang::Decl const> const&)
Line
Count
Source
405
176k
                      const CanonicalDeclPtr &RHS) {
406
176k
    return BaseInfo::isEqual(LHS, RHS);
407
176k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl const> >::isEqual(clang::CanonicalDeclPtr<clang::FunctionDecl const> const&, clang::CanonicalDeclPtr<clang::FunctionDecl const> const&)
Line
Count
Source
405
7.04k
                      const CanonicalDeclPtr &RHS) {
406
7.04k
    return BaseInfo::isEqual(LHS, RHS);
407
7.04k
  }
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::VarDecl const> >::isEqual(clang::CanonicalDeclPtr<clang::VarDecl const> const&, clang::CanonicalDeclPtr<clang::VarDecl const> const&)
Line
Count
Source
405
256k
                      const CanonicalDeclPtr &RHS) {
406
256k
    return BaseInfo::isEqual(LHS, RHS);
407
256k
  }
408
};
409
410
} // namespace llvm
411
412
#endif // LLVM_CLANG_AST_REDECLARABLE_H