[Assembler] Allow non-fatal errors after parsing
authorOliver Stannard <oliver.stannard@arm.com>
Tue, 17 Nov 2015 09:58:07 +0000 (09:58 +0000)
committerOliver Stannard <oliver.stannard@arm.com>
Tue, 17 Nov 2015 09:58:07 +0000 (09:58 +0000)
commit43f1dd7a0084daba57a9f791cfad74d0667d2307
tree0d4a015c41a0d722449343ce34a825a20c70d30d
parente0d7dbe7db6ac2b56f6610137583e23cfaba37b7
[Assembler] Allow non-fatal errors after parsing

This adds reportError to MCContext, which can be used as an alternative to
reportFatalError when the assembler wants to try to continue processing the
rest of the file after the error is reported, so that all of the errors ina
file can be reported. It records the fact that an error was encountered, so we
can avoid emitting an object file if any errors occurred.

This patch doesn't add any uses of this function (a later patch will convert
most uses of reportFatalError to use it), but there is a small functional
change: we use the SourceManager to print the error message, even if we have a
null SMLoc. This means that we get a SourceManager-style message, with the file
and line information shown as <unknown>, rather than the "LLVM ERROR" style
used by report_fatal_error.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253327 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/MC/MCContext.h
lib/MC/MCContext.cpp
lib/MC/MCParser/AsmParser.cpp
test/MC/Mips/micromips-diagnostic-fixup.s
test/MC/Mips/mips-diagnostic-fixup.s