[llvm-branch-commits] [clang] [HLSL] Add codegen for accessing resource members of a struct (PR #187127)

Justin Bogner via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Mar 30 10:46:38 PDT 2026


================
@@ -96,24 +97,113 @@ void addRootSignatureMD(llvm::dxbc::RootSignatureVersion RootSigVer,
   RootSignatureValMD->addOperand(MDVals);
 }
 
+// Gived a MemberExpr of a resource or resource array type, find the parent
+// VarDecl of the struct or class instance that contains this resource and
+// build the full resource name based on the member access path.
+//
+// For example, for a member access like "myStructArray[0].memberA",
+// this function will find the VarDecl of "myStructArray" and use the
+// EmbeddedResourceNameBuilder to build the resource name
+// "myStructArray.0.memberA".
+static const VarDecl *getStructResourceParentDeclAndBuildName(
+    const MemberExpr *ME, EmbeddedResourceNameBuilder &NameBuilder) {
----------------
bogner wrote:

I don't have a good suggestion for how to do otherwise here since separating these would be pretty awkward, but functions named `doXAndY` always make me a little uncomfortable.

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


More information about the llvm-branch-commits mailing list