[PATCH] D48812: [LTO] Errors in LLVM backend should manifest as lld errors

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 1 15:34:34 PDT 2018


sbc100 created this revision.
Herald added subscribers: llvm-commits, dexonsmith, steven_wu, aheejin, inglorion, mehdi_amini, dschuff.

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D48812

Files:
  Common/ErrorHandler.cpp
  test/wasm/lto/diagnostics.ll


Index: test/wasm/lto/diagnostics.ll
===================================================================
--- /dev/null
+++ test/wasm/lto/diagnostics.ll
@@ -0,0 +1,22 @@
+; verify that errors in the LLVM backend during LTO manifest as lld
+; errors
+
+; RUN: llvm-as %s -o %t.o
+; RUN: not wasm-ld --lto-O0 %t.o -o %t2 2>&1 | FileCheck %s
+
+target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
+target triple = "wasm32-unknown-unknown"
+
+define void @_start() {
+  call i8* @foo()
+  ret void
+}
+
+define i8* @foo() {
+  %1 = call i8* @llvm.returnaddress(i32 0)
+  ret i8* %1
+}
+
+declare i8* @llvm.returnaddress(i32)
+
+; CHECK: error: {{.*}} WebAssembly hasn't implemented __builtin_return_address
Index: Common/ErrorHandler.cpp
===================================================================
--- Common/ErrorHandler.cpp
+++ Common/ErrorHandler.cpp
@@ -65,7 +65,18 @@
   raw_svector_ostream OS(S);
   DiagnosticPrinterRawOStream DP(OS);
   DI.print(DP);
-  warn(S);
+  switch (DI.getSeverity()) {
+    case DS_Error:
+      error(S);
+      break;
+    case DS_Warning:
+      warn(S);
+      break;
+    case DS_Remark:
+    case DS_Note:
+      message(S);
+      break;
+  }
 }
 
 void lld::checkError(Error E) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48812.153658.patch
Type: text/x-patch
Size: 1226 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180701/5ee0d6ac/attachment.bin>


More information about the llvm-commits mailing list