summaryrefslogtreecommitdiff
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
commit9658ffce22883dabf7f3dfd3e59e4b1b0ade2f70 (patch)
treeab85d30822b281e4acef32f6c9bf08dfd99307c4 /lld/unittests
parentf3844849e28e6e7c6dc44612c6ec2f3eaa219f49 (diff)
[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
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 0c1d779ce4c..e2e634a4cb2 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;