Add absl_nonnull annotations to absl::CommandLineFlag
PiperOrigin-RevId: 853478421
Change-Id: I895218e9f40a012338aa27d706626c435e3d1ec6
diff --git a/absl/flags/BUILD.bazel b/absl/flags/BUILD.bazel
index f928609..a5ee2c7 100644
--- a/absl/flags/BUILD.bazel
+++ b/absl/flags/BUILD.bazel
@@ -151,6 +151,7 @@
":commandlineflag_internal",
"//absl/base:config",
"//absl/base:fast_type_id",
+ "//absl/base:nullability",
"//absl/strings",
"//absl/types:optional",
],
diff --git a/absl/flags/CMakeLists.txt b/absl/flags/CMakeLists.txt
index d0ea452..3ec254a 100644
--- a/absl/flags/CMakeLists.txt
+++ b/absl/flags/CMakeLists.txt
@@ -128,6 +128,7 @@
absl::config
absl::fast_type_id
absl::flags_commandlineflag_internal
+ absl::nullability
absl::optional
absl::strings
)
diff --git a/absl/flags/commandlineflag.h b/absl/flags/commandlineflag.h
index 9098b4c..1a9743c 100644
--- a/absl/flags/commandlineflag.h
+++ b/absl/flags/commandlineflag.h
@@ -31,6 +31,7 @@
#include "absl/base/config.h"
#include "absl/base/fast_type_id.h"
+#include "absl/base/nullability.h"
#include "absl/flags/internal/commandlineflag.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
@@ -158,7 +159,7 @@
// Sets the value of the flag based on specified string `value`. If the flag
// was successfully set to new value, it returns true. Otherwise, sets `error`
// to indicate the error, leaves the flag unchanged, and returns false.
- bool ParseFrom(absl::string_view value, std::string* error);
+ bool ParseFrom(absl::string_view value, std::string* absl_nonnull error);
protected:
~CommandLineFlag() = default;
@@ -188,7 +189,7 @@
// Copy-construct a new value of the flag's type in a memory referenced by
// the dst based on the current flag's value.
- virtual void Read(void* dst) const = 0;
+ virtual void Read(void* absl_nonnull dst) const = 0;
// To be deleted. Used to return true if flag's current value originated from
// command line.