[all-commits] [llvm/llvm-project] a16104: [Option] Add "Visibility" field and clone the OptT...

Justin Bogner via All-commits all-commits at lists.llvm.org
Mon Aug 14 13:27:35 PDT 2023


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

  Changed paths:
    M clang-tools-extra/clangd/CompileCommands.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    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/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:
  -----------
  [Option] Add "Visibility" field and clone the OptTable APIs to use it

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