]> granicus.if.org Git - llvm/commitdiff
[LLC] Add an inline assembly diagnostics handler.
authorSanne Wouda <sanne.wouda@arm.com>
Fri, 3 Feb 2017 11:14:39 +0000 (11:14 +0000)
committerSanne Wouda <sanne.wouda@arm.com>
Fri, 3 Feb 2017 11:14:39 +0000 (11:14 +0000)
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

test/CodeGen/AArch64/mature-mc-support.ll
test/CodeGen/ARM/mature-mc-support.ll
test/CodeGen/Mips/mature-mc-support.ll
test/CodeGen/PowerPC/mature-mc-support.ll
test/CodeGen/SPARC/mature-mc-support.ll
test/CodeGen/SystemZ/mature-mc-support.ll
test/CodeGen/Thumb/mature-mc-support.ll
test/CodeGen/X86/mature-mc-support.ll
tools/llc/llc.cpp

index 276c54d2cc4e4b3b9d9cab1d8f26d698ea7b6378..dbc027143f99406902e5f09e8f88927cf638d959 100644 (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
index 0a7e5b91adc5fa626900532efdeb97a8809fab04..f89657dd81ac399fede1be2f51d39cce19ea321c 100644 (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
index 6e5998d8a7cb7a15b7209468fe12ecb6efdc6ab8..9c93e96a376b8f2aa95298535793d271a4943549 100644 (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
index aa387f6e26667faceca0581cb1b5ee4e4ab18f2e..543877d60cfae8a2f0d14d4c12a203443c250a5f 100644 (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
index 4ed33098051de069ada2479cf1285689ec585046..3951ddd604c48be35543b7493943c34a0386b42a 100644 (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
index 5520f55e1e29ee7a720c3ca89c5d8de5b028a40c..a01716c27670149dcff89a594ea2c49f7d3f95b5 100644 (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
index d7f8ae6c6c4d808bbacc72129c685e5a47bba8f7..6a638d4050696bdb64332173512b39d0efe5863b 100644 (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
index 9d956f46becafc837b1ca9048643966d7b43bc91..3d6f0f66c1876585ba59458cf511a3426d0bc863 100644 (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
index 597504c08fb49f59f8db5de687d19dae81627f73..b8c613d5099ce563c664b3cbf5258f8b50ad0f57 100644 (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);