llvm.org GIT mirror llvm / 4e5fdbf
tools: Unify how verifyModule() is called 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 Duncan P. N. Exon Smith 5 years ago
6 changed file(s) with 15 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
0 ; RUN: not llvm-link -o /dev/null %s 2>&1 | FileCheck %s
11
2 ; CHECK: input module '{{.*}}broken.ll' is broken
2 ; CHECK: broken.ll: error: input module is broken!
33 define i32 @foo(i32 %v) {
44 %first = add i32 %v, %second
55 %second = add i32 %v, 3
9292 }
9393
9494 if (verifyModule(*Result, &errs())) {
95 errs() << "bugpoint: " << Filename << ": error: does not verify\n";
95 errs() << "bugpoint: " << Filename << ": error: input module is broken!\n";
9696 return std::unique_ptr();
9797 }
9898
229229 // called on any passes.
230230 if (!NoVerify && verifyModule(*M, &errs())) {
231231 errs() << argv[0] << ": " << InputFilename
232 << ": error: does not verify\n";
232 << ": error: input module is broken!\n";
233233 return 1;
234234 }
235235
115115 return 1;
116116 }
117117
118 if (verifyModule(*M)) {
119 errs() << argv[0] << ": input module '" << InputFilenames[i]
120 << "' is broken!\n";
118 if (verifyModule(*M, &errs())) {
119 errs() << argv[0] << ": " << InputFilenames[i]
120 << ": error: input module is broken!\n";
121121 return 1;
122122 }
123123
136136 return 1;
137137 }
138138
139 if (verifyModule(*Composite)) {
140 errs() << argv[0] << ": linked module is broken!\n";
139 if (verifyModule(*Composite, &errs())) {
140 errs() << argv[0] << ": error: linked module is broken!\n";
141141 return 1;
142142 }
143143
353353 // pass pipelines. Otherwise we can crash on broken code during
354354 // doInitialization().
355355 if (!NoVerify && verifyModule(*M, &errs())) {
356 errs() << argv[0] << ": " << InputFilename << ": error: does not verify\n";
356 errs() << argv[0] << ": " << InputFilename
357 << ": error: input module is broken!\n";
357358 return 1;
358359 }
359360
533533 Err.print(argv[0], errs());
534534 return 1;
535535 }
536 if (verifyModule(*M, &errs()))
537 report_fatal_error("verification failed");
536 if (verifyModule(*M, &errs())) {
537 errs() << argv[0] << ": " << InputFilename
538 << ": error: input module is broken!\n";
539 return 1;
540 }
538541
539542 errs() << "*** verify-use-list-order ***\n";
540543 // Can't verify if order isn't preserved.