[PATCH] D47998: [Darwin] Use errorHandler from liblldCommon

Brian Gesiak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 10 19:05:58 PDT 2018


modocache created this revision.
modocache added reviewers: ruiu, smeenai.
Herald added a subscriber: mgorny.

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!


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D47998

Files:
  include/lld/Common/Driver.h
  include/lld/Core/LinkingContext.h
  include/lld/Core/TODO.txt
  include/lld/ReaderWriter/MachOLinkingContext.h
  lib/Core/LinkingContext.cpp
  lib/Driver/CMakeLists.txt
  lib/Driver/DarwinLdDriver.cpp
  lib/Driver/DarwinLdOptions.td
  lib/ReaderWriter/MachO/MachOLinkingContext.cpp
  tools/lld/lld.cpp
  unittests/DriverTests/DarwinLdDriverTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47998.150671.patch
Type: text/x-patch
Size: 36626 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180611/6f9ef2e4/attachment.bin>


More information about the llvm-commits mailing list