summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/WinCOFFStreamer.cpp
diff options
context:
space:
mode:
authorOliver Stannard <oliver.stannard@arm.com>2015-11-17 10:00:43 +0000
committerOliver Stannard <oliver.stannard@arm.com>2015-11-17 10:00:43 +0000
commit9be59af3abe0b3bbee54e46720a75c96723da6cb (patch)
treed7b87d3a7144c56e73294288efcbd24109e3426e /llvm/lib/MC/WinCOFFStreamer.cpp
parent07b43d39a8ef5be442210c5ca21c780c19db0683 (diff)
downloadbcm5719-llvm-9be59af3abe0b3bbee54e46720a75c96723da6cb.tar.gz
bcm5719-llvm-9be59af3abe0b3bbee54e46720a75c96723da6cb.zip
[Assembler] Make fatal assembler errors non-fatal
Currently, if the assembler encounters an error after parsing (such as an out-of-range fixup), it reports this as a fatal error, and so stops after the first error. However, for most of these there is an obvious way to recover after emitting the error, such as emitting the fixup with a value of zero. This means that we can report on all of the errors in a file, not just the first one. MCContext::reportError records the fact that an error was encountered, so we won't actually emit an object file with the incorrect contents. Differential Revision: http://reviews.llvm.org/D14717 llvm-svn: 253328
Diffstat (limited to 'llvm/lib/MC/WinCOFFStreamer.cpp')
-rw-r--r--llvm/lib/MC/WinCOFFStreamer.cpp35
1 files changed, 21 insertions, 14 deletions
diff --git a/llvm/lib/MC/WinCOFFStreamer.cpp b/llvm/lib/MC/WinCOFFStreamer.cpp
index 02814fa7d28..a38b1a41a9b 100644
--- a/llvm/lib/MC/WinCOFFStreamer.cpp
+++ b/llvm/lib/MC/WinCOFFStreamer.cpp
@@ -122,29 +122,37 @@ void MCWinCOFFStreamer::BeginCOFFSymbolDef(MCSymbol const *Symbol) {
"Got non-COFF section in the COFF backend!");
if (CurSymbol)
- FatalError("starting a new symbol definition without completing the "
- "previous one");
+ Error("starting a new symbol definition without completing the "
+ "previous one");
CurSymbol = Symbol;
}
void MCWinCOFFStreamer::EmitCOFFSymbolStorageClass(int StorageClass) {
- if (!CurSymbol)
- FatalError("storage class specified outside of symbol definition");
+ if (!CurSymbol) {
+ Error("storage class specified outside of symbol definition");
+ return;
+ }
- if (StorageClass & ~COFF::SSC_Invalid)
- FatalError("storage class value '" + Twine(StorageClass) +
+ if (StorageClass & ~COFF::SSC_Invalid) {
+ Error("storage class value '" + Twine(StorageClass) +
"' out of range");
+ return;
+ }
getAssembler().registerSymbol(*CurSymbol);
cast<MCSymbolCOFF>(CurSymbol)->setClass((uint16_t)StorageClass);
}
void MCWinCOFFStreamer::EmitCOFFSymbolType(int Type) {
- if (!CurSymbol)
- FatalError("symbol type specified outside of a symbol definition");
+ if (!CurSymbol) {
+ Error("symbol type specified outside of a symbol definition");
+ return;
+ }
- if (Type & ~0xffff)
- FatalError("type value '" + Twine(Type) + "' out of range");
+ if (Type & ~0xffff) {
+ Error("type value '" + Twine(Type) + "' out of range");
+ return;
+ }
getAssembler().registerSymbol(*CurSymbol);
cast<MCSymbolCOFF>(CurSymbol)->setType((uint16_t)Type);
@@ -152,7 +160,7 @@ void MCWinCOFFStreamer::EmitCOFFSymbolType(int Type) {
void MCWinCOFFStreamer::EndCOFFSymbolDef() {
if (!CurSymbol)
- FatalError("ending symbol definition without starting one");
+ Error("ending symbol definition without starting one");
CurSymbol = nullptr;
}
@@ -281,9 +289,8 @@ void MCWinCOFFStreamer::FinishImpl() {
MCObjectStreamer::FinishImpl();
}
-LLVM_ATTRIBUTE_NORETURN
-void MCWinCOFFStreamer::FatalError(const Twine &Msg) const {
- getContext().reportFatalError(SMLoc(), Msg);
+void MCWinCOFFStreamer::Error(const Twine &Msg) const {
+ getContext().reportError(SMLoc(), Msg);
}
}
OpenPOWER on IntegriCloud