[clang] [CIR] Initial implementation of lowering CIR to MLIR (PR #127835)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 21 05:52:56 PST 2025


================
@@ -55,6 +55,7 @@ class CIRGenerator : public clang::ASTConsumer {
   void Initialize(clang::ASTContext &astContext) override;
   bool HandleTopLevelDecl(clang::DeclGroupRef group) override;
   mlir::ModuleOp getModule() const;
+  mlir::MLIRContext &getMLIRContext() { return *mlirContext; }
----------------
AaronBallman wrote:

Yes, that sounds like a good path forward. FWIW, I think it's reasonable for CIR to have *some* ugly `const_cast` uses to hide the lack of const correctness from Clang, but not to an obnoxious amount (which it sounds like would be the case with MLIR operations or values). Thanks!

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


More information about the cfe-commits mailing list