[PATCH] D30585: Fix test and add missing return for llvm-lto2 error case

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 3 11:49:53 PST 2017


tejohnson created this revision.
Herald added a subscriber: mehdi_amini.

This test was missing the target triple, which was exposed by an
upcoming bugfix that requires getting the target earlier in the LTO API.

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.


https://reviews.llvm.org/D30585

Files:
  test/tools/llvm-lto2/errors.ll
  tools/llvm-lto2/llvm-lto2.cpp


Index: tools/llvm-lto2/llvm-lto2.cpp
===================================================================
--- tools/llvm-lto2/llvm-lto2.cpp
+++ tools/llvm-lto2/llvm-lto2.cpp
@@ -157,9 +157,11 @@
         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);
   }
Index: test/tools/llvm-lto2/errors.ll
===================================================================
--- test/tools/llvm-lto2/errors.ll
+++ test/tools/llvm-lto2/errors.ll
@@ -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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30585.90514.patch
Type: text/x-patch
Size: 911 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170303/b6f8322d/attachment.bin>


More information about the llvm-commits mailing list