14#ifndef LLVM_CLANG_AST_GLOBALDECL_H
15#define LLVM_CLANG_AST_GLOBALDECL_H
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"
57 llvm::PointerIntPair<const Decl *, 3>
Value;
58 unsigned MultiVersionIndex = 0;
61 assert(!isa<CXXConstructorDecl>(
D) &&
"Use other ctor with ctor decls!");
62 assert(!isa<CXXDestructorDecl>(
D) &&
"Use other ctor with dtor decls!");
63 assert(!
D->hasAttr<CUDAGlobalAttr>() &&
"Use other ctor with GPU kernels!");
72 : MultiVersionIndex(MVIndex) {
73 if (!
D->hasAttr<CUDAGlobalAttr>()) {
81 assert(
D->hasAttr<CUDAGlobalAttr>() &&
"Decl is not a GPU kernel!");
96 CanonGD.Value.setPointer(
Value.getPointer()->getCanonicalDecl());
97 CanonGD.Value.setInt(
Value.getInt());
98 CanonGD.MultiVersionIndex = MultiVersionIndex;
106 assert(isa<CXXConstructorDecl>(
getDecl()) &&
"Decl is not a ctor!");
111 assert(isa<CXXDestructorDecl>(
getDecl()) &&
"Decl is not a dtor!");
116 assert(isa<VarDecl>(
getDecl()) &&
117 cast<VarDecl>(
getDecl())->hasGlobalStorage() &&
118 "Decl is not a global variable!");
123 assert(isa<FunctionDecl>(
125 !cast<FunctionDecl>(
getDecl())->hasAttr<CUDAGlobalAttr>() &&
126 !isa<CXXConstructorDecl>(
getDecl()) &&
127 !isa<CXXDestructorDecl>(
getDecl()) &&
128 "Decl is not a plain FunctionDecl!");
129 return MultiVersionIndex;
133 assert(((isa<FunctionDecl>(
getDecl()) &&
134 cast<FunctionDecl>(
getDecl())->hasAttr<CUDAGlobalAttr>()) ||
135 (isa<FunctionTemplateDecl>(
getDecl()) &&
136 cast<FunctionTemplateDecl>(
getDecl())
138 ->hasAttr<CUDAGlobalAttr>())) &&
139 "Decl is not a GPU kernel!");
144 return LHS.Value == RHS.Value &&
145 LHS.MultiVersionIndex == RHS.MultiVersionIndex;
149 return !(*
this ==
Other);
158 GD.Value.setFromOpaqueValue(
P);
174 assert(isa<CXXConstructorDecl>(
getDecl()));
181 assert(isa<CXXDestructorDecl>(
getDecl()));
188 assert(isa<FunctionDecl>(
getDecl()) &&
189 !cast<FunctionDecl>(
getDecl())->hasAttr<CUDAGlobalAttr>() &&
190 !isa<CXXConstructorDecl>(
getDecl()) &&
191 !isa<CXXDestructorDecl>(
getDecl()) &&
192 "Decl is not a plain FunctionDecl!");
194 Result.MultiVersionIndex = Index;
199 assert(isa<FunctionDecl>(
getDecl()) &&
200 cast<FunctionDecl>(
getDecl())->hasAttr<CUDAGlobalAttr>() &&
201 "Decl is not a GPU kernel!");
212 template<>
struct DenseMapInfo<
clang::GlobalDecl> {
Enums/classes describing ABI related information about constructors, destructors and thunks.
enum clang::sema::@1655::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()