[clang] [CIR] -emit-cir should not implicitly enable the CIR pipeline (PR #166916)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 7 09:12:09 PST 2025


================
@@ -3139,9 +3139,17 @@ static bool ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
   if (Opts.ProgramAction != frontend::GenerateModule && Opts.IsSystemModule)
     Diags.Report(diag::err_drv_argument_only_allowed_with) << "-fsystem-module"
                                                            << "-emit-module";
-  if (Args.hasArg(OPT_fclangir) || Args.hasArg(OPT_emit_cir))
+  if (Args.hasArg(OPT_fclangir))
     Opts.UseClangIRPipeline = true;
 
+#if CLANG_ENABLE_CIR
+  if (!Args.hasArg(OPT_fclangir) && Args.hasArg(OPT_emit_cir))
+    Diags.Report(diag::err_drv_emit_cir_without_fclangir);
+#else
+  if (Args.hasArg(OPT_emit_cir))
----------------
andykaylor wrote:

We should also report an error if `-fclangir` is used in this case. Currently, we silently do nothing.

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


More information about the cfe-commits mailing list