[clang] [CIR] Add framework for CIR to LLVM IR lowering (PR #124650)

Bruno Cardoso Lopes via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 28 15:21:23 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;
----------------
bcardosolopes wrote:

We run passes post CIRGen (LLVM lowering is one example) and at some point we were trying to build CIR in Sema and hand it over to codegen if already produced, so this probably dates back to that. Right now CIRGenerator holds the whole lifetime it's totally fine to go for a more clean solution here.

Btw, If you want to double check, you could run the cir tests with a ASAN enabled clang build, I usually use that from time to time to make sure the incubator isn't leaking.

https://github.com/llvm/llvm-project/pull/124650


More information about the cfe-commits mailing list