[PATCH] D46941: [Debugify] Print errors and warnings to stderr

Anastasis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 17 04:16:52 PDT 2018


gramanas updated this revision to Diff 147288.
gramanas added a comment.

- [Debugify] All output now goes to stderr


Repository:
  rL LLVM

https://reviews.llvm.org/D46941

Files:
  test/DebugInfo/debugify-each.ll
  test/DebugInfo/debugify.ll
  test/Transforms/Mem2Reg/PromoteMemToRegister.ll
  tools/opt/Debugify.cpp


Index: tools/opt/Debugify.cpp
===================================================================
--- tools/opt/Debugify.cpp
+++ tools/opt/Debugify.cpp
@@ -163,10 +163,10 @@
         continue;
       }
 
-      outs() << "ERROR: Instruction with empty DebugLoc in function ";
-      outs() << F.getName() << " --";
-      I.print(outs());
-      outs() << "\n";
+      errs() << "ERROR: Instruction with empty DebugLoc in function ";
+      errs() << F.getName() << " --";
+      I.print(errs());
+      errs() << "\n";
       HasErrors = true;
     }
 
@@ -185,17 +185,17 @@
 
   // Print the results.
   for (unsigned Idx : MissingLines.set_bits())
-    outs() << "WARNING: Missing line " << Idx + 1 << "\n";
+    errs() << "WARNING: Missing line " << Idx + 1 << "\n";
 
   for (unsigned Idx : MissingVars.set_bits())
-    outs() << "ERROR: Missing variable " << Idx + 1 << "\n";
+    errs() << "ERROR: Missing variable " << Idx + 1 << "\n";
   HasErrors |= MissingVars.count() > 0;
 
-  outs() << Banner << " [" << NameOfWrappedPass << "]: "
+  errs() << Banner << " [" << NameOfWrappedPass << "]: "
          << (HasErrors ? "FAIL" : "PASS") << '\n';
   if (HasErrors) {
-    outs() << "Module IR Dump\n";
-    M.print(outs(), nullptr, false);
+    errs() << "Module IR Dump\n";
+    M.print(errs(), nullptr, false);
   }
 
   // Strip the Debugify Metadata if required.
Index: test/Transforms/Mem2Reg/PromoteMemToRegister.ll
===================================================================
--- test/Transforms/Mem2Reg/PromoteMemToRegister.ll
+++ test/Transforms/Mem2Reg/PromoteMemToRegister.ll
@@ -1,5 +1,5 @@
 ; Simple sanity check testcase.  Both alloca's should be eliminated.
-; RUN: opt < %s -debugify -mem2reg -check-debugify -S | FileCheck %s
+; RUN: opt < %s -debugify -mem2reg -check-debugify -S 2>&1 | FileCheck %s
 
 ; CHECK-NOT: alloca
 ; CHECK: CheckModuleDebugify [{{.*}}]: PASS
Index: test/DebugInfo/debugify.ll
===================================================================
--- test/DebugInfo/debugify.ll
+++ test/DebugInfo/debugify.ll
@@ -13,13 +13,13 @@
 ; RUN: opt -enable-debugify -passes=verify -S -o - < %s | \
 ; RUN:   FileCheck %s -implicit-check-not="CheckModuleDebugify: FAIL"
 
-; RUN: opt -debugify -strip -check-debugify -S -o - < %s | \
+; RUN: opt -debugify -strip -check-debugify -S -o - < %s 2>&1 | \
 ; RUN:   FileCheck %s -check-prefix=CHECK-FAIL
 
-; RUN: opt -enable-debugify -strip -S -o - < %s | \
+; RUN: opt -enable-debugify -strip -S -o - < %s 2>&1 | \
 ; RUN:   FileCheck %s -check-prefix=CHECK-FAIL
 
-; RUN: opt -enable-debugify -S -o - < %s | FileCheck %s -check-prefix=PASS
+; RUN: opt -enable-debugify -S -o - < %s 2>&1 | FileCheck %s -check-prefix=PASS
 
 ; CHECK-LABEL: define void @foo
 define void @foo() {
Index: test/DebugInfo/debugify-each.ll
===================================================================
--- test/DebugInfo/debugify-each.ll
+++ test/DebugInfo/debugify-each.ll
@@ -1,12 +1,12 @@
-; RUN: opt -debugify-each -O3 -S -o /dev/null < %s > %t
+; RUN: opt -debugify-each -O3 -S -o /dev/null < %s 2> %t
 ; RUN: FileCheck %s -input-file=%t -check-prefix=MODULE-PASS
 ; RUN: FileCheck %s -input-file=%t -check-prefix=FUNCTION-PASS
 
-; RUN: opt -enable-debugify -debugify-each -O3 -S -o /dev/null < %s > %t
+; RUN: opt -enable-debugify -debugify-each -O3 -S -o /dev/null < %s 2> %t
 ; RUN: FileCheck %s -input-file=%t -check-prefix=MODULE-PASS
 ; RUN: FileCheck %s -input-file=%t -check-prefix=FUNCTION-PASS
 
-; RUN: opt -debugify-each -instrprof -instrprof -sroa -sccp -S -o /dev/null < %s > %t
+; RUN: opt -debugify-each -instrprof -instrprof -sroa -sccp -S -o /dev/null < %s 2> %t
 ; RUN: FileCheck %s -input-file=%t -check-prefix=MODULE-PASS
 ; RUN: FileCheck %s -input-file=%t -check-prefix=FUNCTION-PASS
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46941.147288.patch
Type: text/x-patch
Size: 3793 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180517/cccb50dd/attachment.bin>


More information about the llvm-commits mailing list