Skip to content

[HLSL][RootSignature] Retain SourceLocation of RootElement for use in Diags with SemaHLSL #145819

Open
0 of 1 issue completed
@inbelic

Description

@inbelic

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 the hlsl namespace in SemaHLSL (defined in SemaHLSL because Parse has a dependency on Sema)
  • [ ] Update parsing logic to construct RootSignatureElements and retain the source loction in ParseHLSLRootSignature
  • [ ] Update SemaHLSL when it constructs the RootSignatureDecl to take the new RootSignatureElement and store the underlying RootElement
  • [ ] Update the current tests to ensure the new note diagnostic is produced and that the SourceLocation is seen

Sub-issues

Metadata

Metadata

Assignees

Labels

HLSLHLSL Language Support

Type

No type

Projects

Status

Planning

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions