[clang] [HLSL] Apply NoRecurse attrib to all HLSL functions (PR #105907)
Greg Roth via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 28 13:24:33 PDT 2024
================
@@ -1064,13 +1064,17 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
// OpenCL C 2.0 v2.2-11 s6.9.i:
// Recursion is not supported.
//
+ // HLSL
+ // Recursion is not supported.
+ //
// SYCL v1.2.1 s3.10:
// kernels cannot include RTTI information, exception classes,
// recursive code, virtual functions or make use of C++ libraries that
// are not compiled for the device.
- if (FD && ((getLangOpts().CPlusPlus && FD->isMain()) ||
- getLangOpts().OpenCL || getLangOpts().SYCLIsDevice ||
- (getLangOpts().CUDA && FD->hasAttr<CUDAGlobalAttr>())))
+ if (FD &&
+ ((getLangOpts().CPlusPlus && FD->isMain()) || getLangOpts().OpenCL ||
+ getLangOpts().HLSL || getLangOpts().SYCLIsDevice ||
----------------
pow2clk wrote:
This attribute is descriptive and used in a few places to determine if recursion is expected or not. There is not actually any place that checks for recursion and produces an error for HLSL nor for OpenCL. There is a check for it when inlining takes place, but that's too late for diagnostics. #105244 is meant to address this problem.
https://github.com/llvm/llvm-project/pull/105907
More information about the cfe-commits
mailing list