[PATCH] D33525: [ThinLTO] Migrate ThinLTOBitcodeWriter to the new PM.

Tim Shen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 24 17:23:25 PDT 2017


timshen added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp:423
+
+class AARGetter {
+  FunctionAnalysisManager &AM;
----------------
mehdi_amini wrote:
> Can't you do it with a lambda?
I can, except that AAR needs to be allocated outside of the lambda, on the stack:

    Optional<AAResults> AAR;
    auto F = [&AAR](Function &) -> AAResults& { ... };

(AAR can't be captured by value, since AAResults is not copyable) this way AAR out-lives the lambda, and I feel less readable.


https://reviews.llvm.org/D33525





More information about the llvm-commits mailing list