[clang] [clang] Fix device_kernel attribute crash on unsupported targets when not using AMDGPU spelling (PR #161687)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 2 08:28:00 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,c -- clang/lib/Sema/SemaDeclAttr.cpp clang/lib/Sema/SemaType.cpp clang/test/Sema/callingconv.c
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 3ae36d44f..8e51faa98 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -5204,7 +5204,8 @@ static void handleCallConvAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
static void handleDeviceKernelAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
const auto *FD = dyn_cast_or_null<FunctionDecl>(D);
bool IsFunctionTemplate = FD && FD->getDescribedFunctionTemplate();
- if (!S.getLangOpts().OpenCL && !S.getLangOpts().CUDA && !DeviceKernelAttr::isAMDGPUSpelling(AL)) {
+ if (!S.getLangOpts().OpenCL && !S.getLangOpts().CUDA &&
+ !DeviceKernelAttr::isAMDGPUSpelling(AL)) {
// This is already diagnosed for AMDGPU in getCCForDeclaratorChunk
S.Diag(AL.getLoc(), diag::warn_cconv_unsupported)
<< AL << (int)Sema::CallingConventionIgnoredReason::ForThisTarget;
``````````
</details>
https://github.com/llvm/llvm-project/pull/161687
More information about the cfe-commits
mailing list