[lld] r282764 - Rename "void check(Error)".

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 29 14:00:26 PDT 2016


Author: ruiu
Date: Thu Sep 29 16:00:26 2016
New Revision: 282764

URL: http://llvm.org/viewvc/llvm-project?rev=282764&view=rev
Log:
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.

Modified:
    lld/trunk/ELF/Error.h
    lld/trunk/ELF/LTO.cpp

Modified: lld/trunk/ELF/Error.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Error.h?rev=282764&r1=282763&r2=282764&view=diff
==============================================================================
--- lld/trunk/ELF/Error.h (original)
+++ lld/trunk/ELF/Error.h Thu Sep 29 16:00:26 2016
@@ -47,13 +47,6 @@ template <typename T> void error(const E
 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());

Modified: lld/trunk/ELF/LTO.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.cpp?rev=282764&r1=282763&r2=282764&view=diff
==============================================================================
--- lld/trunk/ELF/LTO.cpp (original)
+++ lld/trunk/ELF/LTO.cpp Thu Sep 29 16:00:26 2016
@@ -40,6 +40,13 @@ static void diagnosticHandler(const Diag
   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> createL
   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
         llvm::make_unique<llvm::raw_svector_ostream>(Buff[Task]));
   };
 
-  check(LtoObj->run(AddStream));
+  checkError(LtoObj->run(AddStream));
   if (HasError)
     return Ret;
 




More information about the llvm-commits mailing list