diff options
author | Dan Gohman <gohman@apple.com> | 2010-08-04 18:51:09 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-08-04 18:51:09 +0000 |
commit | 9f6a6862be09df9f1e90b0560e52da7d15935f24 (patch) | |
tree | 9737c3c904b287eda026ecd84c8a5524fbc25971 | |
parent | 225764b7a5db59c70bf02f1ca4802e886495ca9b (diff) |
Change this llvm_unreachable to report_fatal_error, since it can
be triggered by valid, if dubious, IR.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110240 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 77d6ba1417..1ba6310095 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1268,10 +1268,17 @@ static const MCExpr *LowerConstant(const Constant *CV, AsmPrinter &AP) { ConstantFoldConstantExpression(CE, AP.TM.getTargetData())) if (C != CE) return LowerConstant(C, AP); -#ifndef NDEBUG - CE->dump(); -#endif - llvm_unreachable("FIXME: Don't support this constant expr"); + + // Otherwise report the problem to the user. + { + std::string S; + raw_string_ostream OS(S); + OS << "Unsupported expression in static initializer: "; + WriteAsOperand(OS, CE, /*PrintType=*/false, + !AP.MF ? 0 : AP.MF->getFunction()->getParent()); + report_fatal_error(OS.str()); + } + return MCConstantExpr::Create(0, Ctx); case Instruction::GetElementPtr: { const TargetData &TD = *AP.TM.getTargetData(); // Generate a symbolic expression for the byte address |