[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:03:27 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()) {
----------------
cor3ntin wrote:
> 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.
Alternatively, I guess I can change the order of operation to ensure Var is never null here, and that would probably be cleaner!


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