This is an archive of the discontinued LLVM Phabricator instance.

[llvm][tools] Hide unrelated llvm-bcanalyzer options
ClosedPublic

Authored by tbaeder on Jul 13 2021, 7:53 AM.

Details

Summary

Dynamically linking against libLLVM.so otherwise shows all cl::opts scattered around the code base.

Per-tool follow-up of https://reviews.llvm.org/D104363

Diff Detail

Event Timeline

tbaeder created this revision.Jul 13 2021, 7:53 AM
tbaeder requested review of this revision.Jul 13 2021, 7:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2021, 7:53 AM
tbaeder updated this revision to Diff 358284.Jul 13 2021, 8:53 AM
MaskRay added a comment.EditedJul 13 2021, 3:55 PM

This patch needs test/tools/llvm-bcanalyzer/help.test. See @jhenderson's comment on the other thread: "It may also be a good idea to add testing similar to the llvm-strings test to show that only the expected options categories are present."

Consider a NOT pattern (https://llvm.org/docs/CommandGuide/FileCheck.html#the-check-not-directive) --implicit-check-not='{{[Oo]}}ptions:' to avoid undesired options categories>

tbaeder updated this revision to Diff 358557.Jul 14 2021, 4:32 AM

It doesn't seem very useful to me to add tests for the help output. Since all categories are listed in the HideUnrelatedOptions() call anyway, new categories are not just gonna show up without changing that call. And this one test doesn't cover new tools that are going to be added either.

Added the suggested test case anyway, with some modifications to make it work.

MaskRay accepted this revision.Jul 14 2021, 12:46 PM
MaskRay added inline comments.
llvm/test/tools/llvm-bcanalyzer/help.test
1 ↗(On Diff #358557)

Use --implicit-check-not='{{[Oo]}}ptions:'

3 ↗(On Diff #358557)

Make the OVERVIEW line complete.

This revision is now accepted and ready to land.Jul 14 2021, 12:46 PM
tbaeder updated this revision to Diff 358842.Jul 14 2021, 10:46 PM
jhenderson accepted this revision.Jul 15 2021, 12:48 AM

LGTM too.

This revision was landed with ongoing or failed builds.Jul 15 2021, 1:45 AM
This revision was automatically updated to reflect the committed changes.