[all-commits] [llvm/llvm-project] dcb6d2: Reapply "[Option] Add "Visibility" field and clone...

Justin Bogner via All-commits all-commits at lists.llvm.org
Tue Aug 15 01:17:56 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dcb6d212fdfb1db60bc5ba1c877897cb5ba0546c
  Author: Justin Bogner <mail at justinbogner.com>
  Date:   2023-08-15 (Tue, 15 Aug 2023)

  Changed paths:
    M clang-tools-extra/clangd/CompileCommands.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    M lld/COFF/DriverUtils.cpp
    M lld/MachO/DriverUtils.cpp
    M lld/MinGW/Driver.cpp
    M lld/wasm/Driver.cpp
    M lldb/tools/driver/Driver.cpp
    M lldb/tools/lldb-server/lldb-gdbserver.cpp
    M lldb/tools/lldb-vscode/lldb-vscode.cpp
    M llvm/include/llvm/Option/OptParser.td
    M llvm/include/llvm/Option/OptTable.h
    M llvm/include/llvm/Option/Option.h
    M llvm/lib/ExecutionEngine/JITLink/COFFDirectiveParser.cpp
    M llvm/lib/Option/OptTable.cpp
    M llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
    M llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
    M llvm/tools/dsymutil/dsymutil.cpp
    M llvm/tools/llvm-cvtres/llvm-cvtres.cpp
    M llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
    M llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp
    M llvm/tools/llvm-dwarfutil/llvm-dwarfutil.cpp
    M llvm/tools/llvm-dwp/llvm-dwp.cpp
    M llvm/tools/llvm-lipo/llvm-lipo.cpp
    M llvm/tools/llvm-mt/llvm-mt.cpp
    M llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
    M llvm/tools/llvm-rc/llvm-rc.cpp
    M llvm/tools/llvm-strings/llvm-strings.cpp
    M llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
    M llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp
    M llvm/unittests/Option/OptionMarshallingTest.cpp
    M llvm/unittests/Option/OptionParsingTest.cpp
    M llvm/unittests/Option/Opts.td
    M llvm/utils/TableGen/OptParserEmitter.cpp

  Log Message:
  Reapply "[Option] Add "Visibility" field and clone the OptTable APIs to use it"

This reverts commit 4e3b89483a6922d3f48670bb1c50a37f342918c6, with
fixes for places I'd missed updating in lld and lldb. I've also
renamed OptionVisibility::Default to "DefaultVis" to avoid ambiguity
since the undecorated name has to be available anywhere Options.inc is

Original message follows:

This splits OptTable's "Flags" field into "Flags" and "Visibility",
updates the places where we instantiate Option tables, and adds
variants of the OptTable APIs that use Visibility mask instead of
Include/Exclude flags.

We need to do this to clean up a bunch of complexity in the clang
driver's option handling - there's a whole slew of flags like
CoreOption, NoDriverOption, and FlangOnlyOption there today to try to
handle all of the permutations of flags that the various drivers need,
but it really doesn't scale well, as can be seen by things like the
somewhat recently introduced CLDXCOption.

Instead, we'll provide an additive model for visibility that's
separate from the other flags. For things like "HelpHidden", which is
used as a "subtractive" modifier for option visibility, we leave that
in "Flags" and handle it as a special case.

Note that we don't actually update the users of the Include/Exclude
APIs here or change the flags that exist in clang at all - that will
come in a follow up that refactors clang's Options.td to use the
increased flexibility this change allows.

Differential Revision: https://reviews.llvm.org/D157149

More information about the All-commits mailing list