[lld] r291847 - Remove error(error_code, const Twine &).

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 12 14:18:04 PST 2017


Author: ruiu
Date: Thu Jan 12 16:18:04 2017
New Revision: 291847

URL: http://llvm.org/viewvc/llvm-project?rev=291847&view=rev
Log:
Remove error(error_code, const Twine &).

Now we have the consistent interface for all log/warn/error/fatal functions.

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

Modified: lld/trunk/ELF/Error.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Error.cpp?rev=291847&r1=291846&r2=291847&view=diff
==============================================================================
--- lld/trunk/ELF/Error.cpp (original)
+++ lld/trunk/ELF/Error.cpp Thu Jan 12 16:18:04 2017
@@ -77,10 +77,6 @@ void elf::error(const Twine &Msg) {
   ++ErrorCount;
 }
 
-void elf::error(std::error_code EC, const Twine &Prefix) {
-  error(Prefix + ": " + EC.message());
-}
-
 void elf::exitLld(int Val) {
   // Dealloc/destroy ManagedStatic variables before calling
   // _exit(). In a non-LTO build, this is a nop. In an LTO

Modified: lld/trunk/ELF/Error.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Error.h?rev=291847&r1=291846&r2=291847&view=diff
==============================================================================
--- lld/trunk/ELF/Error.h (original)
+++ lld/trunk/ELF/Error.h Thu Jan 12 16:18:04 2017
@@ -37,12 +37,10 @@ extern llvm::StringRef Argv0;
 
 void log(const Twine &Msg);
 void warn(const Twine &Msg);
-
 void error(const Twine &Msg);
-void error(std::error_code EC, const Twine &Prefix);
+LLVM_ATTRIBUTE_NORETURN void fatal(const Twine &Msg);
 
 LLVM_ATTRIBUTE_NORETURN void exitLld(int Val);
-LLVM_ATTRIBUTE_NORETURN void fatal(const Twine &Msg);
 
 // check() functions are convenient functions to strip errors
 // from error-or-value objects.

Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=291847&r1=291846&r2=291847&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Thu Jan 12 16:18:04 2017
@@ -61,7 +61,7 @@ Optional<MemoryBufferRef> elf::readFile(
 
   auto MBOrErr = MemoryBuffer::getFile(Path);
   if (auto EC = MBOrErr.getError()) {
-    error(EC, "cannot open " + Path);
+    error("cannot open " + Path + ": " + EC.message());
     return None;
   }
   std::unique_ptr<MemoryBuffer> &MB = *MBOrErr;

Modified: lld/trunk/ELF/LTO.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.cpp?rev=291847&r1=291846&r2=291847&view=diff
==============================================================================
--- lld/trunk/ELF/LTO.cpp (original)
+++ lld/trunk/ELF/LTO.cpp Thu Jan 12 16:18:04 2017
@@ -46,7 +46,7 @@ static void saveBuffer(StringRef Buffer,
   std::error_code EC;
   raw_fd_ostream OS(Path.str(), EC, sys::fs::OpenFlags::F_None);
   if (EC)
-    error(EC, "cannot create " + Path);
+    error("cannot create " + Path + ": " + EC.message());
   OS << Buffer;
 }
 

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=291847&r1=291846&r2=291847&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Jan 12 16:18:04 2017
@@ -232,7 +232,7 @@ template <class ELFT> void Writer<ELFT>:
     return;
 
   if (auto EC = Buffer->commit())
-    error(EC, "failed to write to the output file");
+    error("failed to write to the output file: " + EC.message());
 
   // Flush the output streams and exit immediately. A full shutdown
   // is a good test that we are keeping track of all allocated memory,
@@ -1671,7 +1671,7 @@ template <class ELFT> void Writer<ELFT>:
                                FileOutputBuffer::F_executable);
 
   if (auto EC = BufferOrErr.getError())
-    error(EC, "failed to open " + Config->OutputFile);
+    error("failed to open " + Config->OutputFile + ": " + EC.message());
   else
     Buffer = std::move(*BufferOrErr);
 }




More information about the llvm-commits mailing list