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

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 29 15:56:10 PDT 2016


On Thu, Sep 29, 2016 at 3:27 PM, Rui Ueyama via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> 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");
>      }
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>

LGTM

-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare


More information about the llvm-commits mailing list