arphaman added inline comments.

================
Comment at: lib/Sema/AnalysisBasedWarnings.cpp:530
+  // Don't need to mark Objective-C methods or blocks since the undefined
+  // behaviour optimization isn't used for them.
+}
----------------
mehdi_amini wrote:
> Quuxplusone wrote:
> > This seems like a trap waiting to spring on someone, unless there's a 
> > technical reason that methods and blocks cannot possibly use the same 
> > optimization paths as regular functions. ("Nobody's gotten around to 
> > implementing it yet" is the most obvious nontechnical reason for the 
> > current difference.) Either way, I'd expect this patch to include test 
> > cases for both methods and blocks, to verify that the behavior you expect 
> > is actually the behavior that happens. Basically, it ought to have a 
> > regression test targeting the regression that I'm predicting is going to 
> > spring on someone as soon as they implement optimizations for methods and 
> > blocks.
> > 
> > Also, one dumb question: what about C++ lambdas? are they FunctionDecls 
> > too? test case?
> > This seems like a trap waiting to spring on someone, unless there's a 
> > technical reason that methods and blocks cannot possibly use the same 
> > optimization paths as regular functions.
> 
> The optimization path in LLVM is the same. I think the difference lies in 
> clang IRGen: there is no "unreachable" generated for these so the optimizer 
> can't be aggressive. So this patch is not changing anything for Objective-C 
> methods and blocks, and I expect that we *already* have a test that covers 
> this behavior (if not we should add one).
Mehdi is right, the difference is in IRGen - methods and blocks never get the 
trap and unreachable IR return optmisation. I don't think we have a test for 
this though, so I added a regression test case that verifies this.


Repository:
  rL LLVM

https://reviews.llvm.org/D27163



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

Reply via email to