================ @@ -44,7 +44,7 @@ class CIRGenerator : public clang::ASTConsumer { const clang::CodeGenOptions &codeGenOpts; protected: - std::unique_ptr<mlir::MLIRContext> mlirContext; + std::shared_ptr<mlir::MLIRContext> mlirContext; ---------------- erichkeane wrote:
Could `CIRGenerator` own this and just share it with `lowerFromCIRToLLVMIR`/etc via reference? CIRGenerator seems to be the entry point into all of CIR, so it makes sense for me for it to 'own' the lifetime. I don't see why `handleTranslationUnit` needs to take ownership of it. I also wonder if that taking of ownership is problematic, since of course, clang can in some configurations handle multiple translation units, which this could potentially lose (though IDK if we ended up enabling that functionality). https://github.com/llvm/llvm-project/pull/124650 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits