This is an archive of the discontinued LLVM Phabricator instance.

[Driver] Update BoolOption to handle Visibility. NFC
ClosedPublic

Authored by bogner on Aug 4 2023, 3:52 PM.

Details

Summary

This updates the BoolOption family of option definitions to do the
right thing with llvm::opt::Visibility. The only meaningful visibility
at this point is llvm::opt::DefaultVis - in the interest of clarity we
add an alias for this called "ClangOption" and update PosFlag,
NegFlag, and BothFlags definitions to specify that.

The updates to option definitions were done with the following three
sed scripts (one to update Pos/NegFlag, one for BothFlags, and one
that just cleans up whitespace a little):

sed -E 's/((Pos|Neg)Flag<[A-Za-z]*, \[[^]]*\])(, "|>|,$)/\1, [ClangOption]\3/g'
sed -E 's/(BothFlags<\[[^]]*\])(, ")/\1, [ClangOption], "/'
sed -E 's/( *)((Pos|Neg)Flag<.*), ((Pos|Neg)Flag)/\1\2,\n\1\4/'

These are idempotent and should be runnable on downstream versions of
Options.td if needed to update any additional flags that are present.

Diff Detail

Event Timeline

bogner created this revision.Aug 4 2023, 3:52 PM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: mcrosier. · View Herald Transcript
bogner requested review of this revision.Aug 4 2023, 3:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 4 2023, 3:52 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
MaskRay accepted this revision.Aug 13 2023, 9:32 PM

LGTM once the https://reviews.llvm.org/D157151#4582109 "Default" naming discussion is agreed.

This revision is now accepted and ready to land.Aug 13 2023, 9:32 PM
bogner updated this revision to Diff 549853.Aug 14 2023, 3:05 AM

Use "ClangOption" rather than "Default" in Options.td, as per the conversation in https://reviews.llvm.org/D157151

bogner edited the summary of this revision. (Show Details)Aug 14 2023, 3:10 AM
bogner updated this revision to Diff 550125.Aug 14 2023, 4:27 PM
bogner edited the summary of this revision. (Show Details)

Rebase on top of "DefaultVis" naming

bogner updated this revision to Diff 550224.Aug 15 2023, 2:33 AM

Rebase on top of "Visibility" naming.

MaskRay accepted this revision.Aug 15 2023, 8:16 AM
This revision was landed with ongoing or failed builds.Aug 15 2023, 1:14 PM
This revision was automatically updated to reflect the committed changes.