diff options
Diffstat (limited to 'third_party/abseil_cpp/absl/flags/internal/registry.h')
-rw-r--r-- | third_party/abseil_cpp/absl/flags/internal/registry.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/third_party/abseil_cpp/absl/flags/internal/registry.h b/third_party/abseil_cpp/absl/flags/internal/registry.h index 6f5006a016fd..a8d9eb9cb0bb 100644 --- a/third_party/abseil_cpp/absl/flags/internal/registry.h +++ b/third_party/abseil_cpp/absl/flags/internal/registry.h @@ -30,9 +30,6 @@ namespace absl { ABSL_NAMESPACE_BEGIN namespace flags_internal { -// Executes specified visitor for each non-retired flag in the registry. -// Requires the caller hold the registry lock. -void ForEachFlagUnlocked(std::function<void(CommandLineFlag&)> visitor); // Executes specified visitor for each non-retired flag in the registry. While // callback are executed, the registry is locked and can't be changed. void ForEachFlag(std::function<void(CommandLineFlag&)> visitor); @@ -41,6 +38,8 @@ void ForEachFlag(std::function<void(CommandLineFlag&)> visitor); bool RegisterCommandLineFlag(CommandLineFlag&); +void FinalizeRegistry(); + //----------------------------------------------------------------------------- // Retired registrations: // @@ -74,13 +73,22 @@ bool RegisterCommandLineFlag(CommandLineFlag&); // // Retire flag with name "name" and type indicated by ops. -bool Retire(const char* name, FlagFastTypeId type_id); +void Retire(const char* name, FlagFastTypeId type_id, char* buf); + +constexpr size_t kRetiredFlagObjSize = 3 * sizeof(void*); +constexpr size_t kRetiredFlagObjAlignment = alignof(void*); // Registered a retired flag with name 'flag_name' and type 'T'. template <typename T> -inline bool RetiredFlag(const char* flag_name) { - return flags_internal::Retire(flag_name, base_internal::FastTypeId<T>()); -} +class RetiredFlag { + public: + void Retire(const char* flag_name) { + flags_internal::Retire(flag_name, base_internal::FastTypeId<T>(), buf_); + } + + private: + alignas(kRetiredFlagObjAlignment) char buf_[kRetiredFlagObjSize]; +}; } // namespace flags_internal ABSL_NAMESPACE_END |