[clang] [FixIt] Improve Source Ranges and Fix-It Hints for Unused Lambda Captures #106445 (PR #117953)

via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 10 11:47:38 PST 2025


================
@@ -1184,8 +1196,10 @@ void Sema::ActOnLambdaExpressionAfterIntroducer(LambdaIntroducer &Intro,
       // for e.g., [n{0}] { }; <-- if no <initializer_list> is included.
       // FIXME: we should create the init capture variable and mark it invalid
       // in this case.
-      if (C->InitCaptureType.get().isNull())
-        continue;
+      if (C->InitCaptureType.get().isNull() && !C->Init.isUsable()) {
----------------
Sirraide wrote:

The `&& !C->Init.isUsable()` makes this `if` statement effectively dead code since it’s inside a check for `C->Init.isUsable()`, which means this is basically just `&& false`.

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


More information about the cfe-commits mailing list