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

Maria Fernanda GuimarĂ£es via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 29 09:30:31 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");
----------------
mafeguimaraes wrote:

You're right. I've updated Hover.cpp to skip pretty-printing only for HLSL RootSignatureAttr, with a comment explaining why, and removed the separate branch. HI.Name and HI.Documentation now flow through the existing code as you suggested.

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


More information about the cfe-commits mailing list