[llvm] r297173 - Fix test and add missing return for llvm-lto2 error case

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 7 10:15:13 PST 2017


Author: tejohnson
Date: Tue Mar  7 12:15:13 2017
New Revision: 297173

URL: http://llvm.org/viewvc/llvm-project?rev=297173&view=rev
Log:
Fix test and add missing return for llvm-lto2 error case

Summary:
This test was missing the target triple.
Once I fixed that, the case with the invalid character error stopped
returning 1 from llvm-lto2 and the test reported a failure. Fixed by
adding the missing return from llvm-lto2. Apparently we were failing
when we eventually tried to get the target.

Reviewers: pcc

Subscribers: mehdi_amini, llvm-commits

Differential Revision: https://reviews.llvm.org/D30585

Modified:
    llvm/trunk/test/tools/llvm-lto2/errors.ll
    llvm/trunk/tools/llvm-lto2/llvm-lto2.cpp

Modified: llvm/trunk/test/tools/llvm-lto2/errors.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-lto2/errors.ll?rev=297173&r1=297172&r2=297173&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-lto2/errors.ll (original)
+++ llvm/trunk/test/tools/llvm-lto2/errors.ll Tue Mar  7 12:15:13 2017
@@ -10,5 +10,6 @@
 ; ERR4: invalid resolution: foo
 
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
 
 @foo = global i32 0

Modified: llvm/trunk/tools/llvm-lto2/llvm-lto2.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-lto2/llvm-lto2.cpp?rev=297173&r1=297172&r2=297173&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-lto2/llvm-lto2.cpp (original)
+++ llvm/trunk/tools/llvm-lto2/llvm-lto2.cpp Tue Mar  7 12:15:13 2017
@@ -157,9 +157,11 @@ int main(int argc, char **argv) {
         Res.FinalDefinitionInLinkageUnit = true;
       else if (C == 'x')
         Res.VisibleToRegularObj = true;
-      else
+      else {
         llvm::errs() << "invalid character " << C << " in resolution: " << R
                      << '\n';
+        return 1;
+      }
     }
     CommandLineResolutions[{FileName, SymbolName}].push_back(Res);
   }




More information about the llvm-commits mailing list