[all-commits] [llvm/llvm-project] 7ecb37: [HLSL][RootSignature] Retain `SourceLocation` of `...
Finn Plummer via All-commits
all-commits at lists.llvm.org
Fri Jul 11 18:33:37 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 7ecb37b703b7c675d1be6c4194c50f6f8dd9ac9c
https://github.com/llvm/llvm-project/commit/7ecb37b703b7c675d1be6c4194c50f6f8dd9ac9c
Author: Finn Plummer <finn.c.plum at gmail.com>
Date: 2025-07-11 (Fri, 11 Jul 2025)
Changed paths:
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/include/clang/Parse/ParseHLSLRootSignature.h
M clang/include/clang/Sema/SemaHLSL.h
M clang/lib/Parse/ParseDeclCXX.cpp
M clang/lib/Parse/ParseHLSLRootSignature.cpp
M clang/lib/Sema/SemaHLSL.cpp
M clang/test/SemaHLSL/RootSignature-resource-ranges-err.hlsl
M clang/unittests/Parse/ParseHLSLRootSignatureTest.cpp
M llvm/include/llvm/Frontend/HLSL/RootSignatureValidations.h
M llvm/lib/Frontend/HLSL/RootSignatureValidations.cpp
Log Message:
-----------
[HLSL][RootSignature] Retain `SourceLocation` of `RootElement` for `SemaHLSL` diagnostics (#147115)
At the moment, when we report diagnostics from `SemaHLSL` we only
provide the source location of the root signature attr. This allows for
significantly less helpful diagnostics (for eg. reporting resource range
overlaps).
This pr implements a way to retain the source location of a root element
when it is parsed, so that we can output the `SourceLocation` of each
root element that causes the overlap in the diagnostics during semantic
analysis.
This pr defines a wrapper struct `clang::hlsl::RootSignatureElement` in
`SemaHLSL` that will contain the underlying `RootElement` and can hold
any additional diagnostic information. This struct will be what is used
in `HLSLRootSignatureParser` and in `SemaHLSL`. Then the diagnostic
information will be stripped and the underlying element will be stored
in the `RootSignatureDecl`.
For the reporting of diagnostics, we can now use the retained
`SourceLocation` of each `RootElement` when reporting the range overlap,
and we can add a `note` diagnostic to highlight the other root element
as well.
- Defines `RootSignatureElement` in the `hlsl` namespace in `SemaHLSL`
(defined in `SemaHLSL` because `Parse` has a dependency on `Sema`)
- Updates parsing logic to construct `RootSignatureElement`s and retain
the source loction in `ParseHLSLRootSignature`
- Updates `SemaHLSL` when it constructs the `RootSignatureDecl` to take
the new `RootSignatureElement` and store the underlying `RootElement`
- Updates the current tests to ensure the new `note` diagnostic is
produced and that the `SourceLocation` is seen
- Slight update to the `RootSignatureValidations` api to ensure the
caller sorts and owns the memory of the passed in `RangeInfo`
- Adds a test to demonstrate the `SourceLocation` of both elements being
correctly pointed out
Resolves: https://github.com/llvm/llvm-project/issues/145819
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list