[clang-tools-extra] [clangd][HLSL] Prevent RootSignature internal identifier leak on hover (PR #214955)

Aleksandr Platonov via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 21 05:12:17 PDT 2026


================
@@ -5431,6 +5431,23 @@ TEST(Hover, HLSLRegisterAttributeRange) {
   }
 }
 
+TEST(Hover, HLSLRootSignature) {
+  Annotations T(
+      R"hlsl(
+        #define RS_CBV "CBV(b0)"
+        [^RootSignature(RS_CBV)]
+        void main() {}
+      )hlsl",
+      Annotations::Markers().setRangeBegin("{{").setRangeEnd("}}"));
+
+  TestTU TU = TestTU::withCode(T.code());
+  configureHLSL(TU);
+  auto AST = TU.build();
+  auto H = getHover(AST, T.point(), format::getLLVMStyle(), nullptr);
+  ASSERT_TRUE(H) << "Hover should have been returned for RootSignature!";
+  EXPECT_EQ(H->Name, "RootSignature");
----------------
ArcsinX wrote:

So, can we fix this with only single-line change as I mentioned in other inline-comments? I.e.
- we don't need  to set `HI.Name` to `"RootSignature"` explicitly because `HI.Name = A->getSpelling();` does the same
- We don't need one more `HI.Documentation = Attr::getDocumentation(A->getKind()).str();` because we have the same line in original code

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


More information about the cfe-commits mailing list