================
@@ -81,7 +85,31 @@ class CIRGenConsumer : public clang::ASTConsumer {
 
   void HandleTranslationUnit(ASTContext &C) override {
     Gen->HandleTranslationUnit(C);
+
+    if (!FEOptions.ClangIRDisableCIRVerifier) {
+      if (!Gen->verifyModule()) {
+        CI.getDiagnostics().Report(
+            diag::err_cir_verification_failed_pre_passes);
+        llvm::report_fatal_error(
+            "CIR codegen: module verification error before running CIR 
passes");
+        return;
+      }
+    }
+
     mlir::ModuleOp MlirModule = Gen->getModule();
+    mlir::MLIRContext &MlirCtx = Gen->getMLIRContext();
+
+    if (!FEOptions.ClangIRDisablePasses) {
+      // Setup and run CIR pipeline.
+      std::string passOptParsingFailure;
----------------
erichkeane wrote:

unused variable?

Also, in either case, does it make sense to combine the two 'ifs'?

So : 
`if (!FEOptions.ClangIRDisablePasses && !Gen->verifyModule()) ...`

https://github.com/llvm/llvm-project/pull/131891
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to