[llvm-branch-commits] [clang] [llvm] [HLSL][RootSignature] Retain `SourceLocation` of `RootElement` for `SemaHLSL` diagnostics (PR #147115)

Finn Plummer via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jul 9 08:17:16 PDT 2025


================
@@ -32,6 +32,9 @@ struct RangeInfo {
   llvm::dxil::ResourceClass Class;
   uint32_t Space;
   llvm::dxbc::ShaderVisibility Visibility;
+
+  // The index retains its original position before being sorted by group.
+  size_t Index;
----------------
inbelic wrote:

Okay, so I messed around with this a bit yesterday.

The problem is that when we store a `RangeInfo` into the underlying `IntervalMap`, [here](https://github.com/llvm/llvm-project/blob/7f19795d36aeca72dd8e6da56498496c00ad204b/llvm/include/llvm/Frontend/HLSL/RootSignatureValidations.h#L60). We need to either store the associated index with it (as a member, or, as a `std::pair<size_t, const RangeInfo *>`, or, we will need to let the caller define an external mapping of `const RangeInfo *` -> `size_t`.

So I don't think we really solve what we want to by passing it in as a `std::pair`.

Here is a quick prototype of having an external mapping: https://github.com/inbelic/llvm-project/pull/1/files.

What do you think is the right approach? I think having the index as a member might be the simplest interface.

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


More information about the llvm-branch-commits mailing list