diff options
author | Abseil Team <absl-team@google.com> | 2020-02-07T21·06-0800 |
---|---|---|
committer | Andy Getz <durandal@google.com> | 2020-02-07T21·58-0500 |
commit | d95d1567165d449e4c213ea31a15cbb112a9865f (patch) | |
tree | fee6dca04f49a417f87c4c96551f366279cf9b61 /absl/flags/internal/flag.cc | |
parent | 24713a7036a81498334807fa5c7ad3cb7c643711 (diff) |
Export of internal Abseil changes
-- 832be2d52d7695cf72fd70248909791fb8ad1003 by Gennadiy Rozental <rogeeff@google.com>: Migrate some FlagImpl fields to bit fields. To save padding space we are migrating some fields representing bool and enums into bit fields. Eventually we'll use remaining padding space for call_once control flag. No other semantic changes made in this CL. PiperOrigin-RevId: 293878165 -- 09162bba5fd8eddacfd732d46fcfeb33074a259f by Samuel Benzaquen <sbenza@google.com>: Correctly initialize the `length_mod` member. Now that it is a raw enum, the default initialization is not enough. PiperOrigin-RevId: 293827817 -- 842b7b805d75c5ab670c52ccd7368cdeba11853d by Matthew Brown <matthewbr@google.com>: Move str_format_internal::LengthMod from extension.h to parser.h; change to enum PiperOrigin-RevId: 293697274 GitOrigin-RevId: 832be2d52d7695cf72fd70248909791fb8ad1003 Change-Id: I90899519e9480543e22638616fdf31a41e7f75c0
Diffstat (limited to 'absl/flags/internal/flag.cc')
-rw-r--r-- | absl/flags/internal/flag.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/absl/flags/internal/flag.cc b/absl/flags/internal/flag.cc index 3df8d82cfede..6ce7def2d3d2 100644 --- a/absl/flags/internal/flag.cc +++ b/absl/flags/internal/flag.cc @@ -120,7 +120,7 @@ void FlagImpl::Destroy() { if (value_.dynamic) Delete(op_, value_.dynamic); // Release the dynamically allocated default value if any. - if (def_kind_ == FlagDefaultSrcKind::kDynamicValue) { + if (DefaultKind() == FlagDefaultKind::kDynamicValue) { Delete(op_, default_src_.dynamic_value); } @@ -135,7 +135,7 @@ void FlagImpl::Destroy() { std::unique_ptr<void, DynValueDeleter> FlagImpl::MakeInitValue() const { void* res = nullptr; - if (def_kind_ == FlagDefaultSrcKind::kDynamicValue) { + if (DefaultKind() == FlagDefaultKind::kDynamicValue) { res = Clone(op_, default_src_.dynamic_value); } else { res = (*default_src_.gen_func)(); @@ -150,8 +150,8 @@ std::string FlagImpl::Filename() const { } std::string FlagImpl::Help() const { - return help_source_kind_ == FlagHelpKind::kLiteral ? help_.literal - : help_.gen_func(); + return HelpSourceKind() == FlagHelpKind::kLiteral ? help_.literal + : help_.gen_func(); } bool FlagImpl::IsModified() const { @@ -364,7 +364,7 @@ bool FlagImpl::SetFromString(absl::string_view value, FlagSettingMode set_mode, break; } case SET_FLAGS_DEFAULT: { - if (def_kind_ == FlagDefaultSrcKind::kDynamicValue) { + if (DefaultKind() == FlagDefaultKind::kDynamicValue) { if (!TryParse(&default_src_.dynamic_value, value, err)) { return false; } @@ -375,7 +375,7 @@ bool FlagImpl::SetFromString(absl::string_view value, FlagSettingMode set_mode, } default_src_.dynamic_value = new_default_val; - def_kind_ = FlagDefaultSrcKind::kDynamicValue; + def_kind_ = static_cast<uint8_t>(FlagDefaultKind::kDynamicValue); } if (!modified_) { |