aaron.ballman 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:
> 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!
Ah, thank you for pointing out that this was also about performance. If you're 
able to clean it up by changing the order of operations, that'd be good, but if 
it turns into a slog, I don't insist.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119136

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to