This is an archive of the discontinued LLVM Phabricator instance.

[doc] Rely on tblgen to dump supported options value when generating doc
ClosedPublic

Authored by serge-sans-paille on Mar 24 2022, 3:22 AM.

Details

Summary

It was already the case for CLI help, also support it for rst output. As a side
effect remove redundant (and sometime inconsistent!) value help from HelpText in
clang/Driver/Options.td.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptMar 24 2022, 3:22 AM
serge-sans-paille requested review of this revision.Mar 24 2022, 3:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 24 2022, 3:22 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Thanks for the additional docs!

clang/docs/ClangCommandLineReference.rst
2616 ↗(On Diff #417864)

From looking at Options.td, it seems there are more visibility values we support as synonyms: https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Driver/Options.td#L472

Should we list those and document their nature?

aaron.ballman requested changes to this revision.Mar 24 2022, 5:54 AM

Btw, you're changing a generated .rst file. You need to fix up the documentation in Options.td which is used to generate this .rst file. I don't know that you'll be able to change the option values the way you have, though; at least, not without adding some logic to the tabelgen code.

This revision now requires changes to proceed.Mar 24 2022, 5:54 AM

thanks for the guidance. I'll check if I can update tablegen to generate possible options then :-)

serge-sans-paille retitled this revision from Be more explicit about -fvisibility=<arg> documentation to [doc] Rely on tblgen to dump supported options value when generating doc.
serge-sans-paille edited the summary of this revision. (Show Details)

Moved to a generic approach as suggested by reviewer.

Herald added a project: Restricted Project. · View Herald TranscriptMar 28 2022, 7:04 AM

Minor Options.td nits

aaron.ballman accepted this revision.Mar 28 2022, 12:47 PM

LGTM, thank you for this!

This revision is now accepted and ready to land.Mar 28 2022, 12:47 PM
This revision was landed with ongoing or failed builds.Mar 29 2022, 3:25 AM
This revision was automatically updated to reflect the committed changes.
MaskRay added a subscriber: MaskRay.EditedApr 12 2022, 1:41 PM

clang-tblgen --gen-opt-docs -I ../llvm/include -I include/clang/Driver include/clang/Driver/ClangOptionDocs.td

For -gsplit-dwarf, the message has lost information (the choices split/single are not listed). I have found similar patterns for other options.

 .. option:: -gsplit-dwarf=<arg>
 .. program:: clang
 
-Set DWARF fission mode to either 'split' or 'single'
+Set DWARF fission mode
 
 .. option:: -gstrict-dwarf, -gno-strict-dwarf