[all-commits] [llvm/llvm-project] 7e958f: [flang][clang] Add Visibility specific help text f...

David Spickett via All-commits all-commits at lists.llvm.org
Fri Apr 5 01:03:37 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7e958f64efea6cb824e96ace51e021afbc150922
      https://github.com/llvm/llvm-project/commit/7e958f64efea6cb824e96ace51e021afbc150922
  Author: David Spickett <david.spickett at linaro.org>
  Date:   2024-04-05 (Fri, 05 Apr 2024)

  Changed paths:
    M clang-tools-extra/clangd/CompileCommands.cpp
    M clang/include/clang/Driver/Options.td
    M clang/lib/Frontend/CompilerInvocation.cpp
    M clang/utils/TableGen/ClangOptionDocEmitter.cpp
    M flang/test/Driver/driver-help-hidden.f90
    M flang/test/Driver/driver-help.f90
    M lld/MachO/DriverUtils.cpp
    M lld/MinGW/Driver.cpp
    M lld/wasm/Driver.cpp
    M llvm/include/llvm/Option/OptParser.td
    M llvm/include/llvm/Option/OptTable.h
    M llvm/lib/Option/OptTable.cpp
    M llvm/unittests/Option/OptionMarshallingTest.cpp
    M llvm/utils/TableGen/OptParserEmitter.cpp

  Log Message:
  -----------
  [flang][clang] Add Visibility specific help text for options (#81869)

And use it to print the correct default OpenMP version for flang and
flang -fc1.

This change adds an optional `HelpTextsForVariants` to options. This
allows you to change the help text that gets shown in documentation and
`--help` based on the program its being generated for.

As `OptTable` needs to be constexpr compatible, I have used a std::array
of help text variants. Each entry is:
(list of visibilities) - > help text string

So for the OpenMP version we have (flang, fc1) -> "OpenMP version for
flang is...".

So you can have multiple visibilities use the same string. The number of
entries is currently set to 1, and the number of visibilities per entry
is 2, because that's the maximum we need for now. The code is written so
we can increase these numbers later, and the unused elements will be initialised.

I have not applied this to group descriptions just because I don't know
of one that needs changing. It could easily be enabled for those too if
needed. There are minor changes to them just to get it all to compile.

This approach of storing many help strings per option in the 1 driver
library seemed preferable to making a whole new library for Flang (even
if that would mostly be including stuff from Clang).



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list