[clang] [CIR] Add framework for CIR to LLVM IR lowering (PR #124650)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 28 11:28:51 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;
----------------
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
More information about the cfe-commits
mailing list