about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2020-05-01T16·13-0700
committerGennadiy Rozental <rogeeff@google.com>2020-05-01T21·22-0400
commita1d6689907864974118e592ef2ac7d716c576aad (patch)
treed7ccf22b525548f782567b4d99f87c84d1ea0a33
parentca9856cabc23d771bcce634677650eb6fc4363ae (diff)
Export of internal Abseil changes
--
28f0285638324bb04c20304cf14e5ade25420f1f by Gennadiy Rozental <rogeeff@google.com>:

Make CheckDefaultValueParsingRoundtrip private in CommandLineFlag.

PiperOrigin-RevId: 309417330
GitOrigin-RevId: 28f0285638324bb04c20304cf14e5ade25420f1f
Change-Id: I8dfed7005b3e5d58232df786e65fa7565ae72be8
-rw-r--r--absl/flags/internal/commandlineflag.cc5
-rw-r--r--absl/flags/internal/commandlineflag.h11
-rw-r--r--absl/flags/parse.cc3
3 files changed, 14 insertions, 5 deletions
diff --git a/absl/flags/internal/commandlineflag.cc b/absl/flags/internal/commandlineflag.cc
index de588c13166b..f1e50d01ec8d 100644
--- a/absl/flags/internal/commandlineflag.cc
+++ b/absl/flags/internal/commandlineflag.cc
@@ -37,6 +37,11 @@ bool PrivateHandleInterface::ValidateInputValue(const CommandLineFlag& flag,
   return flag.ValidateInputValue(value);
 }
 
+void PrivateHandleInterface::CheckDefaultValueParsingRoundtrip(
+    const CommandLineFlag& flag) {
+  flag.CheckDefaultValueParsingRoundtrip();
+}
+
 }  // namespace flags_internal
 ABSL_NAMESPACE_END
 }  // namespace absl
diff --git a/absl/flags/internal/commandlineflag.h b/absl/flags/internal/commandlineflag.h
index f807fb9ab650..f60204dd6256 100644
--- a/absl/flags/internal/commandlineflag.h
+++ b/absl/flags/internal/commandlineflag.h
@@ -151,10 +151,6 @@ class CommandLineFlag {
                          flags_internal::ValueSource source,
                          std::string* error) = 0;
 
-  // Checks that flags default value can be converted to string and back to the
-  // flag's value type.
-  virtual void CheckDefaultValueParsingRoundtrip() const = 0;
-
  protected:
   ~CommandLineFlag() = default;
 
@@ -175,6 +171,10 @@ class CommandLineFlag {
   // Interfaces to operate on validators.
   // Validates supplied value usign validator or parseflag routine
   virtual bool ValidateInputValue(absl::string_view value) const = 0;
+
+  // Checks that flags default value can be converted to string and back to the
+  // flag's value type.
+  virtual void CheckDefaultValueParsingRoundtrip() const = 0;
 };
 
 // This class serves as a trampoline to access private methods of
@@ -191,6 +191,9 @@ class PrivateHandleInterface {
   // Access to CommandLineFlag::ValidateInputValue.
   static bool ValidateInputValue(const CommandLineFlag& flag,
                                  absl::string_view value);
+
+  // Access to CommandLineFlag::CheckDefaultValueParsingRoundtrip.
+  static void CheckDefaultValueParsingRoundtrip(const CommandLineFlag& flag);
 };
 
 // This macro is the "source of truth" for the list of supported flag built-in
diff --git a/absl/flags/parse.cc b/absl/flags/parse.cc
index b60b36f60868..b76edc62d9b0 100644
--- a/absl/flags/parse.cc
+++ b/absl/flags/parse.cc
@@ -298,7 +298,8 @@ void CheckDefaultValuesParsingRoundtrip() {
     ABSL_FLAGS_INTERNAL_BUILTIN_TYPES(IGNORE_TYPE)
 #undef IGNORE_TYPE
 
-    flag->CheckDefaultValueParsingRoundtrip();
+    flags_internal::PrivateHandleInterface::CheckDefaultValueParsingRoundtrip(
+        *flag);
   });
 #endif
 }