================
@@ -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;
----------------
lanza 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 think hoisting it to the `CIRGenConsumer` and just letting the `CIRGenerator` 
get a handle to it makes sense. 

Alternatively, the `CIRGenerator` is done at this point. We could have some 
sort of destruction of the `CIRGenerator` here and have it give up it's state 
contents to the `CIRGenConsumer`. cc @bcardosolopes 

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

Reply via email to