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

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 2 22:06:38 PDT 2024


================
@@ -372,6 +383,38 @@ maybeDropCxxExplicitObjectParameters(ArrayRef<const ParmVarDecl *> Params) {
   return Params;
 }
 
+llvm::StringRef getLambdaCaptureName(const LambdaCapture &Capture) {
+  switch (Capture.getCaptureKind()) {
+  case LCK_This:
+  case LCK_StarThis:
+    return llvm::StringRef{"this"};
+  case LCK_ByCopy:
+  case LCK_ByRef:
+  case LCK_VLAType:
----------------
HighCommander4 wrote:

I'm not exactly sure what a VLA capture is, but looking at the usage, e.g. its construction [here](https://searchfox.org/llvm/rev/60ed1043d76554a48f66fc0c15fb97ac8b3af7b0/clang/lib/Sema/SemaLambda.cpp#2179) with `Var = nullptr`, and [this assertion](https://searchfox.org/llvm/rev/60ed1043d76554a48f66fc0c15fb97ac8b3af7b0/clang/lib/AST/ExprCXX.cpp#1240), it's not valid to call `getCapturedVar()` for it.

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


More information about the cfe-commits mailing list