[clang] [HLSL] Rework semantic handling as attributes (PR #166796)

Steven Perron via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 10 09:01:58 PST 2025


================
@@ -718,8 +707,8 @@ CGHLSLRuntime::handleStructSemanticLoad(IRBuilder<> &B, const FunctionDecl *FD,
   llvm::Value *Aggregate = llvm::PoisonValue::get(Type);
   auto FieldDecl = RD->field_begin();
   for (unsigned I = 0; I < ST->getNumElements(); ++I) {
-    llvm::Value *ChildValue =
-        handleSemanticLoad(B, FD, ST->getElementType(I), *FieldDecl);
+    llvm::Value *ChildValue = handleSemanticLoad(B, FD, ST->getElementType(I),
+                                                 *FieldDecl, begin, end);
----------------
s-perron wrote:

At first glance, it looks like this is wrong because it is not obvious that `begin` is updated. If I have to go look at the declaration or definition of the `handleSemanticLoad` to understands what is happening, it is a sign that this could be better.

Off the top of my head I don't have a good suggestion other than have the function return one-past-the-last  semantic that it consumed. Have it return a pair.

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


More information about the cfe-commits mailing list