[clang] [HLSL][202x][0014] update groupshared parameter annotation warning (PR #242459)
Sarah Spall via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 13 16:59:29 PST 2026
https://github.com/spall updated https://github.com/llvm/llvm-project/pull/242459
>From 5c0f7d0aa95d1935907d7bac7cd8ca0fa919268e Mon Sep 17 00:00:00 2001
From: Sarah Spall <sarahspall at microsoft.com>
Date: Thu, 12 Nov 2026 17:14:26 -0800
Subject: [PATCH] update groupshared warning
---
clang/include/clang/Basic/DiagnosticSemaKinds.td | 6 +++---
clang/lib/Sema/SemaType.cpp | 2 +-
.../SemaHLSL/Language/groupsharedArgs/Pre202xWarning.hlsl | 8 ++++----
clang/test/SemaHLSL/group_shared.hlsl | 4 ++--
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 3346d311604ba..1f202872749ee 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -13952,9 +13952,9 @@ def err_hlsl_rootsignature_entry: Error<
def err_hlsl_operator_unsupported : Error<
"the '%select{&|*|->}0' operator is unsupported in HLSL">;
-def warn_hlsl_groupshared_202x : Warning<
- "support for groupshared parameter annotation not added until HLSL 202x">,
- InGroup<HLSLAvailability>;
+def ext_hlsl_groupshared_202x : ExtWarn<
+ "'groupshared' parameter annotation is an HLSL 202x extension">,
+ InGroup<HLSL202x>;
def warn_hlsl_groupshared_inout : Warning<
"passing groupshared variable to a parameter annotated with inout. "
"See 'groupshared' parameter annotation added in 202x">,
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index e16630ce9cd84..58adcbd16f4a8 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -9193,7 +9193,7 @@ static void processTypeAttrs(TypeProcessingState &state, QualType &type,
if (state.getDeclarator().getContext() == DeclaratorContext::Prototype) {
if (state.getSema().getLangOpts().getHLSLVersion() <
LangOptions::HLSL_202x)
- state.getSema().Diag(attr.getLoc(), diag::warn_hlsl_groupshared_202x);
+ state.getSema().Diag(attr.getLoc(), diag::ext_hlsl_groupshared_202x);
// Note: we don't check for the usage of HLSLParamModifiers in/out/inout
// here because the check in the AT_HLSLParamModifier case is sufficient
diff --git a/clang/test/SemaHLSL/Language/groupsharedArgs/Pre202xWarning.hlsl b/clang/test/SemaHLSL/Language/groupsharedArgs/Pre202xWarning.hlsl
index 0fe2962c3b446..d66ba2bf53361 100644
--- a/clang/test/SemaHLSL/Language/groupsharedArgs/Pre202xWarning.hlsl
+++ b/clang/test/SemaHLSL/Language/groupsharedArgs/Pre202xWarning.hlsl
@@ -3,7 +3,7 @@
groupshared uint SharedData;
void fn1(groupshared uint Sh) {
-// expected-warning at -1{{support for groupshared parameter annotation not added until HLSL 202x}}
+// expected-warning at -1{{'groupshared' parameter annotation is an HLSL 202x extension}}
// expected-warning@*{{support for HLSL language version hlsl2018 is incomplete, recommend using hlsl202x instead}}
Sh = 5;
}
@@ -14,8 +14,8 @@ void fnT(T A, T B) {
}
template void fnT<groupshared int>(groupshared int A, groupshared int B);
-// expected-warning at -1{{support for groupshared parameter annotation not added until HLSL 202x}}
-// expected-warning at -2{{support for groupshared parameter annotation not added until HLSL 202x}}
+// expected-warning at -1{{'groupshared' parameter annotation is an HLSL 202x extension}}
+// expected-warning at -2{{'groupshared' parameter annotation is an HLSL 202x extension}}
void fn2() {
fn1(SharedData);
@@ -23,6 +23,6 @@ void fn2() {
template<typename T>
T fn3(groupshared T A) {
-// expected-warning at -1{{support for groupshared parameter annotation not added until HLSL 202x}}
+// expected-warning at -1{{'groupshared' parameter annotation is an HLSL 202x extension}}
return A;
}
diff --git a/clang/test/SemaHLSL/group_shared.hlsl b/clang/test/SemaHLSL/group_shared.hlsl
index dd253cafbd4dc..6c748a006c0be 100644
--- a/clang/test/SemaHLSL/group_shared.hlsl
+++ b/clang/test/SemaHLSL/group_shared.hlsl
@@ -63,7 +63,7 @@ template<typename T>
// it is caused by return type check is after pointer check which is acceptable.
// expected-error at +1 {{pointers are unsupported in HLSL}}
groupshared void (*fp)();
-// expected-warning at +2 {{support for groupshared parameter annotation not added until HLSL 202x}}
+// expected-warning at +2 {{'groupshared' parameter annotation is an HLSL 202x extension}}
// expected-error at +1 {{pointers are unsupported in HLSL}}
void (*fp2)(groupshared float);
// NOTE: HLSL not support trailing return types.
@@ -98,5 +98,5 @@ _Static_assert(S3<groupshared float>::value, "");
// Can you overload based on the qualifier?
void func(float f) {}
-// expected-warning at +1 {{support for groupshared parameter annotation not added until HLSL 202x}}
+// expected-warning at +1 {{'groupshared' parameter annotation is an HLSL 202x extension}}
void func(groupshared float f) {}
More information about the cfe-commits
mailing list