[clang-tools-extra] [clangd] Add designator hints for parenthesis aggregate initialization (PR #170642)
Mythreya Kuricheti via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 5 23:55:15 PST 2025
================
@@ -1822,6 +1821,37 @@ TEST(DesignatorHints, NoCrash) {
ExpectedHint{".b=", "b"});
}
+TEST(DesignatorHints, BasicParenInit) {
+ assertDesignatorHints(R"cpp(
+ struct S {
+ int x;
+ int y;
+ int z;
+ };
+ S s ($x[[1]], $y[[2+2]], $z[[4]]);
+ )cpp",
+ ExpectedHint{".x=", "x"}, ExpectedHint{".y=", "y"},
+ ExpectedHint{".z=", "z"});
+}
+
+TEST(DesignatorHints, BasicParenInitDerived) {
+ assertDesignatorHints(R"cpp(
+ struct S1 {
+ int a;
+ int b;
+ };
+
+ struct S2 : S1 {
+ int c;
+ int d;
+ };
+ S2 s2 ({$a[[0]], $b[[0]]}, $c[[0]], $d[[0]]);
+ )cpp",
+ // ExpectedHint{"S1:", "S1"},
----------------
MythreyaK wrote:
<img width="1349" height="961" alt="image" src="https://github.com/user-attachments/assets/d876fe3e-4203-4c71-a5d6-d6d8222702e2" />
https://github.com/llvm/llvm-project/pull/170642
More information about the cfe-commits
mailing list