Description
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 issue tracks implementing 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.
Right now, the RootElement
data struct is defined in llvm::hlsl::rootsig
, and so it can't retain any clang specific diagnostic information (such as SourceLocation
). This issue proposes define 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 use the now 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.
With this abstraction, we are able to move the current resource range analysis that is contained in SemaHLSL
to the RootSignatueValidations
library to be re-used in the backend as well. Please see the sub-issue for a description.
AC:
- [ ] Define
RootSignatureElement
in thehlsl
namespace inSemaHLSL
(defined inSemaHLSL
becauseParse
has a dependency onSema
) - [ ] Update parsing logic to construct
RootSignatureElement
s and retain the source loction inParseHLSLRootSignature
- [ ] Update
SemaHLSL
when it constructs theRootSignatureDecl
to take the newRootSignatureElement
and store the underlyingRootElement
- [ ] Update the current tests to ensure the new
note
diagnostic is produced and that theSourceLocation
is seen
Sub-issues
Metadata
Metadata
Assignees
Labels
Type
Projects
Status