/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 | 83.0M | : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {} clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::LatestTag, clang::ASTContext const&) Line | Count | Source | 112 | 4.00M | : 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 | 51.5M | : 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 | 17.6M | : 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 | 7.24M | : 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 | 345 | : 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 | 340k | : 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 | 184k | : 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 | 349k | : 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 | 31.4k | : 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.71M | : Link(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {} |
|
113 | 3.13M | 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 | 445k | 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 | 262k | 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.81M | 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 | 292k | 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 | 215k | 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 | 6.70k | DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {} |
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::DeclLink(clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::PreviousTag, clang::TypedefNameDecl*) Line | Count | Source | 113 | 24.3k | 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 | 69.9k | 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.27k | DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {} |
|
114 | | |
115 | 456M | bool isFirst() const { |
116 | 456M | return Link.is<KnownLatest>() || |
117 | | // FIXME: 'template' is required on the next line due to an |
118 | | // apparent clang bug. |
119 | 265M | Link.get<NotKnownLatest>().template is<UninitializedLatest>(); |
120 | 456M | } clang::Redeclarable<clang::VarDecl>::DeclLink::isFirst() const Line | Count | Source | 115 | 34.6M | bool isFirst() const { | 116 | 34.6M | return Link.is<KnownLatest>() || | 117 | | // FIXME: 'template' is required on the next line due to an | 118 | | // apparent clang bug. | 119 | 10.4M | Link.get<NotKnownLatest>().template is<UninitializedLatest>(); | 120 | 34.6M | } |
clang::Redeclarable<clang::FunctionDecl>::DeclLink::isFirst() const Line | Count | Source | 115 | 39.3M | bool isFirst() const { | 116 | 39.3M | return Link.is<KnownLatest>() || | 117 | | // FIXME: 'template' is required on the next line due to an | 118 | | // apparent clang bug. | 119 | 17.2M | Link.get<NotKnownLatest>().template is<UninitializedLatest>(); | 120 | 39.3M | } |
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::isFirst() const Line | Count | Source | 115 | 1.23M | bool isFirst() const { | 116 | 1.23M | return Link.is<KnownLatest>() || | 117 | | // FIXME: 'template' is required on the next line due to an | 118 | | // apparent clang bug. | 119 | 731k | Link.get<NotKnownLatest>().template is<UninitializedLatest>(); | 120 | 1.23M | } |
clang::Redeclarable<clang::TagDecl>::DeclLink::isFirst() const Line | Count | Source | 115 | 66.5M | bool isFirst() const { | 116 | 66.5M | return Link.is<KnownLatest>() || | 117 | | // FIXME: 'template' is required on the next line due to an | 118 | | // apparent clang bug. | 119 | 21.5M | Link.get<NotKnownLatest>().template is<UninitializedLatest>(); | 120 | 66.5M | } |
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::isFirst() const Line | Count | Source | 115 | 354k | bool isFirst() const { | 116 | 354k | return Link.is<KnownLatest>() || | 117 | | // FIXME: 'template' is required on the next line due to an | 118 | | // apparent clang bug. | 119 | 347k | Link.get<NotKnownLatest>().template is<UninitializedLatest>(); | 120 | 354k | } |
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::isFirst() const Line | Count | Source | 115 | 4.49M | bool isFirst() const { | 116 | 4.49M | return Link.is<KnownLatest>() || | 117 | | // FIXME: 'template' is required on the next line due to an | 118 | | // apparent clang bug. | 119 | 3.12M | Link.get<NotKnownLatest>().template is<UninitializedLatest>(); | 120 | 4.49M | } |
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::isFirst() const Line | Count | Source | 115 | 308M | bool isFirst() const { | 116 | 308M | return Link.is<KnownLatest>() || | 117 | | // FIXME: 'template' is required on the next line due to an | 118 | | // apparent clang bug. | 119 | 210M | Link.get<NotKnownLatest>().template is<UninitializedLatest>(); | 120 | 308M | } |
clang::Redeclarable<clang::NamespaceAliasDecl>::DeclLink::isFirst() const Line | Count | Source | 115 | 82 | bool isFirst() const { | 116 | 82 | return Link.is<KnownLatest>() || | 117 | | // FIXME: 'template' is required on the next line due to an | 118 | | // apparent clang bug. | 119 | 58 | Link.get<NotKnownLatest>().template is<UninitializedLatest>(); | 120 | 82 | } |
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::isFirst() const Line | Count | Source | 115 | 1.25M | bool isFirst() const { | 116 | 1.25M | return Link.is<KnownLatest>() || | 117 | | // FIXME: 'template' is required on the next line due to an | 118 | | // apparent clang bug. | 119 | 770k | Link.get<NotKnownLatest>().template is<UninitializedLatest>(); | 120 | 1.25M | } |
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::isFirst() const Line | Count | Source | 115 | 109k | bool isFirst() const { | 116 | 109k | return Link.is<KnownLatest>() || | 117 | | // FIXME: 'template' is required on the next line due to an | 118 | | // apparent clang bug. | 119 | 65.1k | Link.get<NotKnownLatest>().template is<UninitializedLatest>(); | 120 | 109k | } |
|
121 | | |
122 | 537M | decl_type *getPrevious(const decl_type *D) const { |
123 | 537M | if (Link.is<NotKnownLatest>()) { |
124 | 48.2M | NotKnownLatest NKL = Link.get<NotKnownLatest>(); |
125 | 48.2M | if (NKL.is<Previous>()) |
126 | 13.7M | return static_cast<decl_type*>(NKL.get<Previous>()); |
127 | | |
128 | | // Allocate the generational 'most recent' cache now, if needed. |
129 | 34.4M | Link = KnownLatest(*reinterpret_cast<const ASTContext *>( |
130 | 34.4M | NKL.get<UninitializedLatest>()), |
131 | 34.4M | const_cast<decl_type *>(D)); |
132 | 34.4M | } |
133 | | |
134 | 524M | return static_cast<decl_type*>(Link.get<KnownLatest>().get(D)); |
135 | 537M | } clang::Redeclarable<clang::VarDecl>::DeclLink::getPrevious(clang::VarDecl const*) const Line | Count | Source | 122 | 124M | decl_type *getPrevious(const decl_type *D) const { | 123 | 124M | if (Link.is<NotKnownLatest>()) { | 124 | 21.0M | NotKnownLatest NKL = Link.get<NotKnownLatest>(); | 125 | 21.0M | if (NKL.is<Previous>()) | 126 | 3.53M | return static_cast<decl_type*>(NKL.get<Previous>()); | 127 | | | 128 | | // Allocate the generational 'most recent' cache now, if needed. | 129 | 17.5M | Link = KnownLatest(*reinterpret_cast<const ASTContext *>( | 130 | 17.5M | NKL.get<UninitializedLatest>()), | 131 | 17.5M | const_cast<decl_type *>(D)); | 132 | 17.5M | } | 133 | | | 134 | 121M | return static_cast<decl_type*>(Link.get<KnownLatest>().get(D)); | 135 | 124M | } |
clang::Redeclarable<clang::FunctionDecl>::DeclLink::getPrevious(clang::FunctionDecl const*) const Line | Count | Source | 122 | 63.8M | decl_type *getPrevious(const decl_type *D) const { | 123 | 63.8M | if (Link.is<NotKnownLatest>()) { | 124 | 17.0M | NotKnownLatest NKL = Link.get<NotKnownLatest>(); | 125 | 17.0M | if (NKL.is<Previous>()) | 126 | 1.18M | return static_cast<decl_type*>(NKL.get<Previous>()); | 127 | | | 128 | | // Allocate the generational 'most recent' cache now, if needed. | 129 | 15.9M | Link = KnownLatest(*reinterpret_cast<const ASTContext *>( | 130 | 15.9M | NKL.get<UninitializedLatest>()), | 131 | 15.9M | const_cast<decl_type *>(D)); | 132 | 15.9M | } | 133 | | | 134 | 62.7M | return static_cast<decl_type*>(Link.get<KnownLatest>().get(D)); | 135 | 63.8M | } |
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::getPrevious(clang::TypedefNameDecl const*) const Line | Count | Source | 122 | 1.67M | decl_type *getPrevious(const decl_type *D) const { | 123 | 1.67M | if (Link.is<NotKnownLatest>()) { | 124 | 403k | NotKnownLatest NKL = Link.get<NotKnownLatest>(); | 125 | 403k | if (NKL.is<Previous>()) | 126 | 20.6k | return static_cast<decl_type*>(NKL.get<Previous>()); | 127 | | | 128 | | // Allocate the generational 'most recent' cache now, if needed. | 129 | 382k | Link = KnownLatest(*reinterpret_cast<const ASTContext *>( | 130 | 382k | NKL.get<UninitializedLatest>()), | 131 | 382k | const_cast<decl_type *>(D)); | 132 | 382k | } | 133 | | | 134 | 1.65M | return static_cast<decl_type*>(Link.get<KnownLatest>().get(D)); | 135 | 1.67M | } |
clang::Redeclarable<clang::TagDecl>::DeclLink::getPrevious(clang::TagDecl const*) const Line | Count | Source | 122 | 320M | decl_type *getPrevious(const decl_type *D) const { | 123 | 320M | if (Link.is<NotKnownLatest>()) { | 124 | 7.18M | NotKnownLatest NKL = Link.get<NotKnownLatest>(); | 125 | 7.18M | if (NKL.is<Previous>()) | 126 | 7.18M | return static_cast<decl_type*>(NKL.get<Previous>()); | 127 | | | 128 | | // Allocate the generational 'most recent' cache now, if needed. | 129 | 0 | Link = KnownLatest(*reinterpret_cast<const ASTContext *>( | 130 | 0 | NKL.get<UninitializedLatest>()), | 131 | 0 | const_cast<decl_type *>(D)); | 132 | 0 | } | 133 | | | 134 | 312M | return static_cast<decl_type*>(Link.get<KnownLatest>().get(D)); | 135 | 320M | } |
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::getPrevious(clang::UsingShadowDecl const*) const Line | Count | Source | 122 | 584k | decl_type *getPrevious(const decl_type *D) const { | 123 | 584k | if (Link.is<NotKnownLatest>()) { | 124 | 7.50k | NotKnownLatest NKL = Link.get<NotKnownLatest>(); | 125 | 7.50k | if (NKL.is<Previous>()) | 126 | 7.49k | return static_cast<decl_type*>(NKL.get<Previous>()); | 127 | | | 128 | | // Allocate the generational 'most recent' cache now, if needed. | 129 | 13 | Link = KnownLatest(*reinterpret_cast<const ASTContext *>( | 130 | 13 | NKL.get<UninitializedLatest>()), | 131 | 13 | const_cast<decl_type *>(D)); | 132 | 13 | } | 133 | | | 134 | 577k | return static_cast<decl_type*>(Link.get<KnownLatest>().get(D)); | 135 | 584k | } |
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::getPrevious(clang::ObjCProtocolDecl const*) const Line | Count | Source | 122 | 195k | decl_type *getPrevious(const decl_type *D) const { | 123 | 195k | if (Link.is<NotKnownLatest>()) { | 124 | 9.04k | NotKnownLatest NKL = Link.get<NotKnownLatest>(); | 125 | 9.04k | if (NKL.is<Previous>()) | 126 | 9.04k | return static_cast<decl_type*>(NKL.get<Previous>()); | 127 | | | 128 | | // Allocate the generational 'most recent' cache now, if needed. | 129 | 0 | Link = KnownLatest(*reinterpret_cast<const ASTContext *>( | 130 | 0 | NKL.get<UninitializedLatest>()), | 131 | 0 | const_cast<decl_type *>(D)); | 132 | 0 | } | 133 | | | 134 | 185k | return static_cast<decl_type*>(Link.get<KnownLatest>().get(D)); | 135 | 195k | } |
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::getPrevious(clang::ObjCInterfaceDecl const*) const Line | Count | Source | 122 | 1.02M | decl_type *getPrevious(const decl_type *D) const { | 123 | 1.02M | if (Link.is<NotKnownLatest>()) { | 124 | 256k | NotKnownLatest NKL = Link.get<NotKnownLatest>(); | 125 | 256k | if (NKL.is<Previous>()) | 126 | 256k | return static_cast<decl_type*>(NKL.get<Previous>()); | 127 | | | 128 | | // Allocate the generational 'most recent' cache now, if needed. | 129 | 0 | Link = KnownLatest(*reinterpret_cast<const ASTContext *>( | 130 | 0 | NKL.get<UninitializedLatest>()), | 131 | 0 | const_cast<decl_type *>(D)); | 132 | 0 | } | 133 | | | 134 | 767k | return static_cast<decl_type*>(Link.get<KnownLatest>().get(D)); | 135 | 1.02M | } |
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::getPrevious(clang::RedeclarableTemplateDecl const*) const Line | Count | Source | 122 | 18.8M | decl_type *getPrevious(const decl_type *D) const { | 123 | 18.8M | if (Link.is<NotKnownLatest>()) { | 124 | 1.16M | NotKnownLatest NKL = Link.get<NotKnownLatest>(); | 125 | 1.16M | if (NKL.is<Previous>()) | 126 | 510k | return static_cast<decl_type*>(NKL.get<Previous>()); | 127 | | | 128 | | // Allocate the generational 'most recent' cache now, if needed. | 129 | 657k | Link = KnownLatest(*reinterpret_cast<const ASTContext *>( | 130 | 657k | NKL.get<UninitializedLatest>()), | 131 | 657k | const_cast<decl_type *>(D)); | 132 | 657k | } | 133 | | | 134 | 18.2M | return static_cast<decl_type*>(Link.get<KnownLatest>().get(D)); | 135 | 18.8M | } |
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::getPrevious(clang::NamespaceDecl const*) const Line | Count | Source | 122 | 7.02M | decl_type *getPrevious(const decl_type *D) const { | 123 | 7.02M | if (Link.is<NotKnownLatest>()) { | 124 | 1.02M | NotKnownLatest NKL = Link.get<NotKnownLatest>(); | 125 | 1.02M | if (NKL.is<Previous>()) | 126 | 1.02M | return static_cast<decl_type*>(NKL.get<Previous>()); | 127 | | | 128 | | // Allocate the generational 'most recent' cache now, if needed. | 129 | 0 | Link = KnownLatest(*reinterpret_cast<const ASTContext *>( | 130 | 0 | NKL.get<UninitializedLatest>()), | 131 | 0 | const_cast<decl_type *>(D)); | 132 | 0 | } | 133 | | | 134 | 5.99M | return static_cast<decl_type*>(Link.get<KnownLatest>().get(D)); | 135 | 7.02M | } |
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 | | | 128 | | // 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 | | | 134 | 205 | return static_cast<decl_type*>(Link.get<KnownLatest>().get(D)); | 135 | 207 | } |
|
136 | | |
137 | 1.56M | void setPrevious(decl_type *D) { |
138 | 1.56M | assert(!isFirst() && "decl became non-canonical unexpectedly"); |
139 | 1.56M | Link = Previous(D); |
140 | 1.56M | } clang::Redeclarable<clang::VarDecl>::DeclLink::setPrevious(clang::VarDecl*) Line | Count | Source | 137 | 7.63k | void setPrevious(decl_type *D) { | 138 | 7.63k | assert(!isFirst() && "decl became non-canonical unexpectedly"); | 139 | 7.63k | Link = Previous(D); | 140 | 7.63k | } |
clang::Redeclarable<clang::FunctionDecl>::DeclLink::setPrevious(clang::FunctionDecl*) Line | Count | Source | 137 | 146k | void setPrevious(decl_type *D) { | 138 | 146k | assert(!isFirst() && "decl became non-canonical unexpectedly"); | 139 | 146k | Link = Previous(D); | 140 | 146k | } |
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::setPrevious(clang::NamespaceDecl*) Line | Count | Source | 137 | 244k | void setPrevious(decl_type *D) { | 138 | 244k | assert(!isFirst() && "decl became non-canonical unexpectedly"); | 139 | 244k | Link = Previous(D); | 140 | 244k | } |
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 | 50.6k | void setPrevious(decl_type *D) { | 138 | 50.6k | assert(!isFirst() && "decl became non-canonical unexpectedly"); | 139 | 50.6k | Link = Previous(D); | 140 | 50.6k | } |
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::setPrevious(clang::ObjCProtocolDecl*) Line | Count | Source | 137 | 364 | void setPrevious(decl_type *D) { | 138 | 364 | assert(!isFirst() && "decl became non-canonical unexpectedly"); | 139 | 364 | Link = Previous(D); | 140 | 364 | } |
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::setPrevious(clang::RedeclarableTemplateDecl*) Line | Count | Source | 137 | 149k | void setPrevious(decl_type *D) { | 138 | 149k | assert(!isFirst() && "decl became non-canonical unexpectedly"); | 139 | 149k | Link = Previous(D); | 140 | 149k | } |
clang::Redeclarable<clang::TagDecl>::DeclLink::setPrevious(clang::TagDecl*) Line | Count | Source | 137 | 948k | void setPrevious(decl_type *D) { | 138 | 948k | assert(!isFirst() && "decl became non-canonical unexpectedly"); | 139 | 948k | Link = Previous(D); | 140 | 948k | } |
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::setPrevious(clang::TypedefNameDecl*) Line | Count | Source | 137 | 18.2k | void setPrevious(decl_type *D) { | 138 | 18.2k | assert(!isFirst() && "decl became non-canonical unexpectedly"); | 139 | 18.2k | Link = Previous(D); | 140 | 18.2k | } |
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::setPrevious(clang::UsingShadowDecl*) Line | Count | Source | 137 | 158 | void setPrevious(decl_type *D) { | 138 | 158 | assert(!isFirst() && "decl became non-canonical unexpectedly"); | 139 | 158 | Link = Previous(D); | 140 | 158 | } |
|
141 | | |
142 | 13.1M | void setLatest(decl_type *D) { |
143 | 13.1M | assert(isFirst() && "decl became canonical unexpectedly"); |
144 | 13.1M | if (Link.is<NotKnownLatest>()) { |
145 | 10.3M | NotKnownLatest NKL = Link.get<NotKnownLatest>(); |
146 | 10.3M | Link = KnownLatest(*reinterpret_cast<const ASTContext *>( |
147 | 10.3M | NKL.get<UninitializedLatest>()), |
148 | 10.3M | D); |
149 | 2.82M | } else { |
150 | 2.82M | auto Latest = Link.get<KnownLatest>(); |
151 | 2.82M | Latest.set(D); |
152 | 2.82M | Link = Latest; |
153 | 2.82M | } |
154 | 13.1M | } clang::Redeclarable<clang::FunctionDecl>::DeclLink::setLatest(clang::FunctionDecl*) Line | Count | Source | 142 | 1.05M | void setLatest(decl_type *D) { | 143 | 1.05M | assert(isFirst() && "decl became canonical unexpectedly"); | 144 | 1.05M | if (Link.is<NotKnownLatest>()) { | 145 | 758k | NotKnownLatest NKL = Link.get<NotKnownLatest>(); | 146 | 758k | Link = KnownLatest(*reinterpret_cast<const ASTContext *>( | 147 | 758k | NKL.get<UninitializedLatest>()), | 148 | 758k | D); | 149 | 300k | } else { | 150 | 300k | auto Latest = Link.get<KnownLatest>(); | 151 | 300k | Latest.set(D); | 152 | 300k | Link = Latest; | 153 | 300k | } | 154 | 1.05M | } |
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::setLatest(clang::RedeclarableTemplateDecl*) Line | Count | Source | 142 | 707k | void setLatest(decl_type *D) { | 143 | 707k | assert(isFirst() && "decl became canonical unexpectedly"); | 144 | 707k | if (Link.is<NotKnownLatest>()) { | 145 | 592k | NotKnownLatest NKL = Link.get<NotKnownLatest>(); | 146 | 592k | Link = KnownLatest(*reinterpret_cast<const ASTContext *>( | 147 | 592k | NKL.get<UninitializedLatest>()), | 148 | 592k | D); | 149 | 114k | } else { | 150 | 114k | auto Latest = Link.get<KnownLatest>(); | 151 | 114k | Latest.set(D); | 152 | 114k | Link = Latest; | 153 | 114k | } | 154 | 707k | } |
clang::Redeclarable<clang::TagDecl>::DeclLink::setLatest(clang::TagDecl*) Line | Count | Source | 142 | 8.48M | void setLatest(decl_type *D) { | 143 | 8.48M | assert(isFirst() && "decl became canonical unexpectedly"); | 144 | 8.48M | if (Link.is<NotKnownLatest>()) { | 145 | 6.38M | NotKnownLatest NKL = Link.get<NotKnownLatest>(); | 146 | 6.38M | Link = KnownLatest(*reinterpret_cast<const ASTContext *>( | 147 | 6.38M | NKL.get<UninitializedLatest>()), | 148 | 6.38M | D); | 149 | 2.09M | } else { | 150 | 2.09M | auto Latest = Link.get<KnownLatest>(); | 151 | 2.09M | Latest.set(D); | 152 | 2.09M | Link = Latest; | 153 | 2.09M | } | 154 | 8.48M | } |
clang::Redeclarable<clang::NamespaceDecl>::DeclLink::setLatest(clang::NamespaceDecl*) Line | Count | Source | 142 | 350k | void setLatest(decl_type *D) { | 143 | 350k | assert(isFirst() && "decl became canonical unexpectedly"); | 144 | 350k | if (Link.is<NotKnownLatest>()) { | 145 | 291k | NotKnownLatest NKL = Link.get<NotKnownLatest>(); | 146 | 291k | Link = KnownLatest(*reinterpret_cast<const ASTContext *>( | 147 | 291k | NKL.get<UninitializedLatest>()), | 148 | 291k | D); | 149 | 58.4k | } else { | 150 | 58.4k | auto Latest = Link.get<KnownLatest>(); | 151 | 58.4k | Latest.set(D); | 152 | 58.4k | Link = Latest; | 153 | 58.4k | } | 154 | 350k | } |
clang::Redeclarable<clang::ObjCInterfaceDecl>::DeclLink::setLatest(clang::ObjCInterfaceDecl*) Line | Count | Source | 142 | 358k | void setLatest(decl_type *D) { | 143 | 358k | assert(isFirst() && "decl became canonical unexpectedly"); | 144 | 358k | if (Link.is<NotKnownLatest>()) { | 145 | 184k | NotKnownLatest NKL = Link.get<NotKnownLatest>(); | 146 | 184k | Link = KnownLatest(*reinterpret_cast<const ASTContext *>( | 147 | 184k | NKL.get<UninitializedLatest>()), | 148 | 184k | D); | 149 | 173k | } else { | 150 | 173k | auto Latest = Link.get<KnownLatest>(); | 151 | 173k | Latest.set(D); | 152 | 173k | Link = Latest; | 153 | 173k | } | 154 | 358k | } |
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::setLatest(clang::ObjCProtocolDecl*) Line | Count | Source | 142 | 33.4k | void setLatest(decl_type *D) { | 143 | 33.4k | assert(isFirst() && "decl became canonical unexpectedly"); | 144 | 33.4k | if (Link.is<NotKnownLatest>()) { | 145 | 25.1k | NotKnownLatest NKL = Link.get<NotKnownLatest>(); | 146 | 25.1k | Link = KnownLatest(*reinterpret_cast<const ASTContext *>( | 147 | 25.1k | NKL.get<UninitializedLatest>()), | 148 | 25.1k | D); | 149 | 8.38k | } else { | 150 | 8.38k | auto Latest = Link.get<KnownLatest>(); | 151 | 8.38k | Latest.set(D); | 152 | 8.38k | Link = Latest; | 153 | 8.38k | } | 154 | 33.4k | } |
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 | 15 | } 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 | 273k | void setLatest(decl_type *D) { | 143 | 273k | assert(isFirst() && "decl became canonical unexpectedly"); | 144 | 273k | if (Link.is<NotKnownLatest>()) { | 145 | 265k | NotKnownLatest NKL = Link.get<NotKnownLatest>(); | 146 | 265k | Link = KnownLatest(*reinterpret_cast<const ASTContext *>( | 147 | 265k | NKL.get<UninitializedLatest>()), | 148 | 265k | D); | 149 | 7.77k | } else { | 150 | 7.77k | auto Latest = Link.get<KnownLatest>(); | 151 | 7.77k | Latest.set(D); | 152 | 7.77k | Link = Latest; | 153 | 7.77k | } | 154 | 273k | } |
clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::setLatest(clang::UsingShadowDecl*) Line | Count | Source | 142 | 174k | void setLatest(decl_type *D) { | 143 | 174k | assert(isFirst() && "decl became canonical unexpectedly"); | 144 | 174k | if (Link.is<NotKnownLatest>()) { | 145 | 171k | NotKnownLatest NKL = Link.get<NotKnownLatest>(); | 146 | 171k | Link = KnownLatest(*reinterpret_cast<const ASTContext *>( | 147 | 171k | NKL.get<UninitializedLatest>()), | 148 | 171k | D); | 149 | 3.11k | } else { | 150 | 3.11k | auto Latest = Link.get<KnownLatest>(); | 151 | 3.11k | Latest.set(D); | 152 | 3.11k | Link = Latest; | 153 | 3.11k | } | 154 | 174k | } |
clang::Redeclarable<clang::VarDecl>::DeclLink::setLatest(clang::VarDecl*) Line | Count | Source | 142 | 1.75M | void setLatest(decl_type *D) { | 143 | 1.75M | assert(isFirst() && "decl became canonical unexpectedly"); | 144 | 1.75M | if (Link.is<NotKnownLatest>()) { | 145 | 1.69M | NotKnownLatest NKL = Link.get<NotKnownLatest>(); | 146 | 1.69M | Link = KnownLatest(*reinterpret_cast<const ASTContext *>( | 147 | 1.69M | NKL.get<UninitializedLatest>()), | 148 | 1.69M | D); | 149 | 63.1k | } else { | 150 | 63.1k | auto Latest = Link.get<KnownLatest>(); | 151 | 63.1k | Latest.set(D); | 152 | 63.1k | Link = Latest; | 153 | 63.1k | } | 154 | 1.75M | } |
|
155 | | |
156 | 460k | 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 | 8.39k | 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 | 8.82k | void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); } |
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::markIncomplete() Line | Count | Source | 156 | 26 | void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); } |
Unexecuted instantiation: clang::Redeclarable<clang::UsingShadowDecl>::DeclLink::markIncomplete() clang::Redeclarable<clang::FunctionDecl>::DeclLink::markIncomplete() Line | Count | Source | 156 | 443k | void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); } |
clang::Redeclarable<clang::VarDecl>::DeclLink::markIncomplete() Line | Count | Source | 156 | 27 | void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); } |
|
157 | | |
158 | 427k | Decl *getLatestNotUpdated() const { |
159 | 427k | assert(isFirst() && "expected a canonical decl"); |
160 | 427k | if (Link.is<NotKnownLatest>()) |
161 | 1.65k | return nullptr; |
162 | 425k | return Link.get<KnownLatest>().getNotUpdated(); |
163 | 425k | } clang::Redeclarable<clang::NamespaceDecl>::DeclLink::getLatestNotUpdated() const Line | Count | Source | 158 | 2.28k | Decl *getLatestNotUpdated() const { | 159 | 2.28k | assert(isFirst() && "expected a canonical decl"); | 160 | 2.28k | if (Link.is<NotKnownLatest>()) | 161 | 0 | return nullptr; | 162 | 2.28k | return Link.get<KnownLatest>().getNotUpdated(); | 163 | 2.28k | } |
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 | 8.44k | Decl *getLatestNotUpdated() const { | 159 | 8.44k | assert(isFirst() && "expected a canonical decl"); | 160 | 8.44k | if (Link.is<NotKnownLatest>()) | 161 | 0 | return nullptr; | 162 | 8.44k | return Link.get<KnownLatest>().getNotUpdated(); | 163 | 8.44k | } |
clang::Redeclarable<clang::ObjCProtocolDecl>::DeclLink::getLatestNotUpdated() const Line | Count | Source | 158 | 2.01k | Decl *getLatestNotUpdated() const { | 159 | 2.01k | assert(isFirst() && "expected a canonical decl"); | 160 | 2.01k | if (Link.is<NotKnownLatest>()) | 161 | 0 | return nullptr; | 162 | 2.01k | return Link.get<KnownLatest>().getNotUpdated(); | 163 | 2.01k | } |
clang::Redeclarable<clang::RedeclarableTemplateDecl>::DeclLink::getLatestNotUpdated() const Line | Count | Source | 158 | 362k | Decl *getLatestNotUpdated() const { | 159 | 362k | assert(isFirst() && "expected a canonical decl"); | 160 | 362k | if (Link.is<NotKnownLatest>()) | 161 | 9 | return nullptr; | 162 | 362k | return Link.get<KnownLatest>().getNotUpdated(); | 163 | 362k | } |
clang::Redeclarable<clang::TagDecl>::DeclLink::getLatestNotUpdated() const Line | Count | Source | 158 | 46.8k | Decl *getLatestNotUpdated() const { | 159 | 46.8k | assert(isFirst() && "expected a canonical decl"); | 160 | 46.8k | if (Link.is<NotKnownLatest>()) | 161 | 0 | return nullptr; | 162 | 46.8k | return Link.get<KnownLatest>().getNotUpdated(); | 163 | 46.8k | } |
clang::Redeclarable<clang::TypedefNameDecl>::DeclLink::getLatestNotUpdated() const Line | Count | Source | 158 | 3.37k | Decl *getLatestNotUpdated() const { | 159 | 3.37k | assert(isFirst() && "expected a canonical decl"); | 160 | 3.37k | if (Link.is<NotKnownLatest>()) | 161 | 1.65k | return nullptr; | 162 | 1.72k | return Link.get<KnownLatest>().getNotUpdated(); | 163 | 1.72k | } |
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.36k | Decl *getLatestNotUpdated() const { | 159 | 1.36k | assert(isFirst() && "expected a canonical decl"); | 160 | 1.36k | if (Link.is<NotKnownLatest>()) | 161 | 0 | return nullptr; | 162 | 1.36k | return Link.get<KnownLatest>().getNotUpdated(); | 163 | 1.36k | } |
clang::Redeclarable<clang::VarDecl>::DeclLink::getLatestNotUpdated() const Line | Count | Source | 158 | 867 | Decl *getLatestNotUpdated() const { | 159 | 867 | assert(isFirst() && "expected a canonical decl"); | 160 | 867 | if (Link.is<NotKnownLatest>()) | 161 | 0 | return nullptr; | 162 | 867 | return Link.get<KnownLatest>().getNotUpdated(); | 163 | 867 | } |
|
164 | | }; |
165 | | |
166 | 3.13M | static DeclLink PreviousDeclLink(decl_type *D) { |
167 | 3.13M | return DeclLink(DeclLink::PreviousLink, D); |
168 | 3.13M | } clang::Redeclarable<clang::FunctionDecl>::PreviousDeclLink(clang::FunctionDecl*) Line | Count | Source | 166 | 445k | static DeclLink PreviousDeclLink(decl_type *D) { | 167 | 445k | return DeclLink(DeclLink::PreviousLink, D); | 168 | 445k | } |
clang::Redeclarable<clang::RedeclarableTemplateDecl>::PreviousDeclLink(clang::RedeclarableTemplateDecl*) Line | Count | Source | 166 | 262k | static DeclLink PreviousDeclLink(decl_type *D) { | 167 | 262k | return DeclLink(DeclLink::PreviousLink, D); | 168 | 262k | } |
clang::Redeclarable<clang::TagDecl>::PreviousDeclLink(clang::TagDecl*) Line | Count | Source | 166 | 1.81M | static DeclLink PreviousDeclLink(decl_type *D) { | 167 | 1.81M | return DeclLink(DeclLink::PreviousLink, D); | 168 | 1.81M | } |
clang::Redeclarable<clang::NamespaceDecl>::PreviousDeclLink(clang::NamespaceDecl*) Line | Count | Source | 166 | 292k | static DeclLink PreviousDeclLink(decl_type *D) { | 167 | 292k | return DeclLink(DeclLink::PreviousLink, D); | 168 | 292k | } |
clang::Redeclarable<clang::ObjCInterfaceDecl>::PreviousDeclLink(clang::ObjCInterfaceDecl*) Line | Count | Source | 166 | 215k | static DeclLink PreviousDeclLink(decl_type *D) { | 167 | 215k | return DeclLink(DeclLink::PreviousLink, D); | 168 | 215k | } |
clang::Redeclarable<clang::ObjCProtocolDecl>::PreviousDeclLink(clang::ObjCProtocolDecl*) Line | Count | Source | 166 | 6.70k | static DeclLink PreviousDeclLink(decl_type *D) { | 167 | 6.70k | return DeclLink(DeclLink::PreviousLink, D); | 168 | 6.70k | } |
clang::Redeclarable<clang::TypedefNameDecl>::PreviousDeclLink(clang::TypedefNameDecl*) Line | Count | Source | 166 | 24.3k | static DeclLink PreviousDeclLink(decl_type *D) { | 167 | 24.3k | return DeclLink(DeclLink::PreviousLink, D); | 168 | 24.3k | } |
clang::Redeclarable<clang::VarDecl>::PreviousDeclLink(clang::VarDecl*) Line | Count | Source | 166 | 69.9k | static DeclLink PreviousDeclLink(decl_type *D) { | 167 | 69.9k | return DeclLink(DeclLink::PreviousLink, D); | 168 | 69.9k | } |
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.27k | static DeclLink PreviousDeclLink(decl_type *D) { | 167 | 3.27k | return DeclLink(DeclLink::PreviousLink, D); | 168 | 3.27k | } |
|
169 | | |
170 | 83.0M | static DeclLink LatestDeclLink(const ASTContext &Ctx) { |
171 | 83.0M | return DeclLink(DeclLink::LatestLink, Ctx); |
172 | 83.0M | } clang::Redeclarable<clang::TypedefNameDecl>::LatestDeclLink(clang::ASTContext const&) Line | Count | Source | 170 | 4.00M | static DeclLink LatestDeclLink(const ASTContext &Ctx) { | 171 | 4.00M | return DeclLink(DeclLink::LatestLink, Ctx); | 172 | 4.00M | } |
clang::Redeclarable<clang::NamespaceAliasDecl>::LatestDeclLink(clang::ASTContext const&) Line | Count | Source | 170 | 345 | static DeclLink LatestDeclLink(const ASTContext &Ctx) { | 171 | 345 | return DeclLink(DeclLink::LatestLink, Ctx); | 172 | 345 | } |
clang::Redeclarable<clang::VarDecl>::LatestDeclLink(clang::ASTContext const&) Line | Count | Source | 170 | 51.5M | static DeclLink LatestDeclLink(const ASTContext &Ctx) { | 171 | 51.5M | return DeclLink(DeclLink::LatestLink, Ctx); | 172 | 51.5M | } |
clang::Redeclarable<clang::FunctionDecl>::LatestDeclLink(clang::ASTContext const&) Line | Count | Source | 170 | 17.6M | static DeclLink LatestDeclLink(const ASTContext &Ctx) { | 171 | 17.6M | return DeclLink(DeclLink::LatestLink, Ctx); | 172 | 17.6M | } |
clang::Redeclarable<clang::TagDecl>::LatestDeclLink(clang::ASTContext const&) Line | Count | Source | 170 | 7.24M | static DeclLink LatestDeclLink(const ASTContext &Ctx) { | 171 | 7.24M | return DeclLink(DeclLink::LatestLink, Ctx); | 172 | 7.24M | } |
clang::Redeclarable<clang::NamespaceDecl>::LatestDeclLink(clang::ASTContext const&) Line | Count | Source | 170 | 340k | static DeclLink LatestDeclLink(const ASTContext &Ctx) { | 171 | 340k | return DeclLink(DeclLink::LatestLink, Ctx); | 172 | 340k | } |
clang::Redeclarable<clang::UsingShadowDecl>::LatestDeclLink(clang::ASTContext const&) Line | Count | Source | 170 | 184k | static DeclLink LatestDeclLink(const ASTContext &Ctx) { | 171 | 184k | return DeclLink(DeclLink::LatestLink, Ctx); | 172 | 184k | } |
clang::Redeclarable<clang::ObjCInterfaceDecl>::LatestDeclLink(clang::ASTContext const&) Line | Count | Source | 170 | 349k | static DeclLink LatestDeclLink(const ASTContext &Ctx) { | 171 | 349k | return DeclLink(DeclLink::LatestLink, Ctx); | 172 | 349k | } |
clang::Redeclarable<clang::ObjCProtocolDecl>::LatestDeclLink(clang::ASTContext const&) Line | Count | Source | 170 | 31.4k | static DeclLink LatestDeclLink(const ASTContext &Ctx) { | 171 | 31.4k | return DeclLink(DeclLink::LatestLink, Ctx); | 172 | 31.4k | } |
clang::Redeclarable<clang::RedeclarableTemplateDecl>::LatestDeclLink(clang::ASTContext const&) Line | Count | Source | 170 | 1.71M | static DeclLink LatestDeclLink(const ASTContext &Ctx) { | 171 | 1.71M | return DeclLink(DeclLink::LatestLink, Ctx); | 172 | 1.71M | } |
|
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 | 537M | decl_type *getNextRedeclaration() const { |
190 | 537M | return RedeclLink.getPrevious(static_cast<const decl_type *>(this)); |
191 | 537M | } clang::Redeclarable<clang::VarDecl>::getNextRedeclaration() const Line | Count | Source | 189 | 124M | decl_type *getNextRedeclaration() const { | 190 | 124M | return RedeclLink.getPrevious(static_cast<const decl_type *>(this)); | 191 | 124M | } |
clang::Redeclarable<clang::FunctionDecl>::getNextRedeclaration() const Line | Count | Source | 189 | 63.8M | decl_type *getNextRedeclaration() const { | 190 | 63.8M | return RedeclLink.getPrevious(static_cast<const decl_type *>(this)); | 191 | 63.8M | } |
clang::Redeclarable<clang::TypedefNameDecl>::getNextRedeclaration() const Line | Count | Source | 189 | 1.67M | decl_type *getNextRedeclaration() const { | 190 | 1.67M | return RedeclLink.getPrevious(static_cast<const decl_type *>(this)); | 191 | 1.67M | } |
clang::Redeclarable<clang::TagDecl>::getNextRedeclaration() const Line | Count | Source | 189 | 320M | decl_type *getNextRedeclaration() const { | 190 | 320M | return RedeclLink.getPrevious(static_cast<const decl_type *>(this)); | 191 | 320M | } |
clang::Redeclarable<clang::UsingShadowDecl>::getNextRedeclaration() const Line | Count | Source | 189 | 584k | decl_type *getNextRedeclaration() const { | 190 | 584k | return RedeclLink.getPrevious(static_cast<const decl_type *>(this)); | 191 | 584k | } |
clang::Redeclarable<clang::ObjCProtocolDecl>::getNextRedeclaration() const Line | Count | Source | 189 | 195k | decl_type *getNextRedeclaration() const { | 190 | 195k | return RedeclLink.getPrevious(static_cast<const decl_type *>(this)); | 191 | 195k | } |
clang::Redeclarable<clang::ObjCInterfaceDecl>::getNextRedeclaration() const Line | Count | Source | 189 | 1.02M | decl_type *getNextRedeclaration() const { | 190 | 1.02M | return RedeclLink.getPrevious(static_cast<const decl_type *>(this)); | 191 | 1.02M | } |
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getNextRedeclaration() const Line | Count | Source | 189 | 18.8M | decl_type *getNextRedeclaration() const { | 190 | 18.8M | return RedeclLink.getPrevious(static_cast<const decl_type *>(this)); | 191 | 18.8M | } |
clang::Redeclarable<clang::NamespaceDecl>::getNextRedeclaration() const Line | Count | Source | 189 | 7.02M | decl_type *getNextRedeclaration() const { | 190 | 7.02M | return RedeclLink.getPrevious(static_cast<const decl_type *>(this)); | 191 | 7.02M | } |
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 | 83.0M | First(static_cast<decl_type *>(this)) {} clang::Redeclarable<clang::TypedefNameDecl>::Redeclarable(clang::ASTContext const&) Line | Count | Source | 199 | 4.00M | First(static_cast<decl_type *>(this)) {} |
clang::Redeclarable<clang::VarDecl>::Redeclarable(clang::ASTContext const&) Line | Count | Source | 199 | 51.5M | First(static_cast<decl_type *>(this)) {} |
clang::Redeclarable<clang::FunctionDecl>::Redeclarable(clang::ASTContext const&) Line | Count | Source | 199 | 17.6M | First(static_cast<decl_type *>(this)) {} |
clang::Redeclarable<clang::TagDecl>::Redeclarable(clang::ASTContext const&) Line | Count | Source | 199 | 7.24M | First(static_cast<decl_type *>(this)) {} |
clang::Redeclarable<clang::NamespaceAliasDecl>::Redeclarable(clang::ASTContext const&) Line | Count | Source | 199 | 345 | First(static_cast<decl_type *>(this)) {} |
clang::Redeclarable<clang::NamespaceDecl>::Redeclarable(clang::ASTContext const&) Line | Count | Source | 199 | 340k | First(static_cast<decl_type *>(this)) {} |
clang::Redeclarable<clang::UsingShadowDecl>::Redeclarable(clang::ASTContext const&) Line | Count | Source | 199 | 184k | First(static_cast<decl_type *>(this)) {} |
clang::Redeclarable<clang::ObjCInterfaceDecl>::Redeclarable(clang::ASTContext const&) Line | Count | Source | 199 | 349k | First(static_cast<decl_type *>(this)) {} |
clang::Redeclarable<clang::ObjCProtocolDecl>::Redeclarable(clang::ASTContext const&) Line | Count | Source | 199 | 31.4k | First(static_cast<decl_type *>(this)) {} |
clang::Redeclarable<clang::RedeclarableTemplateDecl>::Redeclarable(clang::ASTContext const&) Line | Count | Source | 199 | 1.71M | 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 | 20.2M | decl_type *getPreviousDecl() { |
204 | 20.2M | if (!RedeclLink.isFirst()) |
205 | 3.43M | return getNextRedeclaration(); |
206 | 16.8M | return nullptr; |
207 | 16.8M | } clang::Redeclarable<clang::VarDecl>::getPreviousDecl() Line | Count | Source | 203 | 2.54M | decl_type *getPreviousDecl() { | 204 | 2.54M | if (!RedeclLink.isFirst()) | 205 | 22.9k | return getNextRedeclaration(); | 206 | 2.52M | return nullptr; | 207 | 2.52M | } |
clang::Redeclarable<clang::FunctionDecl>::getPreviousDecl() Line | Count | Source | 203 | 6.79M | decl_type *getPreviousDecl() { | 204 | 6.79M | if (!RedeclLink.isFirst()) | 205 | 226k | return getNextRedeclaration(); | 206 | 6.56M | return nullptr; | 207 | 6.56M | } |
clang::Redeclarable<clang::TypedefNameDecl>::getPreviousDecl() Line | Count | Source | 203 | 692k | decl_type *getPreviousDecl() { | 204 | 692k | if (!RedeclLink.isFirst()) | 205 | 13.3k | return getNextRedeclaration(); | 206 | 678k | return nullptr; | 207 | 678k | } |
clang::Redeclarable<clang::TagDecl>::getPreviousDecl() Line | Count | Source | 203 | 7.88M | decl_type *getPreviousDecl() { | 204 | 7.88M | if (!RedeclLink.isFirst()) | 205 | 2.68M | return getNextRedeclaration(); | 206 | 5.19M | return nullptr; | 207 | 5.19M | } |
clang::Redeclarable<clang::UsingShadowDecl>::getPreviousDecl() Line | Count | Source | 203 | 890 | decl_type *getPreviousDecl() { | 204 | 890 | if (!RedeclLink.isFirst()) | 205 | 528 | return getNextRedeclaration(); | 206 | 362 | return nullptr; | 207 | 362 | } |
clang::Redeclarable<clang::NamespaceDecl>::getPreviousDecl() Line | Count | Source | 203 | 61.8k | decl_type *getPreviousDecl() { | 204 | 61.8k | if (!RedeclLink.isFirst()) | 205 | 31.6k | return getNextRedeclaration(); | 206 | 30.2k | return nullptr; | 207 | 30.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 | } |
clang::Redeclarable<clang::ObjCInterfaceDecl>::getPreviousDecl() Line | Count | Source | 203 | 125k | decl_type *getPreviousDecl() { | 204 | 125k | if (!RedeclLink.isFirst()) | 205 | 90.3k | return getNextRedeclaration(); | 206 | 34.7k | return nullptr; | 207 | 34.7k | } |
clang::Redeclarable<clang::ObjCProtocolDecl>::getPreviousDecl() Line | Count | Source | 203 | 4.91k | decl_type *getPreviousDecl() { | 204 | 4.91k | if (!RedeclLink.isFirst()) | 205 | 1.78k | return getNextRedeclaration(); | 206 | 3.13k | return nullptr; | 207 | 3.13k | } |
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getPreviousDecl() Line | Count | Source | 203 | 2.18M | decl_type *getPreviousDecl() { | 204 | 2.18M | if (!RedeclLink.isFirst()) | 205 | 353k | return getNextRedeclaration(); | 206 | 1.83M | return nullptr; | 207 | 1.83M | } |
|
208 | 4.71M | const decl_type *getPreviousDecl() const { |
209 | 4.71M | return const_cast<decl_type *>( |
210 | 4.71M | static_cast<const decl_type*>(this))->getPreviousDecl(); |
211 | 4.71M | } clang::Redeclarable<clang::VarDecl>::getPreviousDecl() const Line | Count | Source | 208 | 1.52M | const decl_type *getPreviousDecl() const { | 209 | 1.52M | return const_cast<decl_type *>( | 210 | 1.52M | static_cast<const decl_type*>(this))->getPreviousDecl(); | 211 | 1.52M | } |
clang::Redeclarable<clang::FunctionDecl>::getPreviousDecl() const Line | Count | Source | 208 | 2.14M | const decl_type *getPreviousDecl() const { | 209 | 2.14M | return const_cast<decl_type *>( | 210 | 2.14M | static_cast<const decl_type*>(this))->getPreviousDecl(); | 211 | 2.14M | } |
clang::Redeclarable<clang::ObjCInterfaceDecl>::getPreviousDecl() const Line | Count | Source | 208 | 43.0k | const decl_type *getPreviousDecl() const { | 209 | 43.0k | return const_cast<decl_type *>( | 210 | 43.0k | static_cast<const decl_type*>(this))->getPreviousDecl(); | 211 | 43.0k | } |
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getPreviousDecl() const Line | Count | Source | 208 | 997k | const decl_type *getPreviousDecl() const { | 209 | 997k | return const_cast<decl_type *>( | 210 | 997k | static_cast<const decl_type*>(this))->getPreviousDecl(); | 211 | 997k | } |
clang::Redeclarable<clang::NamespaceDecl>::getPreviousDecl() const Line | Count | Source | 208 | 158 | const decl_type *getPreviousDecl() const { | 209 | 158 | return const_cast<decl_type *>( | 210 | 158 | static_cast<const decl_type*>(this))->getPreviousDecl(); | 211 | 158 | } |
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 | 26 | const decl_type *getPreviousDecl() const { | 209 | 26 | return const_cast<decl_type *>( | 210 | 26 | static_cast<const decl_type*>(this))->getPreviousDecl(); | 211 | 26 | } |
clang::Redeclarable<clang::TagDecl>::getPreviousDecl() const Line | Count | Source | 208 | 3.70k | const decl_type *getPreviousDecl() const { | 209 | 3.70k | return const_cast<decl_type *>( | 210 | 3.70k | static_cast<const decl_type*>(this))->getPreviousDecl(); | 211 | 3.70k | } |
clang::Redeclarable<clang::TypedefNameDecl>::getPreviousDecl() const Line | Count | Source | 208 | 2.78k | const decl_type *getPreviousDecl() const { | 209 | 2.78k | return const_cast<decl_type *>( | 210 | 2.78k | static_cast<const decl_type*>(this))->getPreviousDecl(); | 211 | 2.78k | } |
clang::Redeclarable<clang::UsingShadowDecl>::getPreviousDecl() const Line | Count | Source | 208 | 47 | const decl_type *getPreviousDecl() const { | 209 | 47 | return const_cast<decl_type *>( | 210 | 47 | static_cast<const decl_type*>(this))->getPreviousDecl(); | 211 | 47 | } |
|
212 | | |
213 | | /// Return the first declaration of this declaration or itself if this |
214 | | /// is the only declaration. |
215 | 1.08G | decl_type *getFirstDecl() { return First; } clang::Redeclarable<clang::VarDecl>::getFirstDecl() Line | Count | Source | 215 | 220M | decl_type *getFirstDecl() { return First; } |
clang::Redeclarable<clang::FunctionDecl>::getFirstDecl() Line | Count | Source | 215 | 427M | decl_type *getFirstDecl() { return First; } |
clang::Redeclarable<clang::TypedefNameDecl>::getFirstDecl() Line | Count | Source | 215 | 20.1M | decl_type *getFirstDecl() { return First; } |
clang::Redeclarable<clang::TagDecl>::getFirstDecl() Line | Count | Source | 215 | 320M | 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::RedeclarableTemplateDecl>::getFirstDecl() Line | Count | Source | 215 | 89.1M | decl_type *getFirstDecl() { return First; } |
clang::Redeclarable<clang::NamespaceDecl>::getFirstDecl() Line | Count | Source | 215 | 6.19M | decl_type *getFirstDecl() { return First; } |
clang::Redeclarable<clang::ObjCInterfaceDecl>::getFirstDecl() Line | Count | Source | 215 | 3.07M | decl_type *getFirstDecl() { return First; } |
clang::Redeclarable<clang::ObjCProtocolDecl>::getFirstDecl() Line | Count | Source | 215 | 268k | decl_type *getFirstDecl() { return First; } |
|
216 | | |
217 | | /// Return the first declaration of this declaration or itself if this |
218 | | /// is the only declaration. |
219 | 44.7M | const decl_type *getFirstDecl() const { return First; } clang::Redeclarable<clang::TypedefNameDecl>::getFirstDecl() const Line | Count | Source | 219 | 155 | 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 | 1.93k | const decl_type *getFirstDecl() const { return First; } |
clang::Redeclarable<clang::ObjCInterfaceDecl>::getFirstDecl() const Line | Count | Source | 219 | 66.9k | const decl_type *getFirstDecl() const { return First; } |
clang::Redeclarable<clang::VarDecl>::getFirstDecl() const Line | Count | Source | 219 | 18.1M | const decl_type *getFirstDecl() const { return First; } |
clang::Redeclarable<clang::FunctionDecl>::getFirstDecl() const Line | Count | Source | 219 | 21.0M | const decl_type *getFirstDecl() const { return First; } |
clang::Redeclarable<clang::TagDecl>::getFirstDecl() const Line | Count | Source | 219 | 269k | const decl_type *getFirstDecl() const { return First; } |
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getFirstDecl() const Line | Count | Source | 219 | 5.24M | const decl_type *getFirstDecl() const { return First; } |
|
220 | | |
221 | | /// True if this is the first declaration in its redeclaration chain. |
222 | 410M | bool isFirstDecl() const { return RedeclLink.isFirst(); } clang::Redeclarable<clang::TagDecl>::isFirstDecl() const Line | Count | Source | 222 | 41.0M | bool isFirstDecl() const { return RedeclLink.isFirst(); } |
clang::Redeclarable<clang::VarDecl>::isFirstDecl() const Line | Count | Source | 222 | 30.2M | bool isFirstDecl() const { return RedeclLink.isFirst(); } |
clang::Redeclarable<clang::FunctionDecl>::isFirstDecl() const Line | Count | Source | 222 | 30.7M | bool isFirstDecl() const { return RedeclLink.isFirst(); } |
clang::Redeclarable<clang::NamespaceDecl>::isFirstDecl() const Line | Count | Source | 222 | 307M | bool isFirstDecl() const { return RedeclLink.isFirst(); } |
clang::Redeclarable<clang::ObjCInterfaceDecl>::isFirstDecl() const Line | Count | Source | 222 | 194k | bool isFirstDecl() const { return RedeclLink.isFirst(); } |
clang::Redeclarable<clang::ObjCProtocolDecl>::isFirstDecl() const Line | Count | Source | 222 | 30.7k | bool isFirstDecl() const { return RedeclLink.isFirst(); } |
clang::Redeclarable<clang::TypedefNameDecl>::isFirstDecl() const Line | Count | Source | 222 | 239k | 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 | 11.1k | bool isFirstDecl() const { return RedeclLink.isFirst(); } |
clang::Redeclarable<clang::RedeclarableTemplateDecl>::isFirstDecl() const Line | Count | Source | 222 | 633k | bool isFirstDecl() const { return RedeclLink.isFirst(); } |
|
223 | | |
224 | | /// Returns the most recent (re)declaration of this declaration. |
225 | 418M | decl_type *getMostRecentDecl() { |
226 | 418M | return getFirstDecl()->getNextRedeclaration(); |
227 | 418M | } clang::Redeclarable<clang::VarDecl>::getMostRecentDecl() Line | Count | Source | 225 | 80.2M | decl_type *getMostRecentDecl() { | 226 | 80.2M | return getFirstDecl()->getNextRedeclaration(); | 227 | 80.2M | } |
clang::Redeclarable<clang::FunctionDecl>::getMostRecentDecl() Line | Count | Source | 225 | 41.7M | decl_type *getMostRecentDecl() { | 226 | 41.7M | return getFirstDecl()->getNextRedeclaration(); | 227 | 41.7M | } |
clang::Redeclarable<clang::TypedefNameDecl>::getMostRecentDecl() Line | Count | Source | 225 | 1.35M | decl_type *getMostRecentDecl() { | 226 | 1.35M | return getFirstDecl()->getNextRedeclaration(); | 227 | 1.35M | } |
clang::Redeclarable<clang::TagDecl>::getMostRecentDecl() Line | Count | Source | 225 | 276M | decl_type *getMostRecentDecl() { | 226 | 276M | return getFirstDecl()->getNextRedeclaration(); | 227 | 276M | } |
clang::Redeclarable<clang::UsingShadowDecl>::getMostRecentDecl() Line | Count | Source | 225 | 398k | decl_type *getMostRecentDecl() { | 226 | 398k | return getFirstDecl()->getNextRedeclaration(); | 227 | 398k | } |
clang::Redeclarable<clang::NamespaceDecl>::getMostRecentDecl() Line | Count | Source | 225 | 5.90M | decl_type *getMostRecentDecl() { | 226 | 5.90M | return getFirstDecl()->getNextRedeclaration(); | 227 | 5.90M | } |
clang::Redeclarable<clang::NamespaceAliasDecl>::getMostRecentDecl() Line | Count | Source | 225 | 115 | decl_type *getMostRecentDecl() { | 226 | 115 | return getFirstDecl()->getNextRedeclaration(); | 227 | 115 | } |
clang::Redeclarable<clang::ObjCInterfaceDecl>::getMostRecentDecl() Line | Count | Source | 225 | 433k | decl_type *getMostRecentDecl() { | 226 | 433k | return getFirstDecl()->getNextRedeclaration(); | 227 | 433k | } |
clang::Redeclarable<clang::ObjCProtocolDecl>::getMostRecentDecl() Line | Count | Source | 225 | 155k | decl_type *getMostRecentDecl() { | 226 | 155k | return getFirstDecl()->getNextRedeclaration(); | 227 | 155k | } |
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getMostRecentDecl() Line | Count | Source | 225 | 12.0M | decl_type *getMostRecentDecl() { | 226 | 12.0M | return getFirstDecl()->getNextRedeclaration(); | 227 | 12.0M | } |
|
228 | | |
229 | | /// Returns the most recent (re)declaration of this declaration. |
230 | 6.00M | const decl_type *getMostRecentDecl() const { |
231 | 6.00M | return getFirstDecl()->getNextRedeclaration(); |
232 | 6.00M | } clang::Redeclarable<clang::ObjCProtocolDecl>::getMostRecentDecl() const Line | Count | Source | 230 | 1.12k | const decl_type *getMostRecentDecl() const { | 231 | 1.12k | return getFirstDecl()->getNextRedeclaration(); | 232 | 1.12k | } |
clang::Redeclarable<clang::ObjCInterfaceDecl>::getMostRecentDecl() const Line | Count | Source | 230 | 66.9k | const decl_type *getMostRecentDecl() const { | 231 | 66.9k | return getFirstDecl()->getNextRedeclaration(); | 232 | 66.9k | } |
clang::Redeclarable<clang::FunctionDecl>::getMostRecentDecl() const Line | Count | Source | 230 | 743k | const decl_type *getMostRecentDecl() const { | 231 | 743k | return getFirstDecl()->getNextRedeclaration(); | 232 | 743k | } |
clang::Redeclarable<clang::RedeclarableTemplateDecl>::getMostRecentDecl() const Line | Count | Source | 230 | 5.18M | const decl_type *getMostRecentDecl() const { | 231 | 5.18M | return getFirstDecl()->getNextRedeclaration(); | 232 | 5.18M | } |
clang::Redeclarable<clang::VarDecl>::getMostRecentDecl() const Line | Count | Source | 230 | 1.13k | const decl_type *getMostRecentDecl() const { | 231 | 1.13k | return getFirstDecl()->getNextRedeclaration(); | 232 | 1.13k | } |
clang::Redeclarable<clang::TagDecl>::getMostRecentDecl() const Line | Count | Source | 230 | 165 | const decl_type *getMostRecentDecl() const { | 231 | 165 | return getFirstDecl()->getNextRedeclaration(); | 232 | 165 | } |
|
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 | 272M | redecl_iterator() = default; clang::Redeclarable<clang::VarDecl>::redecl_iterator::redecl_iterator() Line | Count | Source | 252 | 47.7M | redecl_iterator() = default; |
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::redecl_iterator() Line | Count | Source | 252 | 31.2M | redecl_iterator() = default; |
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::redecl_iterator() Line | Count | Source | 252 | 92.7k | redecl_iterator() = default; |
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::redecl_iterator() Line | Count | Source | 252 | 22.2k | redecl_iterator() = default; |
clang::Redeclarable<clang::TagDecl>::redecl_iterator::redecl_iterator() Line | Count | Source | 252 | 193M | redecl_iterator() = default; |
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::redecl_iterator() Line | Count | Source | 252 | 907 | redecl_iterator() = default; |
|
253 | 272M | explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {} clang::Redeclarable<clang::VarDecl>::redecl_iterator::redecl_iterator(clang::VarDecl*) Line | Count | Source | 253 | 47.7M | explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {} |
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::redecl_iterator(clang::FunctionDecl*) Line | Count | Source | 253 | 31.2M | explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {} |
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::redecl_iterator(clang::ObjCInterfaceDecl*) Line | Count | Source | 253 | 92.7k | explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {} |
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::redecl_iterator(clang::ObjCProtocolDecl*) Line | Count | Source | 253 | 22.2k | explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {} |
clang::Redeclarable<clang::TagDecl>::redecl_iterator::redecl_iterator(clang::TagDecl*) Line | Count | Source | 253 | 193M | explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {} |
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::redecl_iterator(clang::UsingShadowDecl*) Line | Count | Source | 253 | 907 | explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {} |
|
254 | | |
255 | 292M | reference operator*() const { return Current; } clang::Redeclarable<clang::VarDecl>::redecl_iterator::operator*() const Line | Count | Source | 255 | 54.4M | reference operator*() const { return Current; } |
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::operator*() const Line | Count | Source | 255 | 32.5M | reference operator*() const { return Current; } |
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::operator*() const Line | Count | Source | 255 | 137k | reference operator*() const { return Current; } |
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::operator*() const Line | Count | Source | 255 | 28.4k | reference operator*() const { return Current; } |
clang::Redeclarable<clang::TagDecl>::redecl_iterator::operator*() const Line | Count | Source | 255 | 205M | reference operator*() const { return Current; } |
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::operator*() const Line | Count | Source | 255 | 915 | reference operator*() const { return Current; } |
|
256 | | pointer operator->() const { return Current; } |
257 | | |
258 | 80.6M | redecl_iterator& operator++() { |
259 | 80.6M | assert(Current && "Advancing while iterator has reached end"); |
260 | | // Sanity check to avoid infinite loop on invalid redecl chain. |
261 | 80.6M | if (Current->isFirstDecl()) { |
262 | 72.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 | 72.9M | PassedFirst = true; |
268 | 72.9M | } |
269 | | |
270 | | // Get either previous decl or latest decl. |
271 | 80.6M | decl_type *Next = Current->getNextRedeclaration(); |
272 | 61.3M | Current = (Next != Starter) ? Next19.2M : nullptr; |
273 | 80.6M | return *this; |
274 | 80.6M | } clang::Redeclarable<clang::VarDecl>::redecl_iterator::operator++() Line | Count | Source | 258 | 27.4M | redecl_iterator& operator++() { | 259 | 27.4M | assert(Current && "Advancing while iterator has reached end"); | 260 | | // Sanity check to avoid infinite loop on invalid redecl chain. | 261 | 27.4M | if (Current->isFirstDecl()) { | 262 | 23.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 | 23.9M | PassedFirst = true; | 268 | 23.9M | } | 269 | | | 270 | | // Get either previous decl or latest decl. | 271 | 27.4M | decl_type *Next = Current->getNextRedeclaration(); | 272 | 20.7M | Current = (Next != Starter) ? Next6.66M : nullptr; | 273 | 27.4M | return *this; | 274 | 27.4M | } |
clang::Redeclarable<clang::FunctionDecl>::redecl_iterator::operator++() Line | Count | Source | 258 | 16.1M | redecl_iterator& operator++() { | 259 | 16.1M | assert(Current && "Advancing while iterator has reached end"); | 260 | | // Sanity check to avoid infinite loop on invalid redecl chain. | 261 | 16.1M | if (Current->isFirstDecl()) { | 262 | 15.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 | 15.4M | PassedFirst = true; | 268 | 15.4M | } | 269 | | | 270 | | // Get either previous decl or latest decl. | 271 | 16.1M | decl_type *Next = Current->getNextRedeclaration(); | 272 | 14.8M | Current = (Next != Starter) ? Next1.29M : nullptr; | 273 | 16.1M | return *this; | 274 | 16.1M | } |
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator::operator++() Line | Count | Source | 258 | 137k | redecl_iterator& operator++() { | 259 | 137k | assert(Current && "Advancing while iterator has reached end"); | 260 | | // Sanity check to avoid infinite loop on invalid redecl chain. | 261 | 137k | if (Current->isFirstDecl()) { | 262 | 92.7k | if (PassedFirst) { | 263 | 0 | assert(0 && "Passed first decl twice, invalid redecl chain!"); | 264 | 0 | Current = nullptr; | 265 | 0 | return *this; | 266 | 0 | } | 267 | 92.7k | PassedFirst = true; | 268 | 92.7k | } | 269 | | | 270 | | // Get either previous decl or latest decl. | 271 | 137k | decl_type *Next = Current->getNextRedeclaration(); | 272 | 92.7k | Current = (Next != Starter) ? Next44.3k : nullptr; | 273 | 137k | return *this; | 274 | 137k | } |
clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator::operator++() Line | Count | Source | 258 | 28.4k | redecl_iterator& operator++() { | 259 | 28.4k | assert(Current && "Advancing while iterator has reached end"); | 260 | | // Sanity check to avoid infinite loop on invalid redecl chain. | 261 | 28.4k | if (Current->isFirstDecl()) { | 262 | 22.2k | if (PassedFirst) { | 263 | 0 | assert(0 && "Passed first decl twice, invalid redecl chain!"); | 264 | 0 | Current = nullptr; | 265 | 0 | return *this; | 266 | 0 | } | 267 | 22.2k | PassedFirst = true; | 268 | 22.2k | } | 269 | | | 270 | | // Get either previous decl or latest decl. | 271 | 28.4k | decl_type *Next = Current->getNextRedeclaration(); | 272 | 22.2k | Current = (Next != Starter) ? Next6.13k : nullptr; | 273 | 28.4k | return *this; | 274 | 28.4k | } |
clang::Redeclarable<clang::TagDecl>::redecl_iterator::operator++() Line | Count | Source | 258 | 36.9M | redecl_iterator& operator++() { | 259 | 36.9M | assert(Current && "Advancing while iterator has reached end"); | 260 | | // Sanity check to avoid infinite loop on invalid redecl chain. | 261 | 36.9M | if (Current->isFirstDecl()) { | 262 | 33.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 | 33.4M | PassedFirst = true; | 268 | 33.4M | } | 269 | | | 270 | | // Get either previous decl or latest decl. | 271 | 36.9M | decl_type *Next = Current->getNextRedeclaration(); | 272 | 25.6M | Current = (Next != Starter) ? Next11.2M : nullptr; | 273 | 36.9M | return *this; | 274 | 36.9M | } |
clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator::operator++() Line | Count | Source | 258 | 915 | redecl_iterator& operator++() { | 259 | 915 | assert(Current && "Advancing while iterator has reached end"); | 260 | | // Sanity check to avoid infinite loop on invalid redecl chain. | 261 | 915 | if (Current->isFirstDecl()) { | 262 | 907 | if (PassedFirst) { | 263 | 0 | assert(0 && "Passed first decl twice, invalid redecl chain!"); | 264 | 0 | Current = nullptr; | 265 | 0 | return *this; | 266 | 0 | } | 267 | 907 | PassedFirst = true; | 268 | 907 | } | 269 | | | 270 | | // Get either previous decl or latest decl. | 271 | 915 | decl_type *Next = Current->getNextRedeclaration(); | 272 | 907 | Current = (Next != Starter) ? Next8 : nullptr; | 273 | 915 | return *this; | 274 | 915 | } |
|
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 | 353M | friend bool operator!=(redecl_iterator x, redecl_iterator y) { |
286 | 353M | return x.Current != y.Current; |
287 | 353M | } clang::operator!=(clang::Redeclarable<clang::VarDecl>::redecl_iterator, clang::Redeclarable<clang::VarDecl>::redecl_iterator) Line | Count | Source | 285 | 75.1M | friend bool operator!=(redecl_iterator x, redecl_iterator y) { | 286 | 75.1M | return x.Current != y.Current; | 287 | 75.1M | } |
clang::operator!=(clang::Redeclarable<clang::FunctionDecl>::redecl_iterator, clang::Redeclarable<clang::FunctionDecl>::redecl_iterator) Line | Count | Source | 285 | 47.4M | friend bool operator!=(redecl_iterator x, redecl_iterator y) { | 286 | 47.4M | return x.Current != y.Current; | 287 | 47.4M | } |
clang::operator!=(clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator, clang::Redeclarable<clang::ObjCInterfaceDecl>::redecl_iterator) Line | Count | Source | 285 | 229k | friend bool operator!=(redecl_iterator x, redecl_iterator y) { | 286 | 229k | return x.Current != y.Current; | 287 | 229k | } |
clang::operator!=(clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator, clang::Redeclarable<clang::ObjCProtocolDecl>::redecl_iterator) Line | Count | Source | 285 | 50.6k | friend bool operator!=(redecl_iterator x, redecl_iterator y) { | 286 | 50.6k | return x.Current != y.Current; | 287 | 50.6k | } |
clang::operator!=(clang::Redeclarable<clang::TagDecl>::redecl_iterator, clang::Redeclarable<clang::TagDecl>::redecl_iterator) Line | Count | Source | 285 | 230M | friend bool operator!=(redecl_iterator x, redecl_iterator y) { | 286 | 230M | return x.Current != y.Current; | 287 | 230M | } |
clang::operator!=(clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator, clang::Redeclarable<clang::UsingShadowDecl>::redecl_iterator) Line | Count | Source | 285 | 1.82k | friend bool operator!=(redecl_iterator x, redecl_iterator y) { | 286 | 1.82k | return x.Current != y.Current; | 287 | 1.82k | } |
|
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 | 272M | redecl_range redecls() const { |
295 | 272M | return redecl_range(redecl_iterator(const_cast<decl_type *>( |
296 | 272M | static_cast<const decl_type *>(this))), |
297 | 272M | redecl_iterator()); |
298 | 272M | } clang::Redeclarable<clang::VarDecl>::redecls() const Line | Count | Source | 294 | 47.7M | redecl_range redecls() const { | 295 | 47.7M | return redecl_range(redecl_iterator(const_cast<decl_type *>( | 296 | 47.7M | static_cast<const decl_type *>(this))), | 297 | 47.7M | redecl_iterator()); | 298 | 47.7M | } |
clang::Redeclarable<clang::FunctionDecl>::redecls() const Line | Count | Source | 294 | 31.2M | redecl_range redecls() const { | 295 | 31.2M | return redecl_range(redecl_iterator(const_cast<decl_type *>( | 296 | 31.2M | static_cast<const decl_type *>(this))), | 297 | 31.2M | redecl_iterator()); | 298 | 31.2M | } |
clang::Redeclarable<clang::ObjCInterfaceDecl>::redecls() const Line | Count | Source | 294 | 92.7k | redecl_range redecls() const { | 295 | 92.7k | return redecl_range(redecl_iterator(const_cast<decl_type *>( | 296 | 92.7k | static_cast<const decl_type *>(this))), | 297 | 92.7k | redecl_iterator()); | 298 | 92.7k | } |
clang::Redeclarable<clang::ObjCProtocolDecl>::redecls() const Line | Count | Source | 294 | 22.2k | redecl_range redecls() const { | 295 | 22.2k | return redecl_range(redecl_iterator(const_cast<decl_type *>( | 296 | 22.2k | static_cast<const decl_type *>(this))), | 297 | 22.2k | redecl_iterator()); | 298 | 22.2k | } |
clang::Redeclarable<clang::TagDecl>::redecls() const Line | Count | Source | 294 | 193M | redecl_range redecls() const { | 295 | 193M | return redecl_range(redecl_iterator(const_cast<decl_type *>( | 296 | 193M | static_cast<const decl_type *>(this))), | 297 | 193M | redecl_iterator()); | 298 | 193M | } |
clang::Redeclarable<clang::UsingShadowDecl>::redecls() const Line | Count | Source | 294 | 907 | redecl_range redecls() const { | 295 | 907 | return redecl_range(redecl_iterator(const_cast<decl_type *>( | 296 | 907 | static_cast<const decl_type *>(this))), | 297 | 907 | redecl_iterator()); | 298 | 907 | } |
|
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 | 10.7M | decl_type *getFirstDecl() { |
319 | 10.7M | auto *D = static_cast<decl_type *>(this); |
320 | 10.7M | if (!D->isFromASTFile()) |
321 | 10.0M | return D; |
322 | 643k | return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D))); |
323 | 643k | } clang::Mergeable<clang::FieldDecl>::getFirstDecl() Line | Count | Source | 318 | 9.54M | decl_type *getFirstDecl() { | 319 | 9.54M | auto *D = static_cast<decl_type *>(this); | 320 | 9.54M | if (!D->isFromASTFile()) | 321 | 8.97M | return D; | 322 | 572k | return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D))); | 323 | 572k | } |
clang::Mergeable<clang::EnumConstantDecl>::getFirstDecl() Line | Count | Source | 318 | 865k | decl_type *getFirstDecl() { | 319 | 865k | auto *D = static_cast<decl_type *>(this); | 320 | 865k | if (!D->isFromASTFile()) | 321 | 832k | return D; | 322 | 33.0k | return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D))); | 323 | 33.0k | } |
clang::Mergeable<clang::IndirectFieldDecl>::getFirstDecl() Line | Count | Source | 318 | 15.5k | decl_type *getFirstDecl() { | 319 | 15.5k | auto *D = static_cast<decl_type *>(this); | 320 | 15.5k | if (!D->isFromASTFile()) | 321 | 8.18k | return D; | 322 | 7.32k | return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D))); | 323 | 7.32k | } |
clang::Mergeable<clang::UsingDecl>::getFirstDecl() Line | Count | Source | 318 | 297k | decl_type *getFirstDecl() { | 319 | 297k | auto *D = static_cast<decl_type *>(this); | 320 | 297k | if (!D->isFromASTFile()) | 321 | 270k | return D; | 322 | 27.7k | return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D))); | 323 | 27.7k | } |
clang::Mergeable<clang::UsingPackDecl>::getFirstDecl() Line | Count | Source | 318 | 6 | decl_type *getFirstDecl() { | 319 | 6 | auto *D = static_cast<decl_type *>(this); | 320 | 6 | if (!D->isFromASTFile()) | 321 | 4 | return D; | 322 | 2 | return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D))); | 323 | 2 | } |
clang::Mergeable<clang::UnresolvedUsingValueDecl>::getFirstDecl() Line | Count | Source | 318 | 1.48k | decl_type *getFirstDecl() { | 319 | 1.48k | auto *D = static_cast<decl_type *>(this); | 320 | 1.48k | if (!D->isFromASTFile()) | 321 | 1.35k | return D; | 322 | 134 | return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D))); | 323 | 134 | } |
clang::Mergeable<clang::UnresolvedUsingTypenameDecl>::getFirstDecl() Line | Count | Source | 318 | 3.29k | decl_type *getFirstDecl() { | 319 | 3.29k | auto *D = static_cast<decl_type *>(this); | 320 | 3.29k | if (!D->isFromASTFile()) | 321 | 906 | return D; | 322 | 2.38k | return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D))); | 323 | 2.38k | } |
clang::Mergeable<clang::ConceptDecl>::getFirstDecl() Line | Count | Source | 318 | 1.89k | decl_type *getFirstDecl() { | 319 | 1.89k | auto *D = static_cast<decl_type *>(this); | 320 | 1.89k | if (!D->isFromASTFile()) | 321 | 1.81k | return D; | 322 | 72 | return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D))); | 323 | 72 | } |
clang::Mergeable<clang::TemplateParamObjectDecl>::getFirstDecl() Line | Count | Source | 318 | 860 | decl_type *getFirstDecl() { | 319 | 860 | auto *D = static_cast<decl_type *>(this); | 320 | 860 | if (!D->isFromASTFile()) | 321 | 840 | return D; | 322 | 20 | return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D))); | 323 | 20 | } |
|
324 | | |
325 | | /// Return the first declaration of this declaration or itself if this |
326 | | /// is the only declaration. |
327 | 1.26M | const decl_type *getFirstDecl() const { |
328 | 1.26M | const auto *D = static_cast<const decl_type *>(this); |
329 | 1.26M | if (!D->isFromASTFile()) |
330 | 1.20M | return D; |
331 | 52.9k | return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D))); |
332 | 52.9k | } clang::Mergeable<clang::FieldDecl>::getFirstDecl() const Line | Count | Source | 327 | 1.26M | const decl_type *getFirstDecl() const { | 328 | 1.26M | const auto *D = static_cast<const decl_type *>(this); | 329 | 1.26M | if (!D->isFromASTFile()) | 330 | 1.20M | return D; | 331 | 52.9k | return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D))); | 332 | 52.9k | } |
clang::Mergeable<clang::EnumConstantDecl>::getFirstDecl() const Line | Count | Source | 327 | 86 | const decl_type *getFirstDecl() const { | 328 | 86 | const auto *D = static_cast<const decl_type *>(this); | 329 | 86 | if (!D->isFromASTFile()) | 330 | 80 | return D; | 331 | 6 | return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D))); | 332 | 6 | } |
clang::Mergeable<clang::IndirectFieldDecl>::getFirstDecl() const Line | Count | Source | 327 | 62 | const decl_type *getFirstDecl() const { | 328 | 62 | const auto *D = static_cast<const decl_type *>(this); | 329 | 62 | if (!D->isFromASTFile()) | 330 | 41 | return D; | 331 | 21 | return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D))); | 332 | 21 | } |
clang::Mergeable<clang::UsingDecl>::getFirstDecl() const Line | Count | Source | 327 | 31 | const decl_type *getFirstDecl() const { | 328 | 31 | const auto *D = static_cast<const decl_type *>(this); | 329 | 31 | if (!D->isFromASTFile()) | 330 | 26 | return D; | 331 | 5 | return cast<decl_type>(getPrimaryMergedDecl(const_cast<decl_type*>(D))); | 332 | 5 | } |
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 Unexecuted instantiation: clang::Mergeable<clang::MSGuidDecl>::getFirstDecl() const Unexecuted instantiation: clang::Mergeable<clang::TemplateParamObjectDecl>::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.67M | CanonicalDeclPtr() = default; clang::CanonicalDeclPtr<clang::FunctionDecl>::CanonicalDeclPtr() Line | Count | Source | 349 | 366k | CanonicalDeclPtr() = default; |
clang::CanonicalDeclPtr<clang::Decl const>::CanonicalDeclPtr() Line | Count | Source | 349 | 279k | CanonicalDeclPtr() = default; |
clang::CanonicalDeclPtr<clang::Decl>::CanonicalDeclPtr() Line | Count | Source | 349 | 804k | CanonicalDeclPtr() = default; |
Unexecuted instantiation: clang::CanonicalDeclPtr<clang::VarDecl>::CanonicalDeclPtr() clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::CanonicalDeclPtr() Line | Count | Source | 349 | 131k | CanonicalDeclPtr() = default; |
clang::CanonicalDeclPtr<clang::VarDecl const>::CanonicalDeclPtr() Line | Count | Source | 349 | 90.0k | CanonicalDeclPtr() = default; |
|
350 | | CanonicalDeclPtr(decl_type *Ptr) |
351 | 11.1M | : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {} clang::CanonicalDeclPtr<clang::Decl>::CanonicalDeclPtr(clang::Decl*) Line | Count | Source | 351 | 1.10M | : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {} |
clang::CanonicalDeclPtr<clang::FunctionDecl>::CanonicalDeclPtr(clang::FunctionDecl*) Line | Count | Source | 351 | 7.39M | : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {} |
clang::CanonicalDeclPtr<clang::Decl const>::CanonicalDeclPtr(clang::Decl const*) Line | Count | Source | 351 | 2.51M | : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {} |
clang::CanonicalDeclPtr<clang::VarDecl>::CanonicalDeclPtr(clang::VarDecl*) Line | Count | Source | 351 | 97.0k | : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {} |
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::CanonicalDeclPtr(clang::CXXRecordDecl const*) Line | Count | Source | 351 | 23.3k | : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {} |
clang::CanonicalDeclPtr<clang::VarDecl const>::CanonicalDeclPtr(clang::VarDecl const*) Line | Count | Source | 351 | 24.0k | : Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {} |
|
352 | | CanonicalDeclPtr(const CanonicalDeclPtr &) = default; |
353 | | CanonicalDeclPtr &operator=(const CanonicalDeclPtr &) = default; |
354 | | |
355 | 208k | operator decl_type *() { return Ptr; } clang::CanonicalDeclPtr<clang::FunctionDecl>::operator clang::FunctionDecl*() Line | Count | Source | 355 | 187k | operator decl_type *() { return Ptr; } |
clang::CanonicalDeclPtr<clang::VarDecl>::operator clang::VarDecl*() Line | Count | Source | 355 | 1.08k | operator decl_type *() { return Ptr; } |
clang::CanonicalDeclPtr<clang::Decl const>::operator clang::Decl const*() Line | Count | Source | 355 | 19.4k | operator decl_type *() { return Ptr; } |
clang::CanonicalDeclPtr<clang::VarDecl const>::operator clang::VarDecl const*() Line | Count | Source | 355 | 24 | operator decl_type *() { return Ptr; } |
|
356 | 23.2M | operator const decl_type *() const { return Ptr; } clang::CanonicalDeclPtr<clang::FunctionDecl>::operator clang::FunctionDecl const*() const Line | Count | Source | 356 | 2.43M | operator const decl_type *() const { return Ptr; } |
clang::CanonicalDeclPtr<clang::Decl const>::operator clang::Decl const*() const Line | Count | Source | 356 | 4.34M | operator const decl_type *() const { return Ptr; } |
clang::CanonicalDeclPtr<clang::Decl>::operator clang::Decl const*() const Line | Count | Source | 356 | 12.0M | operator const decl_type *() const { return Ptr; } |
clang::CanonicalDeclPtr<clang::CXXRecordDecl const>::operator clang::CXXRecordDecl const*() const Line | Count | Source | 356 | 2.90M | operator const decl_type *() const { return Ptr; } |
clang::CanonicalDeclPtr<clang::VarDecl const>::operator clang::VarDecl const*() const Line | Count | Source | 356 | 1.46M | operator const decl_type *() const { return Ptr; } |
|
357 | | |
358 | | decl_type *operator->() { return Ptr; } |
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.61k | friend bool operator==(CanonicalDeclPtr LHS, CanonicalDeclPtr RHS) { |
365 | 3.61k | return LHS.Ptr == RHS.Ptr; |
366 | 3.61k | } |
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 | | friend struct llvm::PointerLikeTypeTraits<CanonicalDeclPtr<decl_type>>; |
374 | | |
375 | | decl_type *Ptr = nullptr; |
376 | | }; |
377 | | |
378 | | } // namespace clang |
379 | | |
380 | | namespace llvm { |
381 | | |
382 | | template <typename decl_type> |
383 | | struct DenseMapInfo<clang::CanonicalDeclPtr<decl_type>> { |
384 | | using CanonicalDeclPtr = clang::CanonicalDeclPtr<decl_type>; |
385 | | using BaseInfo = DenseMapInfo<decl_type *>; |
386 | | |
387 | 993k | static CanonicalDeclPtr getEmptyKey() { |
388 | | // Construct our CanonicalDeclPtr this way because the regular constructor |
389 | | // would dereference P.Ptr, which is not allowed. |
390 | 993k | CanonicalDeclPtr P; |
391 | 993k | P.Ptr = BaseInfo::getEmptyKey(); |
392 | 993k | return P; |
393 | 993k | } llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::getEmptyKey() Line | Count | Source | 387 | 187k | static CanonicalDeclPtr getEmptyKey() { | 388 | | // Construct our CanonicalDeclPtr this way because the regular constructor | 389 | | // would dereference P.Ptr, which is not allowed. | 390 | 187k | CanonicalDeclPtr P; | 391 | 187k | P.Ptr = BaseInfo::getEmptyKey(); | 392 | 187k | return P; | 393 | 187k | } |
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl const> >::getEmptyKey() Line | Count | Source | 387 | 168k | static CanonicalDeclPtr getEmptyKey() { | 388 | | // Construct our CanonicalDeclPtr this way because the regular constructor | 389 | | // would dereference P.Ptr, which is not allowed. | 390 | 168k | CanonicalDeclPtr P; | 391 | 168k | P.Ptr = BaseInfo::getEmptyKey(); | 392 | 168k | return P; | 393 | 168k | } |
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl> >::getEmptyKey() Line | Count | Source | 387 | 492k | static CanonicalDeclPtr getEmptyKey() { | 388 | | // Construct our CanonicalDeclPtr this way because the regular constructor | 389 | | // would dereference P.Ptr, which is not allowed. | 390 | 492k | CanonicalDeclPtr P; | 391 | 492k | P.Ptr = BaseInfo::getEmptyKey(); | 392 | 492k | return P; | 393 | 492k | } |
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::getEmptyKey() Line | Count | Source | 387 | 87.4k | static CanonicalDeclPtr getEmptyKey() { | 388 | | // Construct our CanonicalDeclPtr this way because the regular constructor | 389 | | // would dereference P.Ptr, which is not allowed. | 390 | 87.4k | CanonicalDeclPtr P; | 391 | 87.4k | P.Ptr = BaseInfo::getEmptyKey(); | 392 | 87.4k | return P; | 393 | 87.4k | } |
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::VarDecl const> >::getEmptyKey() Line | Count | Source | 387 | 57.2k | static CanonicalDeclPtr getEmptyKey() { | 388 | | // Construct our CanonicalDeclPtr this way because the regular constructor | 389 | | // would dereference P.Ptr, which is not allowed. | 390 | 57.2k | CanonicalDeclPtr P; | 391 | 57.2k | P.Ptr = BaseInfo::getEmptyKey(); | 392 | 57.2k | return P; | 393 | 57.2k | } |
|
394 | | |
395 | 632k | static CanonicalDeclPtr getTombstoneKey() { |
396 | 632k | CanonicalDeclPtr P; |
397 | 632k | P.Ptr = BaseInfo::getTombstoneKey(); |
398 | 632k | return P; |
399 | 632k | } llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::getTombstoneKey() Line | Count | Source | 395 | 134k | static CanonicalDeclPtr getTombstoneKey() { | 396 | 134k | CanonicalDeclPtr P; | 397 | 134k | P.Ptr = BaseInfo::getTombstoneKey(); | 398 | 134k | return P; | 399 | 134k | } |
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl const> >::getTombstoneKey() Line | Count | Source | 395 | 110k | static CanonicalDeclPtr getTombstoneKey() { | 396 | 110k | CanonicalDeclPtr P; | 397 | 110k | P.Ptr = BaseInfo::getTombstoneKey(); | 398 | 110k | return P; | 399 | 110k | } |
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl> >::getTombstoneKey() Line | Count | Source | 395 | 311k | static CanonicalDeclPtr getTombstoneKey() { | 396 | 311k | CanonicalDeclPtr P; | 397 | 311k | P.Ptr = BaseInfo::getTombstoneKey(); | 398 | 311k | return P; | 399 | 311k | } |
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::getTombstoneKey() Line | Count | Source | 395 | 43.7k | static CanonicalDeclPtr getTombstoneKey() { | 396 | 43.7k | CanonicalDeclPtr P; | 397 | 43.7k | P.Ptr = BaseInfo::getTombstoneKey(); | 398 | 43.7k | return P; | 399 | 43.7k | } |
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::VarDecl const> >::getTombstoneKey() Line | Count | Source | 395 | 32.7k | static CanonicalDeclPtr getTombstoneKey() { | 396 | 32.7k | CanonicalDeclPtr P; | 397 | 32.7k | P.Ptr = BaseInfo::getTombstoneKey(); | 398 | 32.7k | return P; | 399 | 32.7k | } |
|
400 | | |
401 | 462k | static unsigned getHashValue(const CanonicalDeclPtr &P) { |
402 | 462k | return BaseInfo::getHashValue(P); |
403 | 462k | } llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::getHashValue(clang::CanonicalDeclPtr<clang::FunctionDecl> const&) Line | Count | Source | 401 | 127k | static unsigned getHashValue(const CanonicalDeclPtr &P) { | 402 | 127k | return BaseInfo::getHashValue(P); | 403 | 127k | } |
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl const> >::getHashValue(clang::CanonicalDeclPtr<clang::Decl const> const&) Line | Count | Source | 401 | 53.5k | static unsigned getHashValue(const CanonicalDeclPtr &P) { | 402 | 53.5k | return BaseInfo::getHashValue(P); | 403 | 53.5k | } |
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl> >::getHashValue(clang::CanonicalDeclPtr<clang::Decl> const&) Line | Count | Source | 401 | 235k | static unsigned getHashValue(const CanonicalDeclPtr &P) { | 402 | 235k | return BaseInfo::getHashValue(P); | 403 | 235k | } |
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::getHashValue(clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&) Line | Count | Source | 401 | 23.3k | static unsigned getHashValue(const CanonicalDeclPtr &P) { | 402 | 23.3k | return BaseInfo::getHashValue(P); | 403 | 23.3k | } |
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::VarDecl const> >::getHashValue(clang::CanonicalDeclPtr<clang::VarDecl const> const&) Line | Count | Source | 401 | 23.3k | static unsigned getHashValue(const CanonicalDeclPtr &P) { | 402 | 23.3k | return BaseInfo::getHashValue(P); | 403 | 23.3k | } |
|
404 | | |
405 | | static bool isEqual(const CanonicalDeclPtr &LHS, |
406 | 11.3M | const CanonicalDeclPtr &RHS) { |
407 | 11.3M | return BaseInfo::isEqual(LHS, RHS); |
408 | 11.3M | } llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl> >::isEqual(clang::CanonicalDeclPtr<clang::FunctionDecl> const&, clang::CanonicalDeclPtr<clang::FunctionDecl> const&) Line | Count | Source | 406 | 1.15M | const CanonicalDeclPtr &RHS) { | 407 | 1.15M | return BaseInfo::isEqual(LHS, RHS); | 408 | 1.15M | } |
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl const> >::isEqual(clang::CanonicalDeclPtr<clang::Decl const> const&, clang::CanonicalDeclPtr<clang::Decl const> const&) Line | Count | Source | 406 | 2.14M | const CanonicalDeclPtr &RHS) { | 407 | 2.14M | return BaseInfo::isEqual(LHS, RHS); | 408 | 2.14M | } |
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::Decl> >::isEqual(clang::CanonicalDeclPtr<clang::Decl> const&, clang::CanonicalDeclPtr<clang::Decl> const&) Line | Count | Source | 406 | 5.92M | const CanonicalDeclPtr &RHS) { | 407 | 5.92M | return BaseInfo::isEqual(LHS, RHS); | 408 | 5.92M | } |
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::CXXRecordDecl const> >::isEqual(clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&, clang::CanonicalDeclPtr<clang::CXXRecordDecl const> const&) Line | Count | Source | 406 | 1.44M | const CanonicalDeclPtr &RHS) { | 407 | 1.44M | return BaseInfo::isEqual(LHS, RHS); | 408 | 1.44M | } |
llvm::DenseMapInfo<clang::CanonicalDeclPtr<clang::VarDecl const> >::isEqual(clang::CanonicalDeclPtr<clang::VarDecl const> const&, clang::CanonicalDeclPtr<clang::VarDecl const> const&) Line | Count | Source | 406 | 719k | const CanonicalDeclPtr &RHS) { | 407 | 719k | return BaseInfo::isEqual(LHS, RHS); | 408 | 719k | } |
|
409 | | }; |
410 | | |
411 | | template <typename decl_type> |
412 | | struct PointerLikeTypeTraits<clang::CanonicalDeclPtr<decl_type>> { |
413 | 617k | static inline void *getAsVoidPointer(clang::CanonicalDeclPtr<decl_type> P) { |
414 | 617k | return P.Ptr; |
415 | 617k | } |
416 | | static inline clang::CanonicalDeclPtr<decl_type> getFromVoidPointer(void *P) { |
417 | | clang::CanonicalDeclPtr<decl_type> C; |
418 | | C.Ptr = PointerLikeTypeTraits<decl_type *>::getFromVoidPtr(P); |
419 | | return C; |
420 | | } |
421 | | static constexpr int NumLowBitsAvailable = |
422 | | PointerLikeTypeTraits<decl_type *>::NumLowBitsAvailable; |
423 | | }; |
424 | | |
425 | | } // namespace llvm |
426 | | |
427 | | #endif // LLVM_CLANG_AST_REDECLARABLE_H |