[clang] [clang-tools-extra] [clangd][HLSL] Fix register attribute source range for hover inside arguments (PR #212881)
Maria Fernanda GuimarĂ£es via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 3 11:53:06 PDT 2026
================
@@ -5311,6 +5311,30 @@ TEST(Hover, FunctionParameters) {
}
}
+TEST(Hover, HLSLRegisterAttributeRange) {
+ Annotations T(R"cpp(
+ Texture2D tex : [[^register]]([[^t1]]);
+ )cpp");
+
+ TestTU TU = TestTU::withCode(T.code());
+ TU.Filename = "TestTU.hlsl";
+ TU.ExtraArgs = {
+ "-x",
+ "hlsl",
+ "--target=dxil-pc-shadermodel6.3-library",
+ };
+
+ auto AST = TU.build();
+
+ for (const auto &P : T.points()) {
----------------
mafeguimaraes wrote:
`points()` returns every `^` marked position in the source, in order, not tied to a fixed count. Here there are 2: one on `register`, one on `t1`. We iterate both because that's the regression itself: before the fix only `register` resolved to a hover, `t1` didn't. Both should now resolve to the same attribute.
https://github.com/llvm/llvm-project/pull/212881
More information about the cfe-commits
mailing list