26#include "llvm/ADT/STLForwardCompat.h"
27#include "llvm/ADT/SmallVector.h"
37 return !A->isImplicit();
42 assert(
getLangOpts().
CUDA &&
"Should only be called during CUDA compilation");
43 ForceHostDeviceDepth++;
47 assert(
getLangOpts().
CUDA &&
"Should only be called during CUDA compilation");
48 if (ForceHostDeviceDepth == 0)
50 ForceHostDeviceDepth--;
72 bool HasHostAttr =
false;
73 bool HasDeviceAttr =
false;
74 bool HasGlobalAttr =
false;
75 bool HasInvalidTargetAttr =
false;
77 switch (AL.getKind()) {
78 case ParsedAttr::AT_CUDAGlobal:
81 case ParsedAttr::AT_CUDAHost:
84 case ParsedAttr::AT_CUDADevice:
87 case ParsedAttr::AT_CUDAInvalidTarget:
88 HasInvalidTargetAttr =
true;
95 if (HasInvalidTargetAttr)
101 if (HasHostAttr && HasDeviceAttr)
113 return isa<A>(Attribute) &&
114 !(IgnoreImplicitAttr && Attribute->isImplicit());
123 auto *VD = dyn_cast_or_null<VarDecl>(
D);
124 if (VD && VD->hasGlobalStorage() && !VD->isStaticLocal()) {
126 if ((hasAttr<CUDADeviceAttr>(VD,
true) &&
127 !hasAttr<CUDAHostAttr>(VD,
true)) ||
128 hasAttr<CUDASharedAttr>(VD,
true) ||
129 hasAttr<CUDAConstantAttr>(VD,
true))
137 bool IgnoreImplicitHDAttr) {
142 if (
D->
hasAttr<CUDAInvalidTargetAttr>())
148 if (hasAttr<CUDADeviceAttr>(
D, IgnoreImplicitHDAttr)) {
149 if (hasAttr<CUDAHostAttr>(
D, IgnoreImplicitHDAttr))
152 }
else if (hasAttr<CUDAHostAttr>(
D, IgnoreImplicitHDAttr)) {
155 !IgnoreImplicitHDAttr) {
166 if (Var->
hasAttr<HIPManagedAttr>())
172 Var->
hasAttr<CUDAConstantAttr>() &&
173 !hasExplicitAttr<CUDAConstantAttr>(Var))
175 if (Var->
hasAttr<CUDADeviceAttr>() || Var->
hasAttr<CUDAConstantAttr>() ||
176 Var->
hasAttr<CUDASharedAttr>() ||
229 assert(Callee &&
"Callee must be valid.");
236 (isa<CXXConstructorDecl>(Callee) || isa<CXXDestructorDecl>(Callee)))
260 if (CalleeTarget == CallerTarget ||
303 llvm_unreachable(
"All cases should've been handled by now.");
310 return A->isImplicit();
315 bool IsImplicitDevAttr = hasImplicitAttr<CUDADeviceAttr>(
D);
316 bool IsImplicitHostAttr = hasImplicitAttr<CUDAHostAttr>(
D);
317 return IsImplicitDevAttr && IsImplicitHostAttr;
323 if (Matches.size() <= 1)
326 using Pair = std::pair<DeclAccessPair, FunctionDecl*>;
329 auto GetCFP = [&](
const Pair &Match) {
335 Matches.begin(), Matches.end(),
336 [&](
const Pair &M1,
const Pair &M2) { return GetCFP(M1) < GetCFP(M2); }));
339 llvm::erase_if(Matches,
340 [&](
const Pair &Match) {
return GetCFP(Match) < BestCFP; });
360 *ResolvedTarget = Target2;
362 *ResolvedTarget = Target1;
363 }
else if (Target1 != Target2) {
366 *ResolvedTarget = Target1;
381 bool HasH = MemberDecl->
hasAttr<CUDAHostAttr>();
382 bool HasD = MemberDecl->
hasAttr<CUDADeviceAttr>();
383 bool HasExplicitAttr =
384 (HasD && !MemberDecl->
getAttr<CUDADeviceAttr>()->isImplicit()) ||
385 (HasH && !MemberDecl->
getAttr<CUDAHostAttr>()->isImplicit());
386 if (!InClass || HasExplicitAttr)
389 std::optional<CUDAFunctionTarget> InferredTarget;
399 for (
const auto &B : ClassDecl->
bases()) {
400 if (!B.isVirtual()) {
406 llvm::append_range(Bases, llvm::make_pointer_range(ClassDecl->
vbases()));
409 for (
const auto *B : Bases) {
428 if (!InferredTarget) {
429 InferredTarget = BaseMethodTarget;
432 *InferredTarget, BaseMethodTarget, &*InferredTarget);
433 if (ResolutionError) {
436 diag::note_implicit_member_target_infer_collision)
437 << (
unsigned)CSM << llvm::to_underlying(*InferredTarget)
438 << llvm::to_underlying(BaseMethodTarget);
448 for (
const auto *F : ClassDecl->
fields()) {
449 if (F->isInvalidDecl()) {
462 ConstRHS && !F->isMutable(),
472 if (!InferredTarget) {
473 InferredTarget = FieldMethodTarget;
476 *InferredTarget, FieldMethodTarget, &*InferredTarget);
477 if (ResolutionError) {
480 diag::note_implicit_member_target_infer_collision)
481 << (
unsigned)CSM << llvm::to_underlying(*InferredTarget)
482 << llvm::to_underlying(FieldMethodTarget);
494 bool NeedsH =
true, NeedsD =
true;
495 if (InferredTarget) {
540 if (const CXXConstructExpr *CE =
541 dyn_cast<CXXConstructExpr>(CI->getInit()))
542 return isEmptyConstructor(Loc, CE->getConstructor());
584 if (CXXRecordDecl *RD = BS.getType()->getAsCXXRecordDecl())
585 return isEmptyDestructor(Loc, RD->getDestructor());
592 if (CXXRecordDecl *RD = Field->getType()
593 ->getBaseElementTypeUnsafe()
594 ->getAsCXXRecordDecl())
595 return isEmptyDestructor(Loc, RD->getDestructor());
604enum CUDAInitializerCheckKind {
605 CICK_DeviceOrConstant,
609bool IsDependentVar(
VarDecl *VD) {
613 return Init->isValueDependent();
627 CUDAInitializerCheckKind CheckKind) {
629 assert(!IsDependentVar(VD) &&
"do not check dependent var");
631 auto IsEmptyInit = [&](
const Expr *
Init) {
634 if (
const auto *CE = dyn_cast<CXXConstructExpr>(
Init)) {
635 return S.isEmptyConstructor(VD->
getLocation(), CE->getConstructor());
639 auto IsConstantInit = [&](
const Expr *
Init) {
646 auto HasEmptyDtor = [&](
VarDecl *VD) {
648 return S.isEmptyDestructor(VD->
getLocation(), RD->getDestructor());
651 if (CheckKind == CICK_Shared)
652 return IsEmptyInit(
Init) && HasEmptyDtor(VD);
654 ((IsEmptyInit(
Init) || IsConstantInit(
Init)) && HasEmptyDtor(VD));
663 if (FD->isDependentContext())
672 bool IsSharedVar = VD->
hasAttr<CUDASharedAttr>();
673 bool IsDeviceOrConstantVar =
675 (VD->
hasAttr<CUDADeviceAttr>() || VD->
hasAttr<CUDAConstantAttr>());
676 if (IsDeviceOrConstantVar || IsSharedVar) {
677 if (HasAllowedCUDADeviceStaticInitializer(
678 *
this, VD, IsSharedVar ? CICK_Shared : CICK_DeviceOrConstant))
681 IsSharedVar ? diag::err_shared_var_init : diag::err_dynamic_var_init)
682 <<
Init->getSourceRange();
689 InitFn = CE->getConstructor();
690 }
else if (
const CallExpr *CE = dyn_cast<CallExpr>(
Init)) {
691 InitFn = CE->getDirectCallee();
698 << llvm::to_underlying(InitFnTarget) << InitFn;
722 !
getASTContext().CUDAImplicitHostDeviceFunUsedByDevice.count(Caller))))
742 assert(
getLangOpts().
CUDA &&
"Should only be called during CUDA compilation");
744 if (ForceHostDeviceDepth > 0) {
745 if (!NewD->
hasAttr<CUDAHostAttr>())
747 if (!NewD->
hasAttr<CUDADeviceAttr>())
754 if (
getLangOpts().OffloadImplicitHostDeviceTemplates &&
755 !NewD->
hasAttr<CUDAHostAttr>() && !NewD->
hasAttr<CUDADeviceAttr>() &&
756 !NewD->
hasAttr<CUDAGlobalAttr>() &&
766 NewD->
hasAttr<CUDADeviceAttr>() || NewD->
hasAttr<CUDAGlobalAttr>())
773 D = Using->getTargetDecl();
775 return OldD && OldD->
hasAttr<CUDADeviceAttr>() &&
776 !OldD->
hasAttr<CUDAHostAttr>() &&
781 auto It = llvm::find_if(
Previous, IsMatchingDeviceFn);
790 diag::err_cuda_unattributed_constexpr_cannot_overload_device)
793 diag::note_cuda_conflicting_device_function_declared_here);
809 !VD->
hasAttr<CUDASharedAttr>() &&
811 !IsDependentVar(VD) &&
813 HasAllowedCUDADeviceStaticInitializer(*
this, VD,
814 CICK_DeviceOrConstant))) {
821 assert(
getLangOpts().
CUDA &&
"Should only be called during CUDA compilation");
824 SemaDiagnosticBuilder::Kind DiagKind = [&] {
826 return SemaDiagnosticBuilder::K_Nop;
830 return SemaDiagnosticBuilder::K_Immediate;
836 return SemaDiagnosticBuilder::K_Nop;
839 return SemaDiagnosticBuilder::K_Immediate;
842 ? SemaDiagnosticBuilder::K_ImmediateWithCallStack
843 : SemaDiagnosticBuilder::K_Deferred;
845 return SemaDiagnosticBuilder::K_Nop;
853 assert(
getLangOpts().
CUDA &&
"Should only be called during CUDA compilation");
856 SemaDiagnosticBuilder::Kind DiagKind = [&] {
858 return SemaDiagnosticBuilder::K_Nop;
861 return SemaDiagnosticBuilder::K_Immediate;
867 return SemaDiagnosticBuilder::K_Nop;
870 return SemaDiagnosticBuilder::K_Immediate;
873 ? SemaDiagnosticBuilder::K_ImmediateWithCallStack
874 : SemaDiagnosticBuilder::K_Deferred;
876 return SemaDiagnosticBuilder::K_Nop;
883 assert(
getLangOpts().
CUDA &&
"Should only be called during CUDA compilation");
884 assert(Callee &&
"Callee may not be null.");
887 if (ExprEvalCtx.isUnevaluated() || ExprEvalCtx.isConstantEvaluated())
900 SemaDiagnosticBuilder::Kind DiagKind = [
this, Caller, Callee,
901 CallerKnownEmitted] {
905 assert(Caller &&
"Never/wrongSide calls require a non-null caller");
909 return CallerKnownEmitted
910 ? SemaDiagnosticBuilder::K_ImmediateWithCallStack
911 : SemaDiagnosticBuilder::K_Deferred;
913 return SemaDiagnosticBuilder::K_Nop;
917 if (DiagKind == SemaDiagnosticBuilder::K_Nop) {
920 Callee->hasAttr<CUDAGlobalAttr>() && !Callee->isDefined() &&
935 SemaDiagnosticBuilder(DiagKind,
Loc, diag::err_ref_bad_target, Caller,
939 if (!Callee->getBuiltinID())
940 SemaDiagnosticBuilder(DiagKind, Callee->getLocation(),
941 diag::note_previous_decl, Caller,
SemaRef)
943 return DiagKind != SemaDiagnosticBuilder::K_Immediate &&
944 DiagKind != SemaDiagnosticBuilder::K_ImmediateWithCallStack;
975 bool CalleeIsDevice = Callee->hasAttr<CUDADeviceAttr>();
977 !Caller->
hasAttr<CUDAGlobalAttr>() && !Caller->
hasAttr<CUDADeviceAttr>();
978 bool ShouldCheck = CalleeIsDevice && CallerIsHost;
981 auto DiagKind = SemaDiagnosticBuilder::K_Deferred;
984 diag::err_capture_bad_target, Callee,
SemaRef)
992 diag::warn_maybe_capture_bad_target_this_ptr, Callee,
998 assert(
getLangOpts().
CUDA &&
"Should only be called during CUDA compilation");
999 if (Method->
hasAttr<CUDAHostAttr>() || Method->
hasAttr<CUDADeviceAttr>())
1007 assert(
getLangOpts().
CUDA &&
"Should only be called during CUDA compilation");
1020 if (NewTarget != OldTarget &&
1024 !(
getLangOpts().OffloadImplicitHostDeviceTemplates &&
1028 !(
getLangOpts().OffloadImplicitHostDeviceTemplates &&
1034 << llvm::to_underlying(NewTarget) << NewFD->
getDeclName()
1035 << llvm::to_underlying(OldTarget) << OldFD;
1045 << llvm::to_underlying(NewTarget) << llvm::to_underlying(OldTarget);
1052template <
typename AttrTy>
1055 if (AttrTy *Attribute = TemplateFD.
getAttr<AttrTy>()) {
1056 AttrTy *Clone = Attribute->clone(S.
Context);
1057 Clone->setInherited(
true);
1065 copyAttrIfPresent<CUDAGlobalAttr>(
SemaRef, FD, TemplateFD);
1066 copyAttrIfPresent<CUDAHostAttr>(
SemaRef, FD, TemplateFD);
1067 copyAttrIfPresent<CUDADeviceAttr>(
SemaRef, FD, TemplateFD);
1072 return "__llvmPushCallConfiguration";
1075 return getLangOpts().HIPUseNewLaunchAPI ?
"__hipPushCallConfiguration"
1076 :
"hipConfigureCall";
1081 return "__cudaPushCallConfiguration";
1084 return "cudaConfigureCall";
Defines the clang::ASTContext interface.
static bool hasImplicitAttr(const ValueDecl *D)
Defines the clang::Expr interface and subclasses for C++ expressions.
llvm::MachO::Target Target
Defines the clang::Preprocessor interface.
static bool resolveCalleeCUDATargetConflict(CUDAFunctionTarget Target1, CUDAFunctionTarget Target2, CUDAFunctionTarget *ResolvedTarget)
When an implicitly-declared special member has to invoke more than one base/field special member,...
static bool hasAttr(const Decl *D, bool IgnoreImplicitAttr)
static void copyAttrIfPresent(Sema &S, FunctionDecl *FD, const FunctionDecl &TemplateFD)
static bool hasExplicitAttr(const VarDecl *D)
This file declares semantic analysis for CUDA constructs.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
llvm::SetVector< const ValueDecl * > CUDAExternalDeviceDeclODRUsedByHost
Keep track of CUDA/HIP external kernels or device variables ODR-used by host code.
GVALinkage GetGVALinkageForFunction(const FunctionDecl *FD) const
llvm::DenseSet< const FunctionDecl * > CUDAImplicitHostDeviceFunUsedByDevice
Keep track of CUDA/HIP implicit host device functions used on device side in device compilation.
FunctionDecl * getcudaConfigureCallDecl()
Attr - This represents one attribute.
Represents a base class of a C++ class.
Represents a call to a C++ constructor.
Represents a C++ constructor within a class.
Represents a C++ base or member initializer.
Represents a C++ destructor within a class.
Represents a static or instance method of a struct/union/class.
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined.
Represents a C++ struct/union/class.
base_class_range vbases()
bool isAbstract() const
Determine whether this class has a pure virtual function.
bool isDynamicClass() const
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
DeclContext * getLexicalParent()
getLexicalParent - Returns the containing lexical DeclContext.
A reference to a declared variable, function, enum, etc.
Decl - This represents one declaration (or definition), e.g.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
bool isInvalidDecl() const
SourceLocation getLocation() const
DeclContext * getDeclContext()
This represents one expression.
Represents a member of a struct/union/class.
Represents a function declaration or definition.
bool hasTrivialBody() const
Returns whether the function has a trivial body that does not require any specific codegen.
bool isFunctionTemplateSpecialization() const
Determine whether this function is a function template specialization.
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
bool isVariadic() const
Whether this function is variadic.
bool isTemplateInstantiation() const
Determines if the given function was instantiated from a function template.
bool isConstexpr() const
Whether this is a (C++11) constexpr function or constexpr constructor.
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
bool isDefined(const FunctionDecl *&Definition, bool CheckForPendingFriendDefinition=false) const
Returns true if the function has a definition that does not need to be instantiated.
Declaration of a template function.
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Represents the results of name lookup.
This represents a decl that may have a name.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
ParsedAttr - Represents a syntactic attribute.
A (possibly-)qualified type.
bool isConstQualified() const
Determine whether this type is const-qualified.
field_range fields() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
Scope - A scope is a transient data structure that is used while parsing the program.
A generic diagnostic builder for errors which may or may not be deferred.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
ASTContext & getASTContext() const
const LangOptions & getLangOpts() const
DiagnosticsEngine & getDiagnostics() const
void PushForceHostDevice()
Increments our count of the number of times we've seen a pragma forcing functions to be host device.
void checkAllowedInitializer(VarDecl *VD)
void RecordImplicitHostDeviceFuncUsedByDevice(const FunctionDecl *FD)
Record FD if it is a CUDA/HIP implicit host device function used on device side in device compilation...
std::string getConfigureFuncName() const
Returns the name of the launch configuration function.
bool PopForceHostDevice()
Decrements our count of the number of times we've seen a pragma forcing functions to be host device.
CUDAFunctionTarget IdentifyTarget(const FunctionDecl *D, bool IgnoreImplicitHDAttr=false)
Determines whether the given function is a CUDA device/host/kernel/etc.
void maybeAddHostDeviceAttrs(FunctionDecl *FD, const LookupResult &Previous)
May add implicit CUDAHostAttr and CUDADeviceAttr attributes to FD, depending on FD and the current co...
ExprResult ActOnExecConfigExpr(Scope *S, SourceLocation LLLLoc, MultiExprArg ExecConfig, SourceLocation GGGLoc)
bool isEmptyConstructor(SourceLocation Loc, CXXConstructorDecl *CD)
bool isEmptyDestructor(SourceLocation Loc, CXXDestructorDecl *CD)
void checkTargetOverload(FunctionDecl *NewFD, const LookupResult &Previous)
Check whether NewFD is a valid overload for CUDA.
CUDAFunctionTarget CurrentTarget()
Gets the CUDA target for the current context.
SemaDiagnosticBuilder DiagIfHostCode(SourceLocation Loc, unsigned DiagID)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as host cod...
bool inferTargetForImplicitSpecialMember(CXXRecordDecl *ClassDecl, CXXSpecialMemberKind CSM, CXXMethodDecl *MemberDecl, bool ConstRHS, bool Diagnose)
Given a implicit special member, infer its CUDA target from the calls it needs to make to underlying ...
struct clang::SemaCUDA::CUDATargetContext CurCUDATargetCtx
CUDATargetContextKind
Defines kinds of CUDA global host/device context where a function may be called.
@ CTCK_InitGlobalVar
Unknown context.
SemaDiagnosticBuilder DiagIfDeviceCode(SourceLocation Loc, unsigned DiagID)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device c...
llvm::DenseSet< FunctionDeclAndLoc > LocsWithCUDACallDiags
FunctionDecls and SourceLocations for which CheckCall has emitted a (maybe deferred) "bad call" diagn...
bool CheckCall(SourceLocation Loc, FunctionDecl *Callee)
Check whether we're allowed to call Callee from the current context.
void inheritTargetAttrs(FunctionDecl *FD, const FunctionTemplateDecl &TD)
Copies target attributes from the template TD to the function FD.
static bool isImplicitHostDeviceFunction(const FunctionDecl *D)
void CheckLambdaCapture(CXXMethodDecl *D, const sema::Capture &Capture)
void MaybeAddConstantAttr(VarDecl *VD)
May add implicit CUDAConstantAttr attribute to VD, depending on VD and current compilation settings.
void EraseUnwantedMatches(const FunctionDecl *Caller, llvm::SmallVectorImpl< std::pair< DeclAccessPair, FunctionDecl * > > &Matches)
Finds a function in Matches with highest calling priority from Caller context and erases all function...
void SetLambdaAttrs(CXXMethodDecl *Method)
Set device or host device attributes on the given lambda operator() method.
CUDAFunctionPreference IdentifyPreference(const FunctionDecl *Caller, const FunctionDecl *Callee)
Identifies relative preference of a given Caller/Callee combination, based on their host/device attri...
@ CVT_Host
Emitted on device side with a shadow variable on host side.
@ CVT_Both
Emitted on host side only.
@ CVT_Unified
Emitted on both sides with different addresses.
SpecialMemberOverloadResult - The overloading result for a special member function.
CXXMethodDecl * getMethod() const
Sema - This implements semantic analysis and AST building for C.
bool IsOverload(FunctionDecl *New, FunctionDecl *Old, bool UseMemberUsingDeclRules, bool ConsiderCudaAttrs=true)
bool IsLastErrorImmediate
Is the last error level diagnostic immediate.
const ExpressionEvaluationContextRecord & currentEvaluationContext() const
FunctionDecl * getCurFunctionDecl(bool AllowLambda=false) const
Returns a pointer to the innermost enclosing function, or nullptr if the current context is not insid...
ASTContext & getASTContext() const
const LangOptions & getLangOpts() const
ExprResult BuildCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr, bool IsExecConfig=false, bool AllowRecovery=false)
BuildCallExpr - Handle a call to Fn with the specified array of arguments.
FunctionEmissionStatus getEmissionStatus(const FunctionDecl *Decl, bool Final=false)
SourceManager & getSourceManager() const
void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, FunctionDecl *Function, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
Instantiate the definition of the given function from its template.
SpecialMemberOverloadResult LookupSpecialMember(CXXRecordDecl *D, CXXSpecialMemberKind SM, bool ConstArg, bool VolatileArg, bool RValueThis, bool ConstThis, bool VolatileThis)
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
Encodes a location in the source.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isReferenceType() const
bool isCUDADeviceBuiltinSurfaceType() const
Check if the type is the CUDA device builtin surface type.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isCUDADeviceBuiltinTextureType() const
Check if the type is the CUDA device builtin texture type.
const T * getAs() const
Member-template getAs<specific type>'.
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Represents a variable declaration or definition.
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
bool isStaticDataMember() const
Determines whether this is a static data member.
bool hasGlobalStorage() const
Returns true for all variables that do not have local storage.
bool isFileVarDecl() const
Returns true for file scoped variable declaration.
const Expr * getInit() const
ValueDecl * getVariable() const
bool isVariableCapture() const
SourceLocation getLocation() const
Retrieve the location at which this variable was captured.
bool isThisCapture() const
bool isReferenceCapture() const
Defines the clang::TargetInfo interface.
The JSON file list parser is used to communicate input to InstallAPI.
bool CudaFeatureEnabled(llvm::VersionTuple, CudaFeature)
CXXSpecialMemberKind
Kinds of C++ special members.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
CUDATargetContextKind Kind
CUDAFunctionTarget Target