[clang] [llvm] [HLSL][SPIR-V] Add hlsl_private address space for SPIR-V (PR #133464)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 9 08:43:18 PDT 2025


================
@@ -6888,6 +6888,42 @@ static void SetNestedNameSpecifier(Sema &S, DeclaratorDecl *DD, Declarator &D) {
   DD->setQualifierInfo(SS.getWithLocInContext(S.Context));
 }
 
+void Sema::deduceHLSLAddressSpace(VarDecl *Decl) {
+  // The variable already has an address space (groupshared for ex).
+  if (Decl->getType().hasAddressSpace())
+    return;
+
+  if (Decl->getType()->isDependentType())
+    return;
+
+  QualType Type = Decl->getType();
+  if (Type->isSamplerT() || Type->isVoidType())
+    return;
+
+  // Template instantiations can lack definition. In such case,
+  // we cannot deduce the AS.
+  // FIXME: figure out why RWBuffer<float> yields such declaration.
----------------
Keenuts wrote:

It was when using RWBuffers, but looks like I cannot reproduce since I rebased. Probably one of the RWBuffer related fixes that landed since.
Removed this part of the code!

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


More information about the llvm-commits mailing list