@@ -435,6 +435,14 @@ enum class CXXSpecialMemberKind {
435
435
Invalid
436
436
};
437
437
438
+ enum class CUDAFunctionTarget {
439
+ Device,
440
+ Global,
441
+ Host,
442
+ HostDevice,
443
+ InvalidTarget
444
+ };
445
+
438
446
/// Sema - This implements semantic analysis and AST building for C.
439
447
/// \nosubgrouping
440
448
class Sema final : public SemaBase {
@@ -3663,20 +3671,12 @@ class Sema final : public SemaBase {
3663
3671
InternalLinkageAttr *mergeInternalLinkageAttr(Decl *D,
3664
3672
const InternalLinkageAttr &AL);
3665
3673
3666
- enum CUDAFunctionTarget {
3667
- CFT_Device,
3668
- CFT_Global,
3669
- CFT_Host,
3670
- CFT_HostDevice,
3671
- CFT_InvalidTarget
3672
- };
3673
-
3674
3674
/// Check validaty of calling convention attribute \p attr. If \p FD
3675
3675
/// is not null pointer, use \p FD to determine the CUDA/HIP host/device
3676
3676
/// target. Otherwise, it is specified by \p CFT.
3677
- bool CheckCallingConvAttr(const ParsedAttr &attr, CallingConv &CC,
3678
- const FunctionDecl *FD = nullptr,
3679
- CUDAFunctionTarget CFT = CFT_InvalidTarget );
3677
+ bool CheckCallingConvAttr(
3678
+ const ParsedAttr &attr, CallingConv &CC, const FunctionDecl *FD = nullptr,
3679
+ CUDAFunctionTarget CFT = CUDAFunctionTarget::InvalidTarget );
3680
3680
3681
3681
void AddParameterABIAttr(Decl *D, const AttributeCommonInfo &CI,
3682
3682
ParameterABI ABI);
@@ -12967,7 +12967,8 @@ class Sema final : public SemaBase {
12967
12967
/// Example usage:
12968
12968
///
12969
12969
/// // Variable-length arrays are not allowed in CUDA device code.
12970
- /// if (CUDADiagIfDeviceCode(Loc, diag::err_cuda_vla) << CurrentCUDATarget())
12970
+ /// if (CUDADiagIfDeviceCode(Loc, diag::err_cuda_vla)
12971
+ /// << llvm::to_underlying(CurrentCUDATarget()))
12971
12972
/// return ExprError();
12972
12973
/// // Otherwise, continue parsing as normal.
12973
12974
SemaDiagnosticBuilder CUDADiagIfDeviceCode(SourceLocation Loc,
@@ -12983,7 +12984,7 @@ class Sema final : public SemaBase {
12983
12984
/// function.
12984
12985
///
12985
12986
/// Use this rather than examining the function's attributes yourself -- you
12986
- /// will get it wrong. Returns CFT_Host if D is null.
12987
+ /// will get it wrong. Returns CUDAFunctionTarget::Host if D is null.
12987
12988
CUDAFunctionTarget IdentifyCUDATarget(const FunctionDecl *D,
12988
12989
bool IgnoreImplicitHDAttr = false);
12989
12990
CUDAFunctionTarget IdentifyCUDATarget(const ParsedAttributesView &Attrs);
@@ -13008,7 +13009,7 @@ class Sema final : public SemaBase {
13008
13009
/// Define the current global CUDA host/device context where a function may be
13009
13010
/// called. Only used when a function is called outside of any functions.
13010
13011
struct CUDATargetContext {
13011
- CUDAFunctionTarget Target = CFT_HostDevice ;
13012
+ CUDAFunctionTarget Target = CUDAFunctionTarget::HostDevice ;
13012
13013
CUDATargetContextKind Kind = CTCK_Unknown;
13013
13014
Decl *D = nullptr;
13014
13015
} CurCUDATargetCtx;
0 commit comments