[clang] [HLSL] Add support for groupshared args (PR #181886)

Sarah Spall via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 4 12:49:57 PST 2026


================
@@ -788,6 +788,18 @@ static void instantiateDependentHLSLParamModifierAttr(
   ParmVarDecl *NewParm = cast<ParmVarDecl>(New);
   NewParm->addAttr(Attr->clone(S.getASTContext()));
 
+  // If this is groupshared don't change the type because it will assert
+  // below. In this case we might have already produced an error but we
+  // must produce one here again because of all the ways templates can
+  // be used.
+  if (const auto *RT = NewParm->getType()->getAs<LValueReferenceType>()) {
+    if (RT->getPointeeType().getAddressSpace() == LangAS::hlsl_groupshared) {
+      S.Diag(Attr->getLoc(), diag::err_hlsl_attr_incompatible)
+          << Attr << "'groupshared'";
----------------
spall wrote:

Maybe. I'll try that.

https://github.com/llvm/llvm-project/pull/181886


More information about the cfe-commits mailing list