[PATCH] D119136: [clang] Implement Change scope of lambda trailing-return-type

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 13 10:00:17 PDT 2022


cor3ntin added inline comments.


================
Comment at: clang/lib/Sema/SemaLambda.cpp:1127-1132
+      auto it = LSI->DelayedCaptures.end();
+      if (Var)
+        it = llvm::find_if(LSI->DelayedCaptures, [&Var](auto &&Pair) {
+          return Pair.second.Var == Var;
+        });
+      if (it != LSI->DelayedCaptures.end()) {
----------------
aaron.ballman wrote:
> ChuanqiXu wrote:
> > I feel like my suggested change is simpler.
> +1 to this suggestion being a bit easier to read.
With that changes, a capture that is not in the delayed capture list forces us to go through the list of capture anyway, which seems like a waste.
So this is not just about readability. it should still work,  and only really matter for error cases, but it's still not identical code.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119136/new/

https://reviews.llvm.org/D119136



More information about the cfe-commits mailing list