This is an archive of the discontinued LLVM Phabricator instance.

lld-link: Add --color-diagnostics(={always,never,auto})?, --no-color-diagnostics flags.
ClosedPublic

Authored by thakis on May 10 2018, 7:37 AM.

Details

Summary

This is most useful when using lld-link on a non-Win host (but it might become useful on Windows too if lld also grows a fansi-escape-codes flag).

Also make the help for --color-diagnostic mention the valid values in ELF and wasm, and print the flag name with two dashes in diags, since the one-dash form is seen as a list of many one-letter flags in some contexts.

Diff Detail

Event Timeline

thakis created this revision.May 10 2018, 7:37 AM

(This flag is now duplicated in COFF, ELF, and wasm. I didn't see any .td file in Common, so it wasn't obvious to me how to share it though.)

ruiu added a comment.May 10 2018, 8:14 AM

Is there any reason to make it exactly the same option name as Unix linkers? I mean, all the other options in the COFF linker are Windows-ish, e.g. /something. So I wonder if /colordiagnostics{,:always,:never,:auto} is better.

lld/COFF/DriverUtils.cpp
766

nit: no else after return.

770

nit: consistently add {} if you add {} to some else or else if.

Is there any reason to make it exactly the same option name as Unix linkers? I mean, all the other options in the COFF linker are Windows-ish, e.g. /something. So I wonder if /colordiagnostics{,:always,:never,:auto} is better.

For flags that link.exe doesn't have and that are shared with ld.lld, I thought we usually use the -- prefix to reduce the risk of collision with future link.exe flags, and for consistency (cf --version, --rsp-quoting).

(Will fix the nits, also in the ELF and wasm versions.)

ruiu accepted this revision.May 10 2018, 10:09 AM

LGTM

That makes sense, though we already have /linkrepro instead of --reproduce because we wanted to make it more MS linker-ish than the Unix linker. In hindsight, we probably should have named it --reproduce even on Windows though.

This revision is now accepted and ready to land.May 10 2018, 10:09 AM
thakis closed this revision.May 10 2018, 11:22 AM

r332012, thanks!