[clang] [CIR] Add framework for CIR to LLVM IR lowering (PR #124650)
Nathan Lanza via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 28 12:15:04 PST 2025
================
@@ -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
More information about the cfe-commits
mailing list