[llvm-branch-commits] [clang] [HLSL] Add RWBuffer::Load(Index) (PR #117018)

Justin Bogner via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Nov 22 01:11:51 PST 2024


================
@@ -189,12 +189,28 @@ struct BuiltinTypeDeclBuilder {
   BuiltinTypeDeclBuilder &addArraySubscriptOperators(Sema &S) {
     if (Record->isCompleteDefinition())
       return *this;
-    addArraySubscriptOperator(S, true);
-    addArraySubscriptOperator(S, false);
+    ASTContext &AST = Record->getASTContext();
+    DeclarationName Subscript =
+        AST.DeclarationNames.getCXXOperatorName(OO_Subscript);
+    addHandleAccessFunction(S, Subscript, /*IsConst=*/true, /*IsRef=*/true);
+    addHandleAccessFunction(S, Subscript, /*IsConst=*/false, /*IsRef=*/true);
+    return *this;
+  }
+
+  BuiltinTypeDeclBuilder &addLoadMethods(Sema &S) {
----------------
bogner wrote:

It's named `addLoadMethods` because I intend it to add the rest of the load methods (notably, the one with the `status` parameter). That method will look differently to the one we're adding here though, as it will need to call a builtin that does the load directly and also returns the status bit.

I hope that we can add the other load methods here too, but if not we can change the naming as needed.

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


More information about the llvm-branch-commits mailing list