[clang-tools-extra] [clangd] Add inlay hints for default function arguments (PR #95712)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 17 21:38:29 PDT 2024


================
@@ -1497,6 +1497,47 @@ TEST(DefaultArguments, Smoke) {
               ExpectedHint{"A: ", "explicit", Left});
 }
 
+TEST(DefaultArguments, WithoutParameterNames) {
+  Config Cfg;
+  Cfg.InlayHints.Parameters = false; // To test just default args this time
+  Cfg.InlayHints.DeducedTypes = false;
+  Cfg.InlayHints.Designators = false;
+  Cfg.InlayHints.BlockEnd = false;
+
+  Cfg.InlayHints.DefaultArguments = true;
+  WithContextValue WithCfg(Config::Key, std::move(Cfg));
+
+  const auto *Code = R"cpp(
+    struct Baz {
+      Baz(float a = 3 //
+                    + 2);
+    };
+    struct Foo {
+      Foo(int, Baz baz = //
+              Baz{$unnamed[[}]]
----------------
HighCommander4 wrote:

nit: unnamed --> abbreviated? (the parameter itself is named here)

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


More information about the cfe-commits mailing list