[all-commits] [llvm/llvm-project] b61639: [clang][cli] NFC: Simplify BoolOption API

Jan Svoboda via All-commits all-commits at lists.llvm.org
Mon Jan 25 23:46:48 PST 2021


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b61639985e216e75727f623174ec32a2a7cf40e3
      https://github.com/llvm/llvm-project/commit/b61639985e216e75727f623174ec32a2a7cf40e3
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2021-01-26 (Tue, 26 Jan 2021)

  Changed paths:
    M clang/include/clang/Driver/Options.td

  Log Message:
  -----------
  [clang][cli] NFC: Simplify BoolOption API

The `Bool{,F,G}Option` TableGen classes were designed after `Opt{In,Out}FFlag`, which put marshalling info on only one of the boolean options. To encode which record is supposed to carry the marshalling info (and be visible on -cc1 command-line), we used the `ChangedBy` and `ResetBy` classes.

However, we need to put marshalling info on both records anyways (see D93008 for details). This means we don't really need the distinction between `ChangedBy/ResetBy + BoolOption` and `FlagDef + BoolOptionBase` anymore.

This patch reduces the number of ways one can encode the marshalling information for pairs of boolean flags. Regardless of whether the key path value defaults to a statically known boolean, or a result of an expression, one can always use the new `BoolOption` and `PosFlag<SetTrue>, NegFlag<SetFalse>` syntax.

Reviewed By: dexonsmith

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




More information about the All-commits mailing list