Add ABSL_ATTRIBUTE_LIFETIME_BOUND to Flag help generator
Since this method is only called by `NonConst` which immediately converts it to a `std::string`, this is currently safe. Add annotation nevertheless to show the contract.
This currently makes the majority of lifetime annotation suggestion provided by the lifetime analysis https://godbolt.org/z/hKvrE1hG1
PiperOrigin-RevId: 843275432
Change-Id: Ib1a0513eca944a9c7c4c612c3111bf05881c746d
diff --git a/absl/flags/flag.h b/absl/flags/flag.h
index e052d5f..4c328e3 100644
--- a/absl/flags/flag.h
+++ b/absl/flags/flag.h
@@ -241,7 +241,8 @@
/* default value argument. That keeps temporaries alive */ \
/* long enough for NonConst to work correctly. */ \
static constexpr absl::string_view Value( \
- absl::string_view absl_flag_help = ABSL_FLAG_IMPL_FLAGHELP(txt)) { \
+ absl::string_view absl_flag_help ABSL_ATTRIBUTE_LIFETIME_BOUND = \
+ ABSL_FLAG_IMPL_FLAGHELP(txt)) { \
return absl_flag_help; \
} \
static std::string NonConst() { return std::string(Value()); } \