tools: Unify how verifyModule() is called
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 31 Mar 2015 03:07:23 +0000 (03:07 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 31 Mar 2015 03:07:23 +0000 (03:07 +0000)
Unify the error messages for the various tools when `verifyModule()`
fails on an input module.  The "brave new way" is:

    lltool: path/to/input.ll: error: input module is broken!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233667 91177308-0d34-0410-b5e6-96231b3b80d8

test/Linker/broken.ll
tools/bugpoint/BugDriver.cpp
tools/llc/llc.cpp
tools/llvm-link/llvm-link.cpp
tools/opt/opt.cpp
tools/verify-uselistorder/verify-uselistorder.cpp

index 227640174421901e1e7897a3f18688b337cfab93..8aefe4e6a37dfdde40ba655c5198501c5ddfed92 100644 (file)
@@ -1,6 +1,6 @@
 ; RUN: not llvm-link -o /dev/null %s 2>&1 | FileCheck %s
 
-; CHECK: input module '{{.*}}broken.ll' is broken
+; CHECK: broken.ll: error: input module is broken!
 define i32 @foo(i32 %v) {
   %first = add i32 %v, %second
   %second = add i32 %v, 3
index 865cb513c55f507815de4562cb86706b38a08847..43f4c2963fc33cb3ce8386518043fb1302582a96 100644 (file)
@@ -93,7 +93,7 @@ std::unique_ptr<Module> llvm::parseInputFile(StringRef Filename,
   }
 
   if (verifyModule(*Result, &errs())) {
-    errs() << "bugpoint: " << Filename << ": error: does not verify\n";
+    errs() << "bugpoint: " << Filename << ": error: input module is broken!\n";
     return std::unique_ptr<Module>();
   }
 
index fa8d2688dd2e0bd54db786dfa4c5bd27a5b7c84b..000948c10a0c7db9c0fac432d6f53fff7d5f8a00 100644 (file)
@@ -230,7 +230,7 @@ static int compileModule(char **argv, LLVMContext &Context) {
     // called on any passes.
     if (!NoVerify && verifyModule(*M, &errs())) {
       errs() << argv[0] << ": " << InputFilename
-             << ": error: does not verify\n";
+             << ": error: input module is broken!\n";
       return 1;
     }
 
index 29c4c736b33b97b56fa92929d5664ddeec0056bf..6924aa5cb2e644005c711835570ec4944028e66d 100644 (file)
@@ -116,9 +116,9 @@ int main(int argc, char **argv) {
       return 1;
     }
 
-    if (verifyModule(*M)) {
-      errs() << argv[0] << ": input module '" << InputFilenames[i]
-             << "' is broken!\n";
+    if (verifyModule(*M, &errs())) {
+      errs() << argv[0] << ": " << InputFilenames[i]
+             << ": error: input module is broken!\n";
       return 1;
     }
 
@@ -137,8 +137,8 @@ int main(int argc, char **argv) {
     return 1;
   }
 
-  if (verifyModule(*Composite)) {
-    errs() << argv[0] << ": linked module is broken!\n";
+  if (verifyModule(*Composite, &errs())) {
+    errs() << argv[0] << ": error: linked module is broken!\n";
     return 1;
   }
 
index 86fbed700365dc4b01c1c9be59da6d2c8b47c6da..c64e907af22614378a916adb8d8fa21472fa928e 100644 (file)
@@ -354,7 +354,8 @@ int main(int argc, char **argv) {
   // pass pipelines.  Otherwise we can crash on broken code during
   // doInitialization().
   if (!NoVerify && verifyModule(*M, &errs())) {
-    errs() << argv[0] << ": " << InputFilename << ": error: does not verify\n";
+    errs() << argv[0] << ": " << InputFilename
+           << ": error: input module is broken!\n";
     return 1;
   }
 
index ef3d5b39253e847d009bf04b3cf84eb277b410a1..09931587470151e5f4f65bf28b2a94fd36ae93c6 100644 (file)
@@ -534,8 +534,11 @@ int main(int argc, char **argv) {
     Err.print(argv[0], errs());
     return 1;
   }
-  if (verifyModule(*M, &errs()))
-    report_fatal_error("verification failed");
+  if (verifyModule(*M, &errs())) {
+    errs() << argv[0] << ": " << InputFilename
+           << ": error: input module is broken!\n";
+    return 1;
+  }
 
   errs() << "*** verify-use-list-order ***\n";
   // Can't verify if order isn't preserved.