This is an archive of the discontinued LLVM Phabricator instance.

Add the /nologo flag to llvm-ml
ClosedPublic

Authored by ayzhao on Apr 4 2022, 1:03 PM.

Details

Summary

This flag is present in MSVC's ml.exe to suppress copyright info output.
LLVM doesn't output copyright info, so this flag does nothing in
llvm-ml. We still add this flag though so that when llvm-ml is used as a
drop-in replacement for MSVC ml.exe, we don't get any extra warnings.
Furthermore, this behavior is also consistent with other llvm binaries
for Windows (e.g. clang-cl, llvm-mt, lld-link, etc.)

Diff Detail

Event Timeline

ayzhao created this revision.Apr 4 2022, 1:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 4 2022, 1:03 PM
ayzhao requested review of this revision.Apr 4 2022, 1:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 4 2022, 1:03 PM
epastor accepted this revision.Apr 4 2022, 1:08 PM

Thanks!

This revision is now accepted and ready to land.Apr 4 2022, 1:08 PM
hans added inline comments.Apr 5 2022, 2:34 AM
llvm/test/tools/llvm-ml/basic.test
3

This test would still pass if llvm-ml printed something like "error: invalid option: '/nologo'". It's probably safest to check that "nologo" isn't mentioned in the output at all.

llvm/tools/llvm-ml/Opts.td
70

For clang-cl we don't include ignored options in the /help output at all. See the cl_ignored_group in clang/include/clang/Driver/Options.td and how "nologo" is handled there. Maybe llvm-ml should handle ignored options similarly?

ayzhao updated this revision to Diff 420548.Apr 5 2022, 9:28 AM

Update test for nologo

ayzhao marked an inline comment as done.Apr 5 2022, 9:48 AM
ayzhao added inline comments.
llvm/tools/llvm-ml/Opts.td
70

I don't think there's a consistent approach here - both llvm-cvtres and llvm-mt have help text for this flag (and in fact, I copied this help text from llvm-mt).

ayzhao marked an inline comment as done.Apr 6 2022, 9:43 AM
hans accepted this revision.Apr 6 2022, 9:51 AM

I added a nitpick, but it's also fine if you want to land this now and worry about that later (or not).

llvm/tools/llvm-ml/Opts.td
70

It's a nitpick obviously, but I don't think the current help message is good:

  • It doesn't explain what the flag does: it assumes that the reader already knows what it's supposed to do (print the "copyright data"), and then explains that it won't do that
  • "Included for parity" is redundant, since *all* flags are included for parity with the original tool.

A better help text would be something like "Don't print startup banner (default)" or something like that. But just having no help text would be just as good.

I didn't realize llvm-cvtres and llvm-mt have the same issue, but I didn't review that code :-)

ayzhao updated this revision to Diff 420933.Apr 6 2022, 9:58 AM

Remove the HelpText

ayzhao marked an inline comment as done.Apr 6 2022, 9:59 AM
ayzhao added inline comments.
llvm/tools/llvm-ml/Opts.td
70

Ended up removing the HelpText.

This revision was landed with ongoing or failed builds.Apr 6 2022, 10:48 AM
Closed by commit rG912551dc6896: Add the /nologo flag to llvm-ml (authored by ayzhao, committed by hans). · Explain Why
This revision was automatically updated to reflect the committed changes.