[PATCH] D135060: [HLSL] Add groupshare address space.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 19 12:12:18 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/lib/Sema/SemaDecl.cpp:10083
     }
+    // HLSL not support address space on a function return type declaration.
+    LangAS AddressSpace = NewFD->getReturnType().getAddressSpace();
----------------



================
Comment at: clang/lib/Sema/SemaLambda.cpp:977
+      if (!RetTy.isNull()) {
+        // HLSL not support address space on a lambda return type declaration.
+        LangAS AddressSpace = RetTy.getAddressSpace();
----------------



================
Comment at: clang/test/ParserHLSL/group_shared_202x.hlsl:5-6
+
+// expected-error at +1 {{return type cannot be qualified with address space}}
+auto l = []() -> groupshared void {};
+// expected-error at +1 {{expected a type}}
----------------
One test I think we need in SemaCXX for this is what happens when the lambda return type (or function return type) is deduced. e.g.,
```
extern groupshared float f;

auto func() {
  return f;
}

void other() {
  [&]() { return f; };
}
```
Does use of `return f` cause us to deduce a return type that's annotated with `groupshared` or does that get stripped off thanks to lvalue to rvalue conversions and so we deduce `float`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135060/new/

https://reviews.llvm.org/D135060



More information about the cfe-commits mailing list