[PATCH] Remove HasError check after lto::LTO::run.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 29 15:27:28 PDT 2016


Because LTO::run doesn't change HasError, it doesn't make
sense to check that value.

diff --git a/ELF/LTO.cpp b/ELF/LTO.cpp
index eb35e18..9c7de9d 100644
--- a/ELF/LTO.cpp
+++ b/ELF/LTO.cpp
@@ -113,34 +113,29 @@ void BitcodeCompiler::add(BitcodeFile &F) {
   checkError(LtoObj->add(std::move(F.Obj), Resols));
 }

 // Merge all the bitcode files we have seen, codegen the result
 // and return the resulting ObjectFile(s).
 std::vector<InputFile *> BitcodeCompiler::compile() {
   std::vector<InputFile *> Ret;
   unsigned MaxTasks = LtoObj->getMaxTasks();
   Buff.resize(MaxTasks);

-  auto AddStream = [&](size_t Task) {
+  checkError(LtoObj->run([&](size_t Task) {
     return llvm::make_unique<lto::NativeObjectStream>(
         llvm::make_unique<llvm::raw_svector_ostream>(Buff[Task]));
-  };
-
-  checkError(LtoObj->run(AddStream));
-  if (HasError)
-    return Ret;
+  }));

   for (unsigned I = 0; I != MaxTasks; ++I) {
     if (Buff[I].empty())
       continue;
     if (Config->SaveTemps) {
       if (MaxTasks == 1)
         saveBuffer(Buff[I], Config->OutputFile + ".lto.o");
       else
         saveBuffer(Buff[I], Config->OutputFile + Twine(I) + ".lto.o");
     }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160929/37dc901b/attachment.html>


More information about the llvm-commits mailing list