[clangd][HLSL] RootSignature Hover Leaking Internal Identifier
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
## Expected behavior
Hovering over `[RootSignature("RS_CBV")]` should display the documentation for the` RootSignature` attribute without exposing internal compiler details.
## Observed behavior
Hover shows the documentation but also leaks the definition.
## Reproduction
```hlsl
#define RS_CBV "CBV(b0)"
[RootSignature(RS_CBV)]
[numthreads(1, 1, 1)]
void CS_ValidCBV(uint3 tid : SV_DispatchThreadID) {}
```
Hovering over `RootSignature` shows the right documentation, but also shows something like `[RootSignature("__hlsl_rootsig_decl_5043168244180965862")]`.
## Root cause
The HLSL parser processes the string literal argument of `RootSignature` and produces an internal `IdentifierInfo` with a generated name. This generated identifier is stored in `RootSignatureAttr` via `getSignatureIdent()`. The original string literal is discarded after parsing and not stored in the attribute. The generic hover path calls `A->printPretty()`, which prints the stored identifier.
## Proposed fix
Add a `dyn_cast` branch in `getHoverContents(const Attr *A)` that sets `HI.Name` and `HI.Documentation` directly, skipping `printPretty`.
Contributor guide
Research direction
Start at getHoverContents(const Attr *A) and inspect the existing generic hover handling for attributes, along with RootSignatureAttr and getSignatureIdent(). Add the RootSignature-specific hover behavior described in the issue. Done means RootSignature hover still shows its documentation without exposing the generated internal identifier.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100