aboutsummaryrefslogtreecommitdiff
path: root/lld/unittests
diff options
context:
space:
mode:
authorBrian Gesiak <modocache@gmail.com>2018-06-12 02:34:04 +0000
committerBrian Gesiak <modocache@gmail.com>2018-06-12 02:34:04 +0000
commitb9f7f4b87c574cfe477fa480394280e86b0e3c38 (patch)
tree90897cf1facaacc8b068ef481876cbcc43caf13b /lld/unittests
parente6b2e06f289ba659cfad2be4cbd7b9acc4f5d641 (diff)
downloadllvm-b9f7f4b87c574cfe477fa480394280e86b0e3c38.zip
llvm-b9f7f4b87c574cfe477fa480394280e86b0e3c38.tar.gz
llvm-b9f7f4b87c574cfe477fa480394280e86b0e3c38.tar.bz2
[Darwin] Use errorHandler from liblldCommon
Summary: Error handling in liblldCore and the Darwin toolchain prints to an output stream. A TODO in the project explained that a diagnostics interface resembling Clang's should be added. For now, the simple diagnostics interface defined in liblldCommon seems like an improvement. It prints colors when they're available, uses locks for thread-safety, and abstracts away the `"error: "` and newline literal strings that litter the Darwin toolchain code. To use the liblldCommon error handler, a link dependency is added to the liblldDriver library. Test Plan: 1. check-lld 2. Invoke `ld64.lld -r` in a terminal that supports color output. Confirm that "ld64.lld: error: -arch not specified and could not be inferred" is output, and that the "error:" is colored red! Reviewers: ruiu, smeenai Reviewed By: ruiu Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D47998 llvm-svn: 334466
Diffstat (limited to 'lld/unittests')
-rw-r--r--lld/unittests/DriverTests/DarwinLdDriverTest.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/lld/unittests/DriverTests/DarwinLdDriverTest.cpp b/lld/unittests/DriverTests/DarwinLdDriverTest.cpp
index 0c1d779..e2e634a 100644
--- a/lld/unittests/DriverTests/DarwinLdDriverTest.cpp
+++ b/lld/unittests/DriverTests/DarwinLdDriverTest.cpp
@@ -23,8 +23,7 @@ using namespace lld;
namespace lld {
namespace mach_o {
-bool parse(llvm::ArrayRef<const char *> args, MachOLinkingContext &ctx,
- raw_ostream &diagnostics);
+bool parse(llvm::ArrayRef<const char *> args, MachOLinkingContext &ctx);
}
}
@@ -42,9 +41,7 @@ protected:
bool parse(std::vector<const char *> args) {
args.insert(args.begin(), "ld");
- std::string errorMessage;
- raw_string_ostream os(errorMessage);
- return mach_o::parse(args, _ctx, os);
+ return mach_o::parse(args, _ctx);
}
MachOLinkingContext _ctx;