[PATCH] D44464: allow custom OptBisect classes set to LLVMContext

Andy Kaylor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 27 13:30:18 PDT 2018


andrew.w.kaylor added inline comments.


================
Comment at: include/llvm/IR/LLVMContext.h:324
+  /// analysis.
+  void setOptPassGate(OptPassGate&);
+
----------------
It seems like a bad idea to pass this in by reference. How is the lifetime of this object going to be managed? I don't think it's correct for the LLVMContext to have a reference to anything outside the LLVMContext. If you're going to pass in an object, I think LLVMContext must take ownership of the object, as happens with LLVMContext::setDiagnosticHandler().


================
Comment at: lib/IR/LLVMContextImpl.h:1362
   /// analysis.
   OptPassGate &getOptPassGate();
+
----------------
I missed this in the last review. This function should be const.


https://reviews.llvm.org/D44464





More information about the llvm-commits mailing list