[llvm] AsmPrinter: Do not use report_fatal_error for unhandled ConstantExpr (PR #145275)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 23 22:05:19 PDT 2025


================
@@ -3603,10 +3603,11 @@ const MCExpr *AsmPrinter::lowerConstant(const Constant *CV,
   // Otherwise report the problem to the user.
   std::string S;
   raw_string_ostream OS(S);
-  OS << "Unsupported expression in static initializer: ";
+  OS << "unsupported expression in static initializer: ";
   CE->printAsOperand(OS, /*PrintType=*/false,
                      !MF ? nullptr : MF->getFunction().getParent());
-  report_fatal_error(Twine(S));
+  CE->getContext().emitError(S);
----------------
arsenm wrote:

We probably should add some new DiagnosticInfo types for dealing with bad global references. Right now they mostly assume a function context 

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


More information about the llvm-commits mailing list