summaryrefslogtreecommitdiff
path: root/absl/strings
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2023-01-26 09:43:17 -0800
committerGravatar Copybara-Service <copybara-worker@google.com>2023-01-26 09:44:03 -0800
commitc21bd95257bd0978824e12d91a6f8975a506877f (patch)
tree0471b9afb5aa2c2ab1e78000ce53c675292dbfc9 /absl/strings
parentb4705164197f8b10ef4c50f517e9434ada7607f8 (diff)
Add lifetime annotations to AlphaNum.
PiperOrigin-RevId: 504866618 Change-Id: I9519299946c693ae1bedd769a25a9cb5137f2f54
Diffstat (limited to 'absl/strings')
-rw-r--r--absl/strings/str_cat.h22
1 files changed, 14 insertions, 8 deletions
diff --git a/absl/strings/str_cat.h b/absl/strings/str_cat.h
index 730b4d8c..8b68dac0 100644
--- a/absl/strings/str_cat.h
+++ b/absl/strings/str_cat.h
@@ -94,6 +94,7 @@
#include <utility>
#include <vector>
+#include "absl/base/attributes.h"
#include "absl/base/port.h"
#include "absl/strings/internal/has_absl_stringify.h"
#include "absl/strings/internal/stringify_sink.h"
@@ -287,23 +288,28 @@ class AlphaNum {
template <size_t size>
AlphaNum( // NOLINT(runtime/explicit)
- const strings_internal::AlphaNumBuffer<size>& buf)
+ const strings_internal::AlphaNumBuffer<size>& buf
+ ABSL_ATTRIBUTE_LIFETIME_BOUND)
: piece_(&buf.data[0], buf.size) {}
- AlphaNum(const char* c_str) // NOLINT(runtime/explicit)
- : piece_(NullSafeStringView(c_str)) {} // NOLINT(runtime/explicit)
- AlphaNum(absl::string_view pc) : piece_(pc) {} // NOLINT(runtime/explicit)
+ AlphaNum(const char* c_str // NOLINT(runtime/explicit)
+ ABSL_ATTRIBUTE_LIFETIME_BOUND)
+ : piece_(NullSafeStringView(c_str)) {}
+ AlphaNum(absl::string_view pc // NOLINT(runtime/explicit)
+ ABSL_ATTRIBUTE_LIFETIME_BOUND)
+ : piece_(pc) {}
template <typename T, typename = typename std::enable_if<
strings_internal::HasAbslStringify<T>::value>::type>
- AlphaNum( // NOLINT(runtime/explicit)
- const T& v, // NOLINT(runtime/explicit)
- strings_internal::StringifySink&& sink = {}) // NOLINT(runtime/explicit)
+ AlphaNum( // NOLINT(runtime/explicit)
+ const T& v ABSL_ATTRIBUTE_LIFETIME_BOUND,
+ strings_internal::StringifySink&& sink ABSL_ATTRIBUTE_LIFETIME_BOUND = {})
: piece_(strings_internal::ExtractStringification(sink, v)) {}
template <typename Allocator>
AlphaNum( // NOLINT(runtime/explicit)
- const std::basic_string<char, std::char_traits<char>, Allocator>& str)
+ const std::basic_string<char, std::char_traits<char>, Allocator>& str
+ ABSL_ATTRIBUTE_LIFETIME_BOUND)
: piece_(str) {}
// Use string literals ":" instead of character literals ':'.