[LLC] Add an inline assembly diagnostics handler.

Summary:
llc would hit a fatal error for errors in inline assembly. The
diagnostics message is now printed.

Reviewers: rengolin, MatzeB, javed.absar, anemet

Reviewed By: anemet

Subscribers: jyknight, nemanjai, llvm-commits

Differential Revision: https://reviews.llvm.org/D29408

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293999 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Sanne Wouda 2017-02-03 11:14:39 +00:00
parent e96f3c3a4c
commit 5f9d8e2229
9 changed files with 19 additions and 8 deletions

View File

@ -9,4 +9,4 @@
module asm " .this_directive_is_very_unlikely_to_exist"
; CHECK: LLVM ERROR: Error parsing inline asm
; CHECK: error: unknown directive

View File

@ -9,4 +9,4 @@
module asm " .this_directive_is_very_unlikely_to_exist"
; CHECK: LLVM ERROR: Error parsing inline asm
; CHECK: error: unknown directive

View File

@ -29,4 +29,4 @@
module asm " .this_directive_is_very_unlikely_to_exist"
; CHECK: LLVM ERROR: Error parsing inline asm
; CHECK: error: unknown directive

View File

@ -28,4 +28,4 @@
module asm " .this_directive_is_very_unlikely_to_exist"
; CHECK: LLVM ERROR: Error parsing inline asm
; CHECK: error: unknown directive

View File

@ -17,4 +17,4 @@
module asm " .this_directive_is_very_unlikely_to_exist"
; CHECK: LLVM ERROR: Error parsing inline asm
; CHECK: error: unknown directive

View File

@ -12,4 +12,4 @@
module asm " .this_directive_is_very_unlikely_to_exist"
; CHECK: LLVM ERROR: Error parsing inline asm
; CHECK: error: unknown directive

View File

@ -9,4 +9,4 @@
module asm " .this_directive_is_very_unlikely_to_exist"
; CHECK: LLVM ERROR: Error parsing inline asm
; CHECK: error: unknown directive

View File

@ -15,4 +15,4 @@
module asm " .this_directive_is_very_unlikely_to_exist"
; CHECK: LLVM ERROR: Error parsing inline asm
; CHECK: error: unknown directive

View File

@ -253,6 +253,15 @@ static void DiagnosticHandler(const DiagnosticInfo &DI, void *Context) {
errs() << "\n";
}
static void InlineAsmDiagHandler(const SMDiagnostic &SMD, void *Context,
unsigned) {
bool *HasError = static_cast<bool *>(Context);
if (SMD.getKind() == SourceMgr::DK_Error)
*HasError = true;
SMD.print(nullptr, errs());
}
// main - Entry point for the llc compiler.
//
int main(int argc, char **argv) {
@ -294,6 +303,8 @@ int main(int argc, char **argv) {
// Set a diagnostic handler that doesn't exit on the first error
bool HasError = false;
Context.setDiagnosticHandler(DiagnosticHandler, &HasError);
Context.setInlineAsmDiagnosticHandler(InlineAsmDiagHandler, &HasError);
if (PassRemarksWithHotness)
Context.setDiagnosticHotnessRequested(true);