about summary refs log tree commit diff
path: root/absl/flags/internal/commandlineflag.h
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2020-01-03T16·41-0800
committerAndy Soffer <asoffer@google.com>2020-01-03T18·41-0500
commit1de0166368e2ae67347f92099d6dca3ab3a4a496 (patch)
treecad7784fab3a1d673d140143f0d6eb70b16dde96 /absl/flags/internal/commandlineflag.h
parentad904b6cd3906ddf79878003d92b7bc08d7786ae (diff)
Export of internal Abseil changes
--
330051e00cd57ee516b4eaf656965656ffbcd0bc by Abseil Team <absl-team@google.com>:

Fix indentation in comment.

PiperOrigin-RevId: 287997504

--
35fb1a893e708031ba4fc0db460875eb0d31820e by Abseil Team <absl-team@google.com>:

Enable compile-time enforcement that absl::Substitute patterns to not contain unescaped $ symbols.

absl::Substitute already considers unescaped $ symbols undefined behavior and crashes when it's passed them in debug builds.  Some code isn't ever built in debug mode, though, and inadvertently used some unescaped $ symbols, which led to surprising results.  This change will prevent that problem from happening in the future.
PiperOrigin-RevId: 287906643

--
c5762833ebde6d7110bf68041a823b571c238e9e by Gennadiy Rozental <rogeeff@google.com>:

Move all the flag data into a single place instead of being split between handle and flag object.

After this change CommandLineFlag will not hold any data anymore. And we also do not need to pass the CommandLineFlag around in Abseil Flag implementation to report flag name and location.

PiperOrigin-RevId: 287899076

--
8b5fb644f1e3d9267b7a75106fe9a72c886db786 by Derek Mauro <dmauro@google.com>:

Upgrade CI testing to Bazel 2.0.0 and Clang 407ac2eb5f13

-fno-sanitize-blacklist is to workaround
https://github.com/bazelbuild/bazel/issues/10510

PiperOrigin-RevId: 287875363

--
a20cc1d58895de2babc3748a6c79d1d6813734ef by Abseil Team <absl-team@google.com>:

Make ABSL_RETIRED_FLAG behave consistently with ABSL_FLAG.

Before the change:
ABSL_RETIRED_FLAG does not compile when there are competing ctors in the type, even when ABSL_FLAG does.

After the change:
ABSL_RETIRED_FLAG compiles when ABSL_FLAG does.

PiperOrigin-RevId: 286483183

--
1cff7e67329d2be9e50bee1f2e76ef9ffd2edde5 by Abseil Team <absl-team@google.com>:

Support C++20 erase_if API in unordered associative containers

See [unord.set.erasure]: https://eel.is/c++draft/unord.set.erasure
See [unord.map.erasure]: https://eel.is/c++draft/unord.map.erasure

PiperOrigin-RevId: 286461140
GitOrigin-RevId: 330051e00cd57ee516b4eaf656965656ffbcd0bc
Change-Id: I5513110b41c2af08a44da54612cff341ac5c6607
Diffstat (limited to 'absl/flags/internal/commandlineflag.h')
-rw-r--r--absl/flags/internal/commandlineflag.h26
1 files changed, 11 insertions, 15 deletions
diff --git a/absl/flags/internal/commandlineflag.h b/absl/flags/internal/commandlineflag.h
index 49e13d1e726b..a0c18e80b6c7 100644
--- a/absl/flags/internal/commandlineflag.h
+++ b/absl/flags/internal/commandlineflag.h
@@ -61,8 +61,6 @@ enum ValueSource {
   kProgrammaticChange,
 };
 
-extern const char kStrippedFlagHelp[];
-
 // The per-type function
 template <typename T>
 void* FlagOps(FlagOp op, const void* v1, void* v2) {
@@ -155,8 +153,7 @@ class FlagStateInterface {
 // Holds all information for a flag.
 class CommandLineFlag {
  public:
-  constexpr CommandLineFlag(const char* name, const char* filename)
-      : name_(name), filename_(filename) {}
+  constexpr CommandLineFlag() = default;
 
   // Virtual destructor
   virtual void Destroy() = 0;
@@ -166,9 +163,6 @@ class CommandLineFlag {
   CommandLineFlag& operator=(const CommandLineFlag&) = delete;
 
   // Non-polymorphic access methods.
-  absl::string_view Name() const { return name_; }
-  absl::string_view Typename() const;
-  std::string Filename() const;
 
   // Return true iff flag has type T.
   template <typename T>
@@ -190,8 +184,7 @@ class CommandLineFlag {
     //
     //  1. `U.value` has correct size and alignment for a value of type `T`
     //  2. The `U.value` constructor is not invoked since U's constructor does
-    //  not
-    //     do it explicitly.
+    //     not do it explicitly.
     //  3. The `U.value` destructor is invoked since U's destructor does it
     //     explicitly. This makes `U` a kind of RAII wrapper around non default
     //     constructible value of T, which is destructed when we leave the
@@ -213,9 +206,16 @@ class CommandLineFlag {
 
   // Polymorphic access methods
 
-  // Returns help message associated with this flag
+  // Returns name of this flag.
+  virtual absl::string_view Name() const = 0;
+  // Returns name of the file where this flag is defined.
+  virtual std::string Filename() const = 0;
+  // Returns name of the flag's value type for some built-in types or empty
+  // std::string.
+  virtual absl::string_view Typename() const = 0;
+  // Returns help message associated with this flag.
   virtual std::string Help() const = 0;
-  // Returns true iff this object corresponds to retired flag
+  // Returns true iff this object corresponds to retired flag.
   virtual bool IsRetired() const { return false; }
   // Returns true iff this is a handle to an Abseil Flag.
   virtual bool IsAbseilFlag() const { return true; }
@@ -253,10 +253,6 @@ class CommandLineFlag {
  protected:
   ~CommandLineFlag() = default;
 
-  // Constant configuration for a particular flag.
-  const char* const name_;      // Flags name passed to ABSL_FLAG as second arg.
-  const char* const filename_;  // The file name where ABSL_FLAG resides.
-
  private:
   // Copy-construct a new value of the flag's type in a memory referenced by
   // the dst based on the current flag's value.