diff options
-rw-r--r-- | lld/ELF/Error.h | 7 | ||||
-rw-r--r-- | lld/ELF/LTO.cpp | 13 |
2 files changed, 10 insertions, 10 deletions
diff --git a/lld/ELF/Error.h b/lld/ELF/Error.h index d0c22f6a5c5..c5c5df774cb 100644 --- a/lld/ELF/Error.h +++ b/lld/ELF/Error.h @@ -47,13 +47,6 @@ template <typename T> void error(const ErrorOr<T> &V, const Twine &Prefix) { LLVM_ATTRIBUTE_NORETURN void fatal(const Twine &Msg); LLVM_ATTRIBUTE_NORETURN void fatal(const Twine &Msg, const Twine &Prefix); -inline void check(Error E) { - handleAllErrors(std::move(E), [&](llvm::ErrorInfoBase &EIB) { - error(EIB.message()); - return Error::success(); - }); -} - template <class T> T check(ErrorOr<T> E) { if (auto EC = E.getError()) fatal(EC.message()); diff --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp index 6b1192022a5..fc68d4f462f 100644 --- a/lld/ELF/LTO.cpp +++ b/lld/ELF/LTO.cpp @@ -40,6 +40,13 @@ static void diagnosticHandler(const DiagnosticInfo &DI) { warn(ErrStorage); } +static void checkError(Error E) { + handleAllErrors(std::move(E), [&](ErrorInfoBase &EIB) { + error(EIB.message()); + return Error::success(); + }); +} + static std::unique_ptr<lto::LTO> createLTO() { lto::Config Conf; lto::ThinBackend Backend; @@ -58,7 +65,7 @@ static std::unique_ptr<lto::LTO> createLTO() { Conf.AAPipeline = Config->LtoAAPipeline; if (Config->SaveTemps) - check(Conf.addSaveTemps(std::string(Config->OutputFile) + ".", + checkError(Conf.addSaveTemps(std::string(Config->OutputFile) + ".", /*UseInputModulePath*/ true)); return llvm::make_unique<lto::LTO>(std::move(Conf), Backend, Config->LtoJobs); @@ -103,7 +110,7 @@ void BitcodeCompiler::add(BitcodeFile &F) { if (R.Prevailing) undefine(Sym); } - check(LtoObj->add(std::move(F.Obj), Resols)); + checkError(LtoObj->add(std::move(F.Obj), Resols)); } // Merge all the bitcode files we have seen, codegen the result @@ -119,7 +126,7 @@ std::vector<InputFile *> BitcodeCompiler::compile() { llvm::make_unique<llvm::raw_svector_ostream>(Buff[Task])); }; - check(LtoObj->run(AddStream)); + checkError(LtoObj->run(AddStream)); if (HasError) return Ret; |