[all-commits] [llvm/llvm-project] 252fc5: [Option] Add BoolOrDefault for OptionalBoolField a...

Fangrui Song via All-commits all-commits at lists.llvm.org
Sat Oct 3 23:35:32 PDT 2026


  Branch: refs/heads/users/MaskRay/bool-or-default
  Home:   https://github.com/llvm/llvm-project
  Commit: 252fc57718dca74c622137bba3a06ac78899b29b
      https://github.com/llvm/llvm-project/commit/252fc57718dca74c622137bba3a06ac78899b29b
  Author: Fangrui Song <i at maskray.me>
  Date:   2026-10-03 (Sat, 03 Oct 2026)

  Changed paths:
    M llvm/docs/CommandLine.md
    A llvm/include/llvm/ADT/BoolOrDefault.h
    M llvm/include/llvm/Option/LibraryOptions.h
    M llvm/include/llvm/Option/LibraryOptions.td
    M llvm/lib/MC/MCAsmInfo.cpp
    M llvm/lib/MC/MCAsmInfoXCOFF.cpp
    M llvm/unittests/Option/LibraryOptionsTest.cpp
    M llvm/utils/TableGen/Basic/OptionParserEmitter.cpp

  Log Message:
  -----------
  [Option] Add BoolOrDefault for OptionalBoolField and DefaultOnOffField

The members of OptionalBoolField and DefaultOnOffField are
std::optional<bool>, on which `if (X)` tests whether the option is
given, not its value. Make them a new 1-byte `enum class BoolOrDefault :
uint8_t { Default, False, True }`, which does not convert to bool, and
read them with `valueOr(X, Default)`. A FlagOrEq without a value is
parsed as =true, so that it can set either member type.

Aided by Opus 5.5



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