This is an archive of the discontinued LLVM Phabricator instance.

[Clang][Docs] Consolidate option hiding in ClangOptionDocEmitter
ClosedPublic

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

Details

Summary

Update the hasFlag check to account for an Option's groups to better
match how the option parsing logic works, and instead of checking if a
group has include/exclude flags just check if there are any visible
options in it.

This cleans up some the empty sections that are currently emitted in
clang's option docs.

Diff Detail

Event Timeline

bogner created this revision.Aug 4 2023, 3:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 4 2023, 3:22 PM
Herald added a subscriber: mcrosier. · View Herald Transcript
bogner requested review of this revision.Aug 4 2023, 3:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 4 2023, 3:22 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
MaskRay accepted this revision.Aug 12 2023, 10:12 PM
MaskRay added inline comments.
clang/utils/TableGen/ClangOptionDocEmitter.cpp
43

For new functions, consider using static for internal linkage functions even if they are surrounded by an anonymous namespace, per https://llvm.org/docs/CodingStandards.html#anonymous-namespaces

This revision is now accepted and ready to land.Aug 12 2023, 10:12 PM
MaskRay added a comment.EditedAug 12 2023, 10:14 PM

The diff of docs-clang-html output is preferable:)

--- tools/clang/docs/html/ClangCommandLineReference.html.old    2023-08-12 22:09:58.900516809 -0700
+++ tools/clang/docs/html/ClangCommandLineReference.html        2023-08-12 22:10:23.876913374 -0700
@@ -94,18 +94,8 @@
 <li><p><a class="reference internal" href="#static-analyzer-options" id="id37">Static analyzer options</a></p></li>
 <li><p><a class="reference internal" href="#fortran-compilation-options" id="id38">Fortran compilation options</a></p></li>
 <li><p><a class="reference internal" href="#linker-options" id="id39">Linker options</a></p></li>
-<li><p><a class="reference internal" href="#clang-cl-options" id="id40">&lt;clang-cl options&gt;</a></p>
-<ul>
-<li><p><a class="reference internal" href="#clang-cl-compile-only-options" id="id41">&lt;clang-cl compile-only options&gt;</a></p>
-<ul>
-<li><p><a class="reference internal" href="#m-group" id="id42">&lt;/M group&gt;</a></p></li>
-<li><p><a class="reference internal" href="#volatile-group" id="id43">&lt;/volatile group&gt;</a></p></li>
-</ul>
-</li>
-<li><p><a class="reference internal" href="#clang-cl-ignored-options" id="id44">&lt;clang-cl ignored options&gt;</a></p></li>
-</ul>
-</li>
-<li><p><a class="reference internal" href="#clang-dxc-options" id="id45">&lt;clang-dxc options&gt;</a></p></li>
+<li><p><a class="reference internal" href="#clang-cl-options" id="id40">&lt;clang-cl options&gt;</a></p></li>
+<li><p><a class="reference internal" href="#clang-dxc-options" id="id41">&lt;clang-dxc options&gt;</a></p></li>
 </ul>
 </nav>
 <section id="introduction">
@@ -7878,21 +7868,9 @@
 <dd></dd></dl>

 <p>Set multiple /O flags at once; e.g. ‘/O2y-’ for ‘/O2 /Oy-’</p>
-<section id="clang-cl-compile-only-options">
-<h3><a class="toc-backref" href="#id41" role="doc-backlink">&lt;clang-cl compile-only options&gt;</a><a class="headerlink" href="#clang-cl-compile-only-options" title="Permalink to this heading">¶</a></h3>
-<section id="m-group">
-<h4><a class="toc-backref" href="#id42" role="doc-backlink">&lt;/M group&gt;</a><a class="headerlink" href="#m-group" title="Permalink to this heading">¶</a></h4>
-</section>
-<section id="volatile-group">
-<h4><a class="toc-backref" href="#id43" role="doc-backlink">&lt;/volatile group&gt;</a><a class="headerlink" href="#volatile-group" title="Permalink to this heading">¶</a></h4>
-</section>
-</section>
-<section id="clang-cl-ignored-options">
-<h3><a class="toc-backref" href="#id44" role="doc-backlink">&lt;clang-cl ignored options&gt;</a><a class="headerlink" href="#clang-cl-ignored-options" title="Permalink to this heading">¶</a></h3>
-</section>
 </section>
 <section id="clang-dxc-options">
-<h2><a class="toc-backref" href="#id45" role="doc-backlink">&lt;clang-dxc options&gt;</a><a class="headerlink" href="#clang-dxc-options" title="Permalink to this heading">¶</a></h2>
+<h2><a class="toc-backref" href="#id41" role="doc-backlink">&lt;clang-dxc options&gt;</a><a class="headerlink" href="#clang-dxc-options" title="Permalink to this heading">¶</a></h2>
 <p>dxc compatibility options</p>
 <dl class="std option">
 <dt class="sig sig-object std" id="cmdoption-clang5-E-arg">
bogner marked an inline comment as done.Aug 13 2023, 11:59 PM
This revision was landed with ongoing or failed builds.Aug 14 2023, 12:00 AM
This revision was automatically updated to reflect the committed changes.