clang: include/clang/AST/GlobalDecl.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_CLANG_AST_GLOBALDECL_H
15#define LLVM_CLANG_AST_GLOBALDECL_H
16
24#include "llvm/ADT/DenseMapInfo.h"
25#include "llvm/ADT/PointerIntPair.h"
26#include "llvm/Support/Casting.h"
27#include "llvm/Support/type_traits.h"
28#include
29
31
37};
38
42};
43
44
45
46
47
48
49
50
51
52
53
54
55
57 llvm::PointerIntPair<const Decl *, 3> Value;
58 unsigned MultiVersionIndex = 0;
59
61 assert(!isa(D) && "Use other ctor with ctor decls!");
62 assert(!isa(D) && "Use other ctor with dtor decls!");
63 assert(->hasAttr() && "Use other ctor with GPU kernels!");
64
66 }
67
68public:
72 : MultiVersionIndex(MVIndex) {
73 if (->hasAttr()) {
75 return;
76 }
78 }
81 assert(D->hasAttr() && "Decl is not a GPU kernel!");
82 }
93
96 CanonGD.Value.setPointer(Value.getPointer()->getCanonicalDecl());
97 CanonGD.Value.setInt(Value.getInt());
98 CanonGD.MultiVersionIndex = MultiVersionIndex;
99
100 return CanonGD;
101 }
102
104
106 assert(isa(getDecl()) && "Decl is not a ctor!");
108 }
109
111 assert(isa(getDecl()) && "Decl is not a dtor!");
113 }
114
116 assert(isa(getDecl()) &&
117 cast(getDecl())->hasGlobalStorage() &&
118 "Decl is not a global variable!");
120 }
121
123 assert(isa(
125 !cast(getDecl())->hasAttr() &&
126 !isa(getDecl()) &&
127 !isa(getDecl()) &&
128 "Decl is not a plain FunctionDecl!");
129 return MultiVersionIndex;
130 }
131
133 assert(((isa(getDecl()) &&
134 cast(getDecl())->hasAttr()) ||
135 (isa(getDecl()) &&
136 cast(getDecl())
137 ->getTemplatedDecl()
138 ->hasAttr())) &&
139 "Decl is not a GPU kernel!");
141 }
142
144 return LHS.Value == RHS.Value &&
145 LHS.MultiVersionIndex == RHS.MultiVersionIndex;
146 }
147
149 return !(*this == Other);
150 }
151
153
155
158 GD.Value.setFromOpaqueValue(P);
159 return GD;
160 }
161
165 }
166
169 Result.Value.setPointer(D);
171 }
172
174 assert(isa(getDecl()));
178 }
179
181 assert(isa(getDecl()));
185 }
186
188 assert(isa(getDecl()) &&
189 !cast(getDecl())->hasAttr() &&
190 !isa(getDecl()) &&
191 !isa(getDecl()) &&
192 "Decl is not a plain FunctionDecl!");
194 Result.MultiVersionIndex = Index;
196 }
197
199 assert(isa(getDecl()) &&
200 cast(getDecl())->hasAttr() &&
201 "Decl is not a GPU kernel!");
205 }
206};
207
208}
209
210namespace llvm {
211
212 template<> struct DenseMapInfo<clang::GlobalDecl> {
215 }
216
220 }
221
223 return DenseMapInfo<void*>::getHashValue(GD.getAsOpaquePtr());
224 }
225
228 return LHS == RHS;
229 }
230 };
231
232}
233
234#endif
Enums/classes describing ABI related information about constructors, destructors and thunks.
enum clang::sema::@1725::IndirectLocalPathEntry::EntryKind Kind
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
This file defines OpenMP nodes for declarative directives.
Defines the C++ template declaration subclasses.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Represents a C++ constructor within a class.
Represents a C++ destructor within a class.
Represents the body of a CapturedStmt, and serves as its DeclContext.
Decl - This represents one declaration (or definition), e.g.
Represents a function declaration or definition.
GlobalDecl - represents a global declaration.
GlobalDecl(const OMPDeclareReductionDecl *D)
GlobalDecl(const CapturedDecl *D)
GlobalDecl getWithMultiVersionIndex(unsigned Index)
GlobalDecl getWithCtorType(CXXCtorType Type)
GlobalDecl(const FunctionDecl *D, KernelReferenceKind Kind)
CXXCtorType getCtorType() const
GlobalDecl(const FunctionDecl *D, unsigned MVIndex=0)
GlobalDecl getWithKernelReferenceKind(KernelReferenceKind Kind)
GlobalDecl getCanonicalDecl() const
friend bool operator==(const GlobalDecl &LHS, const GlobalDecl &RHS)
GlobalDecl(const VarDecl *D)
KernelReferenceKind getKernelReferenceKind() const
static GlobalDecl getFromOpaquePtr(void *P)
GlobalDecl getWithDecl(const Decl *D)
unsigned getMultiVersionIndex() const
void * getAsOpaquePtr() const
GlobalDecl(const CXXConstructorDecl *D, CXXCtorType Type)
DynamicInitKind getDynamicInitKind() const
GlobalDecl getWithDtorType(CXXDtorType Type)
GlobalDecl(const OMPDeclareMapperDecl *D)
bool operator!=(const GlobalDecl &Other) const
GlobalDecl(const VarDecl *D, DynamicInitKind StubKind)
static KernelReferenceKind getDefaultKernelReference(const FunctionDecl *D)
CXXDtorType getDtorType() const
const Decl * getDecl() const
GlobalDecl(const BlockDecl *D)
GlobalDecl(const CXXDestructorDecl *D, CXXDtorType Type)
GlobalDecl(const ObjCMethodDecl *D)
GlobalDecl(const NamedDecl *D)
This represents a decl that may have a name.
This represents '#pragma omp declare mapper ...' directive.
This represents '#pragma omp declare reduction ...' directive.
ObjCMethodDecl - Represents an instance or class method declaration.
The base class of the type hierarchy.
Represents a variable declaration or definition.
The JSON file list parser is used to communicate input to InstallAPI.
CXXCtorType
C++ constructor types.
@ Result
The result type of a method or function.
CXXDtorType
C++ destructor types.
@ Other
Other implicit parameter.
Diagnostic wrappers for TextAPI types for error reporting.
static bool isEqual(clang::GlobalDecl LHS, clang::GlobalDecl RHS)
static clang::GlobalDecl getTombstoneKey()
static unsigned getHashValue(clang::GlobalDecl GD)
static clang::GlobalDecl getEmptyKey()