diff options
author | Fangrui Song <i@maskray.me> | 2022-02-17 11:54:57 -0800 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2022-02-17 11:54:57 -0800 |
commit | 941f06282a3d304a96c1ea71b335be5fc91d8f7c (patch) | |
tree | 62a7c07f85aa019e1fe53c65f16b7d0cf73802b9 /lld/Common | |
parent | a3beb34015fcc5b61e804736247781a80554443a (diff) | |
download | llvm-941f06282a3d304a96c1ea71b335be5fc91d8f7c.tar.gz |
[lld] Make error handling functions opaque
The inline `lld::error` expands to two function calls `errorHandler` and `error`
where the latter is opaque. Move the functions to .cpp files to decrease code
size.
My x86-64 lld executable is 9KiB smaller.
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D120002
Diffstat (limited to 'lld/Common')
-rw-r--r-- | lld/Common/ErrorHandler.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lld/Common/ErrorHandler.cpp b/lld/Common/ErrorHandler.cpp index e557e533dedc..4cacd82c9f35 100644 --- a/lld/Common/ErrorHandler.cpp +++ b/lld/Common/ErrorHandler.cpp @@ -53,6 +53,18 @@ void ErrorHandler::flushStreams() { ErrorHandler &lld::errorHandler() { return context().e; } +void lld::error(const Twine &msg) { errorHandler().error(msg); } +void lld::error(const Twine &msg, ErrorTag tag, ArrayRef<StringRef> args) { + errorHandler().error(msg, tag, args); +} +void lld::fatal(const Twine &msg) { errorHandler().fatal(msg); } +void lld::log(const Twine &msg) { errorHandler().log(msg); } +void lld::message(const Twine &msg, llvm::raw_ostream &s) { + errorHandler().message(msg, s); +} +void lld::warn(const Twine &msg) { errorHandler().warn(msg); } +uint64_t lld::errorCount() { return errorHandler().errorCount; } + raw_ostream &lld::outs() { ErrorHandler &e = errorHandler(); return e.outs(); |