14#ifndef LLVM_CLANG_AST_GLOBALDECL_H
15#define LLVM_CLANG_AST_GLOBALDECL_H
25#include "llvm/ADT/DenseMapInfo.h"
26#include "llvm/ADT/PointerIntPair.h"
27#include "llvm/Support/Casting.h"
28#include "llvm/Support/type_traits.h"
58 llvm::PointerIntPair<const Decl *, 3> Value;
59 unsigned MultiVersionIndex = 0;
64 assert(!D->
hasAttr<CUDAGlobalAttr>() &&
"Use other ctor with GPU kernels!");
73 : MultiVersionIndex(MVIndex) {
75 Value.setPointerAndInt(D, unsigned(getDefaultKernelReference(D)));
99 CanonGD.Value.setPointer(Value.getPointer()->getCanonicalDecl());
100 CanonGD.Value.setInt(Value.getInt());
101 CanonGD.MultiVersionIndex = MultiVersionIndex;
121 "Decl is not a global variable!");
131 "Decl is not a plain FunctionDecl!");
132 return MultiVersionIndex;
142 "Decl is not a GPU kernel!");
148 return LHS.Value == RHS.Value &&
149 LHS.MultiVersionIndex == RHS.MultiVersionIndex;
153 return !(*
this ==
Other);
162 GD.Value.setFromOpaqueValue(P);
174 Result.Value.setPointer(D);
197 "Decl is not a plain FunctionDecl!");
199 Result.MultiVersionIndex = Index;
206 "Decl is not a GPU kernel!");
208 Result.Value.setInt(
unsigned(Kind));
217 template<>
struct DenseMapInfo<
clang::GlobalDecl> {
Enums/classes describing ABI related information about constructors, destructors and thunks.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
This file defines OpenACC nodes for declarative directives.
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.
static bool hasAttr(const Decl *D, bool IgnoreImplicitAttr)
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.
const LangOptions & getLangOpts() const LLVM_READONLY
Helper to get the language options from the ASTContext.
Represents a function declaration or definition.
bool isReferenceableKernel() const
GlobalDecl - represents a global declaration.
GlobalDecl(const OMPDeclareReductionDecl *D)
GlobalDecl(const CapturedDecl *D)
GlobalDecl(const OpenACCDeclareDecl *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(const OpenACCRoutineDecl *D)
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.
bool isa(CodeGen::Address addr)
@ Result
The result type of a method or function.
CXXDtorType
C++ destructor types.
U cast(CodeGen::Address addr)
@ 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()