clang 20.0.0git
|
#include "clang/Sema/SemaCUDA.h"
Classes | |
struct | CUDATargetContext |
Define the current global CUDA host/device context where a function may be called. More... | |
struct | CUDATargetContextRAII |
struct | FunctionDeclAndLoc |
A pair of a canonical FunctionDecl and a SourceLocation. More... | |
Public Types | |
enum | CUDAVariableTarget { CVT_Device , CVT_Host , CVT_Both , CVT_Unified } |
enum | CUDATargetContextKind { CTCK_Unknown , CTCK_InitGlobalVar } |
Defines kinds of CUDA global host/device context where a function may be called. More... | |
enum | CUDAFunctionPreference { CFP_Never , CFP_WrongSide , CFP_HostDevice , CFP_SameSide , CFP_Native } |
Public Member Functions | |
SemaCUDA (Sema &S) | |
void | PushForceHostDevice () |
Increments our count of the number of times we've seen a pragma forcing functions to be host device. | |
bool | PopForceHostDevice () |
Decrements our count of the number of times we've seen a pragma forcing functions to be host device. | |
ExprResult | ActOnExecConfigExpr (Scope *S, SourceLocation LLLLoc, MultiExprArg ExecConfig, SourceLocation GGGLoc) |
SemaDiagnosticBuilder | DiagIfDeviceCode (SourceLocation Loc, unsigned DiagID) |
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device code". | |
SemaDiagnosticBuilder | DiagIfHostCode (SourceLocation Loc, unsigned DiagID) |
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as host code". | |
CUDAFunctionTarget | IdentifyTarget (const FunctionDecl *D, bool IgnoreImplicitHDAttr=false) |
Determines whether the given function is a CUDA device/host/kernel/etc. | |
CUDAFunctionTarget | IdentifyTarget (const ParsedAttributesView &Attrs) |
CUDAVariableTarget | IdentifyTarget (const VarDecl *D) |
Determines whether the given variable is emitted on host or device side. | |
CUDAFunctionTarget | CurrentTarget () |
Gets the CUDA target for the current context. | |
CUDAFunctionPreference | IdentifyPreference (const FunctionDecl *Caller, const FunctionDecl *Callee) |
Identifies relative preference of a given Caller/Callee combination, based on their host/device attributes. | |
bool | IsAllowedCall (const FunctionDecl *Caller, const FunctionDecl *Callee) |
Determines whether Caller may invoke Callee, based on their CUDA host/device attributes. | |
void | maybeAddHostDeviceAttrs (FunctionDecl *FD, const LookupResult &Previous) |
May add implicit CUDAHostAttr and CUDADeviceAttr attributes to FD, depending on FD and the current compilation settings. | |
void | MaybeAddConstantAttr (VarDecl *VD) |
May add implicit CUDAConstantAttr attribute to VD, depending on VD and current compilation settings. | |
bool | CheckCall (SourceLocation Loc, FunctionDecl *Callee) |
Check whether we're allowed to call Callee from the current context. | |
void | CheckLambdaCapture (CXXMethodDecl *D, const sema::Capture &Capture) |
void | SetLambdaAttrs (CXXMethodDecl *Method) |
Set device or host device attributes on the given lambda operator() method. | |
void | RecordImplicitHostDeviceFuncUsedByDevice (const FunctionDecl *FD) |
Record FD if it is a CUDA/HIP implicit host device function used on device side in device compilation. | |
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 functions with lower calling priority. | |
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 base/field special members. | |
bool | isEmptyConstructor (SourceLocation Loc, CXXConstructorDecl *CD) |
bool | isEmptyDestructor (SourceLocation Loc, CXXDestructorDecl *CD) |
void | checkAllowedInitializer (VarDecl *VD) |
void | checkTargetOverload (FunctionDecl *NewFD, const LookupResult &Previous) |
Check whether NewFD is a valid overload for CUDA. | |
void | inheritTargetAttrs (FunctionDecl *FD, const FunctionTemplateDecl &TD) |
Copies target attributes from the template TD to the function FD. | |
std::string | getConfigureFuncName () const |
Returns the name of the launch configuration function. | |
Public Member Functions inherited from clang::SemaBase | |
SemaBase (Sema &S) | |
ASTContext & | getASTContext () const |
DiagnosticsEngine & | getDiagnostics () const |
const LangOptions & | getLangOpts () const |
SemaDiagnosticBuilder | Diag (SourceLocation Loc, unsigned DiagID, bool DeferHint=false) |
Emit a diagnostic. | |
SemaDiagnosticBuilder | Diag (SourceLocation Loc, const PartialDiagnostic &PD, bool DeferHint=false) |
Emit a partial diagnostic. | |
PartialDiagnostic | PDiag (unsigned DiagID=0) |
Build a partial diagnostic. | |
Static Public Member Functions | |
static bool | isImplicitHostDeviceFunction (const FunctionDecl *D) |
Public Attributes | |
llvm::DenseSet< FunctionDeclAndLoc > | LocsWithCUDACallDiags |
FunctionDecls and SourceLocations for which CheckCall has emitted a (maybe deferred) "bad call" diagnostic. | |
llvm::DenseMap< CanonicalDeclPtr< const FunctionDecl >, FunctionDeclAndLoc > | DeviceKnownEmittedFns |
An inverse call graph, mapping known-emitted functions to one of their known-emitted callers (plus the location of the call). | |
struct clang::SemaCUDA::CUDATargetContext | CurCUDATargetCtx |
Public Attributes inherited from clang::SemaBase | |
Sema & | SemaRef |
Friends | |
class | ASTReader |
class | ASTWriter |
Definition at line 45 of file SemaCUDA.h.
Enumerator | |
---|---|
CFP_Never | |
CFP_WrongSide | |
CFP_HostDevice | |
CFP_SameSide | |
CFP_Native |
Definition at line 160 of file SemaCUDA.h.
Defines kinds of CUDA global host/device context where a function may be called.
Enumerator | |
---|---|
CTCK_Unknown | |
CTCK_InitGlobalVar | Unknown context. |
Definition at line 129 of file SemaCUDA.h.
Enumerator | |
---|---|
CVT_Device | |
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. |
Definition at line 118 of file SemaCUDA.h.
SemaCUDA::SemaCUDA | ( | Sema & | S | ) |
Definition at line 31 of file SemaCUDA.cpp.
ExprResult SemaCUDA::ActOnExecConfigExpr | ( | Scope * | S, |
SourceLocation | LLLLoc, | ||
MultiExprArg | ExecConfig, | ||
SourceLocation | GGGLoc | ||
) |
Definition at line 54 of file SemaCUDA.cpp.
References clang::Sema::BuildCallExpr(), clang::SemaBase::Diag(), clang::ExprError(), clang::SemaBase::getASTContext(), getConfigureFuncName(), clang::ASTContext::getcudaConfigureCallDecl(), clang::ValueDecl::getType(), clang::Sema::MarkFunctionReferenced(), clang::SemaBase::SemaRef, and clang::VK_LValue.
void SemaCUDA::checkAllowedInitializer | ( | VarDecl * | VD | ) |
Definition at line 658 of file SemaCUDA.cpp.
References clang::SemaBase::Diag(), clang::Decl::getDeclContext(), clang::VarDecl::getInit(), clang::Decl::getLocation(), clang::Decl::hasAttr(), clang::VarDecl::hasGlobalStorage(), clang::VarDecl::hasInit(), clang::Host, clang::HostDevice, IdentifyTarget(), clang::Init, clang::Decl::isInvalidDecl(), and clang::Decl::setInvalidDecl().
Referenced by clang::Sema::FinalizeDeclaration(), and clang::Sema::InstantiateVariableInitializer().
bool SemaCUDA::CheckCall | ( | SourceLocation | Loc, |
FunctionDecl * | Callee | ||
) |
Check whether we're allowed to call Callee from the current context.
If the call is allowed in semantically-correct programs, but only if it's never codegen'ed (CFP_WrongSide), creates a deferred diagnostic to be emitted if and when the caller is codegen'ed, and returns true.
Will only create deferred diagnostics for a given SourceLocation once, so you can safely call this multiple times without generating duplicate deferred errors.
Definition at line 882 of file SemaCUDA.cpp.
References CFP_Never, CFP_WrongSide, clang::CUDA, clang::ASTContext::CUDAExternalDeviceDeclODRUsedByHost, clang::Sema::currentEvaluationContext(), clang::Sema::Emitted, clang::SemaBase::getASTContext(), clang::Sema::getCurFunctionDecl(), clang::FunctionDecl::getDescribedFunctionTemplate(), clang::Sema::getEmissionStatus(), clang::ASTContext::GetGVALinkageForFunction(), clang::SemaBase::getLangOpts(), clang::GVA_StrongExternal, IdentifyPreference(), Loc, LocsWithCUDACallDiags, and clang::SemaBase::SemaRef.
Referenced by clang::Sema::MarkFunctionReferenced().
void SemaCUDA::CheckLambdaCapture | ( | CXXMethodDecl * | D, |
const sema::Capture & | Capture | ||
) |
Definition at line 952 of file SemaCUDA.cpp.
References clang::Sema::getCurFunctionDecl(), clang::SemaBase::getLangOpts(), clang::sema::Capture::getLocation(), clang::sema::Capture::getVariable(), clang::Decl::hasAttr(), clang::sema::Capture::isReferenceCapture(), clang::sema::Capture::isThisCapture(), clang::sema::Capture::isVariableCapture(), and clang::SemaBase::SemaRef.
Referenced by clang::Sema::BuildLambdaExpr().
void SemaCUDA::checkTargetOverload | ( | FunctionDecl * | NewFD, |
const LookupResult & | Previous | ||
) |
Check whether NewFD is a valid overload for CUDA.
Emits diagnostics and invalidates NewFD if not.
Definition at line 1005 of file SemaCUDA.cpp.
References clang::CUDA, clang::Device, clang::SemaBase::Diag(), clang::Decl::getAsFunction(), clang::NamedDecl::getDeclName(), clang::SemaBase::getLangOpts(), clang::Decl::getLocation(), clang::Global, clang::Host, clang::HostDevice, IdentifyTarget(), isImplicitHostDeviceFunction(), clang::Sema::IsOverload(), Previous, clang::SemaBase::SemaRef, and clang::Decl::setInvalidDecl().
Referenced by clang::Sema::CheckFunctionDeclaration().
|
inline |
Gets the CUDA target for the current context.
Definition at line 152 of file SemaCUDA.h.
References clang::Sema::CurContext, IdentifyTarget(), and clang::SemaBase::SemaRef.
Referenced by DiagIfDeviceCode(), DiagIfHostCode(), and handleSharedAttr().
SemaBase::SemaDiagnosticBuilder SemaCUDA::DiagIfDeviceCode | ( | SourceLocation | Loc, |
unsigned | DiagID | ||
) |
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device code".
EmitOnBothSides
is true.Example usage:
// Variable-length arrays are not allowed in CUDA device code. if (DiagIfDeviceCode(Loc, diag::err_cuda_vla) << CurrentTarget()) return ExprError(); // Otherwise, continue parsing as normal.
Definition at line 819 of file SemaCUDA.cpp.
References clang::CUDA, CurrentTarget(), clang::Device, clang::Sema::Emitted, clang::Sema::getCurFunctionDecl(), clang::SemaBase::getDiagnostics(), clang::Sema::getEmissionStatus(), clang::SemaBase::getLangOpts(), clang::Global, clang::HostDevice, clang::Sema::IsLastErrorImmediate, Loc, and clang::SemaBase::SemaRef.
Referenced by clang::Sema::ActOnCXXTryBlock(), clang::Sema::BuildCXXThrow(), and clang::SemaBase::Diag().
Sema::SemaDiagnosticBuilder SemaCUDA::DiagIfHostCode | ( | SourceLocation | Loc, |
unsigned | DiagID | ||
) |
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as host code".
Same as DiagIfDeviceCode, with "host" and "device" switched.
Definition at line 851 of file SemaCUDA.cpp.
References clang::CUDA, CurrentTarget(), clang::Sema::Emitted, clang::Sema::getCurFunctionDecl(), clang::SemaBase::getDiagnostics(), clang::Sema::getEmissionStatus(), clang::SemaBase::getLangOpts(), clang::Host, clang::HostDevice, clang::Sema::IsLastErrorImmediate, Loc, and clang::SemaBase::SemaRef.
Referenced by clang::SemaBase::Diag(), and handleSharedAttr().
void SemaCUDA::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 functions with lower calling priority.
Definition at line 320 of file SemaCUDA.cpp.
References IdentifyPreference().
Referenced by clang::Sema::FindAllocationFunctions().
std::string SemaCUDA::getConfigureFuncName | ( | ) | const |
Returns the name of the launch configuration function.
This is the name of the function that will be called to configure kernel call, with the parameters specified via <<<>>>.
Definition at line 1070 of file SemaCUDA.cpp.
References clang::CUDA_USES_NEW_LAUNCH, clang::CudaFeatureEnabled(), clang::SemaBase::getASTContext(), clang::SemaBase::getLangOpts(), and clang::HIP.
Referenced by ActOnExecConfigExpr(), and clang::Sema::ActOnFunctionDeclarator().
SemaCUDA::CUDAFunctionPreference SemaCUDA::IdentifyPreference | ( | const FunctionDecl * | Caller, |
const FunctionDecl * | Callee | ||
) |
Identifies relative preference of a given Caller/Callee combination, based on their host/device attributes.
Caller | function which needs address of Callee . nullptr in case of global context. |
Callee | target function |
Definition at line 227 of file SemaCUDA.cpp.
References CFP_HostDevice, CFP_Native, CFP_Never, CFP_SameSide, CFP_WrongSide, CTCK_InitGlobalVar, CurCUDATargetCtx, clang::Device, clang::SemaBase::getLangOpts(), clang::Global, clang::Host, clang::HostDevice, IdentifyTarget(), clang::InvalidTarget, clang::SemaCUDA::CUDATargetContext::Kind, and clang::SemaCUDA::CUDATargetContext::Target.
Referenced by clang::OverloadCandidateSet::BestViableFunction(), CheckCall(), EraseUnwantedMatches(), IsAllowedCall(), clang::isBetterOverloadCandidate(), and clang::Sema::isUsualDeallocationFunction().
CUDAFunctionTarget SemaCUDA::IdentifyTarget | ( | const FunctionDecl * | D, |
bool | IgnoreImplicitHDAttr = false |
||
) |
Determines whether the given function is a CUDA device/host/kernel/etc.
IdentifyTarget - Determine the CUDA compilation target for this function.
function.
Use this rather than examining the function's attributes yourself – you will get it wrong. Returns CUDAFunctionTarget::Host if D is null.
Definition at line 136 of file SemaCUDA.cpp.
References CurCUDATargetCtx, D, clang::Device, clang::Global, clang::Decl::hasAttr(), clang::Host, clang::HostDevice, clang::InvalidTarget, clang::Decl::isImplicit(), and clang::SemaCUDA::CUDATargetContext::Target.
Referenced by clang::Sema::ActOnExplicitInstantiation(), clang::Sema::BuildVAArgExpr(), checkAllowedInitializer(), clang::Sema::CheckCallingConvAttr(), clang::Sema::CheckFunctionTemplateSpecialization(), checkTargetOverload(), CurrentTarget(), DiagnoseBadTarget(), getCCForDeclaratorChunk(), GetDeclSpecTypeForDeclarator(), clang::Sema::getEmissionStatus(), GetFullTypeForDeclarator(), handleCallConvAttr(), IdentifyPreference(), IdentifyTarget(), inferTargetForImplicitSpecialMember(), IsOverloadOrOverrideImpl(), MarkVarDeclODRUsed(), RecordImplicitHostDeviceFuncUsedByDevice(), and clang::Sema::shouldIgnoreInHostDeviceCheck().
CUDAFunctionTarget SemaCUDA::IdentifyTarget | ( | const ParsedAttributesView & | Attrs | ) |
Definition at line 71 of file SemaCUDA.cpp.
References clang::Device, clang::Global, clang::Host, clang::HostDevice, and clang::InvalidTarget.
SemaCUDA::CUDAVariableTarget SemaCUDA::IdentifyTarget | ( | const VarDecl * | D | ) |
Determines whether the given variable is emitted on host or device side.
IdentifyTarget - Determine the CUDA compilation target for this variable.
Definition at line 165 of file SemaCUDA.cpp.
References CVT_Both, CVT_Device, CVT_Host, CVT_Unified, clang::Device, clang::Decl::getDeclContext(), clang::ValueDecl::getType(), clang::Global, clang::Decl::hasAttr(), clang::HostDevice, IdentifyTarget(), clang::VarDecl::isConstexpr(), clang::QualType::isConstQualified(), clang::Type::isCUDADeviceBuiltinSurfaceType(), and clang::Type::isCUDADeviceBuiltinTextureType().
bool SemaCUDA::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 base/field special members.
ClassDecl | the class for which the member is being created. |
CSM | the kind of special member. |
MemberDecl | the special member itself. |
ConstRHS | true if this is a copy operation with a const object on its RHS. |
Diagnose | true if this call should emit diagnostics. |
Definition at line 372 of file SemaCUDA.cpp.
References clang::Decl::addAttr(), clang::CXXRecordDecl::bases(), clang::Device, clang::SemaBase::Diag(), clang::RecordDecl::fields(), clang::Type::getAs(), clang::SemaBase::getASTContext(), clang::Decl::getAttr(), clang::ASTContext::getBaseElementType(), clang::RecordType::getDecl(), clang::DeclContext::getLexicalParent(), clang::Decl::getLocation(), clang::Sema::SpecialMemberOverloadResult::getMethod(), clang::CXXMethodDecl::getParent(), clang::Decl::hasAttr(), clang::Host, IdentifyTarget(), clang::CXXRecordDecl::isAbstract(), clang::Sema::LookupSpecialMember(), resolveCalleeCUDATargetConflict(), clang::SemaBase::SemaRef, and clang::CXXRecordDecl::vbases().
Referenced by clang::Sema::DeclareImplicitCopyAssignment(), clang::Sema::DeclareImplicitCopyConstructor(), clang::Sema::DeclareImplicitDefaultConstructor(), clang::Sema::DeclareImplicitDestructor(), clang::Sema::DeclareImplicitMoveAssignment(), clang::Sema::DeclareImplicitMoveConstructor(), DiagnoseBadTarget(), and clang::Sema::ShouldDeleteSpecialMember().
void SemaCUDA::inheritTargetAttrs | ( | FunctionDecl * | FD, |
const FunctionTemplateDecl & | TD | ||
) |
Copies target attributes from the template TD to the function FD.
Definition at line 1062 of file SemaCUDA.cpp.
References clang::FunctionTemplateDecl::getTemplatedDecl(), and clang::SemaBase::SemaRef.
Referenced by clang::Sema::CheckFunctionTemplateSpecialization().
|
inline |
Determines whether Caller may invoke Callee, based on their CUDA host/device attributes.
Returns false if the call is not allowed.
Note: Will return true for CFP_WrongSide calls. These may appear in semantically correct CUDA programs, but only if they're never codegen'ed.
Definition at line 186 of file SemaCUDA.h.
References CFP_Never, and IdentifyPreference().
bool SemaCUDA::isEmptyConstructor | ( | SourceLocation | Loc, |
CXXConstructorDecl * | CD | ||
) |
CD
can be considered empty according to CUDA (E.2.3.1 in CUDA 7.5 Programming guide). Definition at line 512 of file SemaCUDA.cpp.
References clang::Redeclarable< decl_type >::getFirstDecl(), clang::FunctionDecl::getNumParams(), clang::CXXMethodDecl::getParent(), clang::FunctionDecl::hasTrivialBody(), clang::CXXConstructorDecl::inits(), clang::Sema::InstantiateFunctionDefinition(), clang::FunctionDecl::isDefined(), clang::CXXRecordDecl::isDynamicClass(), clang::FunctionDecl::isTemplateInstantiation(), clang::FunctionDecl::isTrivial(), clang::TagDecl::isUnion(), Loc, and clang::SemaBase::SemaRef.
bool SemaCUDA::isEmptyDestructor | ( | SourceLocation | Loc, |
CXXDestructorDecl * | CD | ||
) |
Definition at line 550 of file SemaCUDA.cpp.
References clang::CXXRecordDecl::bases(), clang::RecordDecl::fields(), clang::Redeclarable< decl_type >::getFirstDecl(), clang::CXXMethodDecl::getParent(), clang::FunctionDecl::hasTrivialBody(), clang::Sema::InstantiateFunctionDefinition(), clang::FunctionDecl::isDefined(), clang::CXXRecordDecl::isDynamicClass(), clang::FunctionDecl::isTemplateInstantiation(), clang::FunctionDecl::isTrivial(), clang::TagDecl::isUnion(), Loc, and clang::SemaBase::SemaRef.
|
static |
Definition at line 314 of file SemaCUDA.cpp.
References D.
Referenced by checkTargetOverload(), clang::isBetterOverloadCandidate(), and RecordImplicitHostDeviceFuncUsedByDevice().
void SemaCUDA::MaybeAddConstantAttr | ( | VarDecl * | VD | ) |
May add implicit CUDAConstantAttr attribute to VD, depending on VD and current compilation settings.
Definition at line 805 of file SemaCUDA.cpp.
References clang::Decl::addAttr(), clang::SemaBase::getASTContext(), clang::SemaBase::getLangOpts(), clang::ValueDecl::getType(), clang::Decl::hasAttr(), clang::VarDecl::isConstexpr(), clang::QualType::isConstQualified(), clang::VarDecl::isFileVarDecl(), and clang::VarDecl::isStaticDataMember().
Referenced by clang::Sema::CheckCompleteVariableDeclaration().
void SemaCUDA::maybeAddHostDeviceAttrs | ( | FunctionDecl * | FD, |
const LookupResult & | Previous | ||
) |
May add implicit CUDAHostAttr and CUDADeviceAttr attributes to FD, depending on FD and the current compilation settings.
Definition at line 740 of file SemaCUDA.cpp.
References clang::Decl::addAttr(), clang::CUDA, D, clang::SemaBase::Diag(), clang::Decl::getAsFunction(), clang::SemaBase::getASTContext(), clang::FunctionDecl::getDescribedFunctionTemplate(), clang::SemaBase::getLangOpts(), clang::Decl::getLocation(), clang::Sema::getSourceManager(), clang::Decl::hasAttr(), clang::FunctionDecl::isConstexpr(), clang::FunctionDecl::isFunctionTemplateSpecialization(), clang::SourceManager::isInSystemHeader(), clang::Sema::IsOverload(), clang::FunctionDecl::isVariadic(), Previous, and clang::SemaBase::SemaRef.
Referenced by clang::Sema::ActOnFunctionDeclarator().
bool SemaCUDA::PopForceHostDevice | ( | ) |
Decrements our count of the number of times we've seen a pragma forcing functions to be host device.
Returns false if the count is 0 before incrementing, so you can emit an error.
Definition at line 46 of file SemaCUDA.cpp.
References clang::CUDA, and clang::SemaBase::getLangOpts().
void SemaCUDA::PushForceHostDevice | ( | ) |
Increments our count of the number of times we've seen a pragma forcing functions to be host device.
So long as this count is greater than zero, all functions encountered will be host device.
Definition at line 41 of file SemaCUDA.cpp.
References clang::CUDA, and clang::SemaBase::getLangOpts().
void SemaCUDA::RecordImplicitHostDeviceFuncUsedByDevice | ( | const FunctionDecl * | FD | ) |
Record FD
if it is a CUDA/HIP implicit host device function used on device side in device compilation.
Definition at line 706 of file SemaCUDA.cpp.
References clang::ASTContext::CUDAImplicitHostDeviceFunUsedByDevice, clang::Device, clang::SemaBase::getASTContext(), clang::Sema::getCurFunctionDecl(), clang::Global, clang::HostDevice, IdentifyTarget(), isImplicitHostDeviceFunction(), and clang::SemaBase::SemaRef.
Referenced by clang::Sema::MarkFunctionReferenced().
void SemaCUDA::SetLambdaAttrs | ( | CXXMethodDecl * | Method | ) |
Set device or host device attributes on the given lambda operator() method.
CUDA lambdas by default is host device function unless it has explicit host or device attribute.
Definition at line 997 of file SemaCUDA.cpp.
References clang::Decl::addAttr(), clang::CUDA, clang::SemaBase::getASTContext(), clang::SemaBase::getLangOpts(), and clang::Decl::hasAttr().
Referenced by clang::Sema::ActOnStartOfLambdaDefinition().
|
friend |
Definition at line 280 of file SemaCUDA.h.
|
friend |
Definition at line 281 of file SemaCUDA.h.
struct clang::SemaCUDA::CUDATargetContext clang::SemaCUDA::CurCUDATargetCtx |
llvm::DenseMap< CanonicalDeclPtr<const FunctionDecl>, FunctionDeclAndLoc> clang::SemaCUDA::DeviceKnownEmittedFns |
An inverse call graph, mapping known-emitted functions to one of their known-emitted callers (plus the location of the call).
Functions that we can tell a priori must be emitted aren't added to this map.
Definition at line 82 of file SemaCUDA.h.
Referenced by emitCallStackNotes().
llvm::DenseSet<FunctionDeclAndLoc> clang::SemaCUDA::LocsWithCUDACallDiags |
FunctionDecls and SourceLocations for which CheckCall has emitted a (maybe deferred) "bad call" diagnostic.
We use this to avoid emitting the same deferred diag twice.
Definition at line 73 of file SemaCUDA.h.
Referenced by CheckCall().