diff options
| author | Rui Ueyama <ruiu@google.com> | 2017-01-12 22:18:04 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2017-01-12 22:18:04 +0000 |
| commit | c8d3a83fff88dd199fcd2b068657d131f03e371f (patch) | |
| tree | c91359c3f0da8ea8720632dad2233a0b510e8af8 | |
| parent | 83aaf358fdd08647ae21f08bb4c5aaec0b47c584 (diff) | |
| download | bcm5719-llvm-c8d3a83fff88dd199fcd2b068657d131f03e371f.tar.gz bcm5719-llvm-c8d3a83fff88dd199fcd2b068657d131f03e371f.zip | |
Remove error(error_code, const Twine &).
Now we have the consistent interface for all log/warn/error/fatal functions.
llvm-svn: 291847
| -rw-r--r-- | lld/ELF/Error.cpp | 4 | ||||
| -rw-r--r-- | lld/ELF/Error.h | 4 | ||||
| -rw-r--r-- | lld/ELF/InputFiles.cpp | 2 | ||||
| -rw-r--r-- | lld/ELF/LTO.cpp | 2 | ||||
| -rw-r--r-- | lld/ELF/Writer.cpp | 4 |
5 files changed, 5 insertions, 11 deletions
diff --git a/lld/ELF/Error.cpp b/lld/ELF/Error.cpp index 4d21ed8045a..5fbb59dcd2f 100644 --- a/lld/ELF/Error.cpp +++ b/lld/ELF/Error.cpp @@ -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 diff --git a/lld/ELF/Error.h b/lld/ELF/Error.h index 642ba9d6cca..95fab7e62f1 100644 --- a/lld/ELF/Error.h +++ b/lld/ELF/Error.h @@ -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. diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index f3afb1c3456..6bfc49baabf 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -61,7 +61,7 @@ Optional<MemoryBufferRef> elf::readFile(StringRef Path) { 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; diff --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp index b342b6195f1..d0a64df42f5 100644 --- a/lld/ELF/LTO.cpp +++ b/lld/ELF/LTO.cpp @@ -46,7 +46,7 @@ static void saveBuffer(StringRef Buffer, const Twine &Path) { 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; } diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index bddc42e1acf..a14db206445 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -232,7 +232,7 @@ template <class ELFT> void Writer<ELFT>::run() { 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>::openFile() { 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); } |

