summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2016-09-29 21:00:26 +0000
committerRui Ueyama <ruiu@google.com>2016-09-29 21:00:26 +0000
commit6c5cbff97eccfc76e403965449072b0714312ffa (patch)
tree2d3b02c626ba6a0f5ce6b184460f0f22cb5d3cdd
parentd31e13f2877b5ecbc1df7d20912967aa01f5eef8 (diff)
downloadbcm5719-llvm-6c5cbff97eccfc76e403965449072b0714312ffa.tar.gz
bcm5719-llvm-6c5cbff97eccfc76e403965449072b0714312ffa.zip
Rename "void check(Error)".
We have a few "check" functions in Error.h. All of them are to check for an error and strip an error object if there was no error, except "void check(Error E)", which doesn't return anything. This patch renames it and moves it to the .cpp file where it is used. llvm-svn: 282764
-rw-r--r--lld/ELF/Error.h7
-rw-r--r--lld/ELF/LTO.cpp13
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;
OpenPOWER on IntegriCloud