[all-commits] [llvm/llvm-project] 9478f6: [Driver] Refactor to use llvm Option's new Visibil...

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


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9478f661c26fbc22491218477917df5d8d73c51c
      https://github.com/llvm/llvm-project/commit/9478f661c26fbc22491218477917df5d8d73c51c
  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-tools-extra/modularize/Modularize.cpp
    M clang/docs/InternalsManual.rst
    M clang/include/clang/Driver/ClangOptionDocs.td
    M clang/include/clang/Driver/Driver.h
    M clang/include/clang/Driver/Options.h
    M clang/include/clang/Driver/Options.td
    M clang/lib/Driver/Driver.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    M clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
    M clang/lib/Tooling/InterpolatingCompilationDatabase.cpp
    M clang/tools/driver/cc1as_main.cpp
    M clang/utils/TableGen/ClangOptionDocEmitter.cpp
    A clang/utils/update_options_td_flags.py
    M flang/docs/FlangDriver.md
    M flang/docs/FlangOptionsDocs.td
    M flang/lib/Frontend/CompilerInvocation.cpp
    M flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
    M flang/tools/flang-driver/driver.cpp
    M llvm/docs/ReleaseNotes.rst
    M llvm/include/llvm/Option/OptTable.h
    M llvm/lib/Option/OptTable.cpp
    M llvm/unittests/Option/OptionParsingTest.cpp

  Log Message:
  -----------
  [Driver] Refactor to use llvm Option's new Visibility flags

This is a big refactor of the clang driver's option handling to use
the Visibility flags introduced in https://reviews.llvm.org/D157149.
There are a few distinct parts, but they can't really be split into
separate commits and still be made to compile.

1. We split out some of the flags in ClangFlags to ClangVisibility.
   Note that this does not include any subtractive flags.

2. We update the Flag definitions and OptIn/OptOut constructs in
   Options.td by hand.

3. We introduce and use a script, update_options_td_flags, to ease
   migration of flag definitions in Options.td, and we run that on
   Options.td. I intend to remove this later, but I'm committing it so
   that downstream forks can use the script to simplify merging.

4. We update calls to OptTable in the clang driver, cc1as, flang, and
   clangd to use the visibility APIs instead of Include/Exclude flags.

5. We deprecate the Include/Exclude APIs and add a release note.

*if you are running into conflicts with this change:*

Note that https://reviews.llvm.org/D157150 may also be the culprit and
if so it should be handled first.

The script in `clang/utils/update_options_td_flags.py` can help. Take
the downstream side of all conflicts and then run the following:

```
% cd clang/include/clang/Driver
% ../../../utils/update_options_td_flags.py Options.td > Options.td.new
% mv Options.td.new Options.td
```

This will hopefully be sufficient, please take a look at the diff.

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




More information about the All-commits mailing list