19 #include "llvm/ADT/Optional.h"
20 #include "llvm/ADT/SmallVector.h"
21 using namespace clang;
29 <<
"cudaConfigureCall");
36 return ActOnCallExpr(S, ConfigDR, LLLLoc, ExecConfig, GGGLoc,
nullptr,
42 if (D->
hasAttr<CUDAInvalidTargetAttr>())
45 if (D->
hasAttr<CUDAGlobalAttr>())
48 if (D->
hasAttr<CUDADeviceAttr>()) {
52 }
else if (D->
hasAttr<CUDAHostAttr>()) {
100 if (!InDeviceMode && CalleeTarget !=
CFT_Host)
102 if (InDeviceMode && CalleeTarget !=
CFT_Device) {
108 diag::warn_host_calls_from_host_device)
140 *ResolvedTarget = Target2;
142 *ResolvedTarget = Target1;
143 }
else if (Target1 != Target2) {
146 *ResolvedTarget = Target1;
167 for (
const auto &B : ClassDecl->
bases()) {
168 if (!B.isVirtual()) {
174 for (
const auto &VB : ClassDecl->
vbases()) {
175 Bases.push_back(&VB);
179 for (
const auto *B : Bases) {
194 if (!SMOR || !SMOR->getMethod()) {
199 if (!InferredTarget.hasValue()) {
200 InferredTarget = BaseMethodTarget;
203 InferredTarget.getValue(), BaseMethodTarget,
204 InferredTarget.getPointer());
205 if (ResolutionError) {
208 diag::note_implicit_member_target_infer_collision)
209 << (
unsigned)CSM << InferredTarget.getValue() << BaseMethodTarget;
211 MemberDecl->
addAttr(CUDAInvalidTargetAttr::CreateImplicit(
Context));
218 for (
const auto *F : ClassDecl->
fields()) {
219 if (F->isInvalidDecl()) {
232 ConstRHS && !F->isMutable(),
238 if (!SMOR || !SMOR->getMethod()) {
244 if (!InferredTarget.hasValue()) {
245 InferredTarget = FieldMethodTarget;
248 InferredTarget.getValue(), FieldMethodTarget,
249 InferredTarget.getPointer());
250 if (ResolutionError) {
253 diag::note_implicit_member_target_infer_collision)
254 << (
unsigned)CSM << InferredTarget.getValue()
255 << FieldMethodTarget;
257 MemberDecl->
addAttr(CUDAInvalidTargetAttr::CreateImplicit(
Context));
263 if (InferredTarget.hasValue()) {
264 if (InferredTarget.getValue() ==
CFT_Device) {
266 }
else if (InferredTarget.getValue() ==
CFT_Host) {
Defines the clang::ASTContext interface.
const LangOptions & getLangOpts() const
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
bool inferCUDATargetForImplicitSpecialMember(CXXRecordDecl *ClassDecl, CXXSpecialMember CSM, CXXMethodDecl *MemberDecl, bool ConstRHS, bool Diagnose)
SpecialMemberOverloadResult * LookupSpecialMember(CXXRecordDecl *D, CXXSpecialMember SM, bool ConstArg, bool VolatileArg, bool RValueThis, bool ConstThis, bool VolatileThis)
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr, bool IsExecConfig=false)
ExprResult ActOnCUDAExecConfigExpr(Scope *S, SourceLocation LLLLoc, MultiExprArg ExecConfig, SourceLocation GGGLoc)
field_range fields() const
RecordDecl * getDecl() const
std::string getNameAsString() const
bool isAbstract() const
Determine whether this class has a pure virtual function.
CXXSpecialMember
Kinds of C++ special members.
bool CheckCUDATarget(const FunctionDecl *Caller, const FunctionDecl *Callee)
Defines the clang::Preprocessor interface.
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
CUDAFunctionTarget IdentifyCUDATarget(const FunctionDecl *D)
IdentifyCUDATarget - Determine the CUDA compilation target for this function.
Represents a static or instance method of a struct/union/class.
static bool resolveCalleeCUDATargetConflict(Sema::CUDAFunctionTarget Target1, Sema::CUDAFunctionTarget Target2, Sema::CUDAFunctionTarget *ResolvedTarget)
FunctionDecl * getcudaConfigureCallDecl()
Represents a C++ struct/union/class.
A reference to a declared variable, function, enum, etc. [C99 6.5.1p2].
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool OdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2, C99 6.9p3)
An l-value expression is a reference to an object with independent storage.
SourceLocation getLocation() const
base_class_range vbases()
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.