mirror of
https://github.com/abseil/abseil-cpp.git
synced 2026-06-04 12:07:05 +08:00
Automated Code Change
PiperOrigin-RevId: 744017203 Change-Id: I69b4418b306bdb5f89194bbcddaed9813e46ec6f
This commit is contained in:
committed by
Copybara-Service
parent
b011118c1c
commit
d97663ee23
@@ -49,8 +49,8 @@ ABSL_NAMESPACE_BEGIN
|
||||
class once_flag;
|
||||
|
||||
namespace base_internal {
|
||||
absl::Nonnull<std::atomic<uint32_t>*> ControlWord(
|
||||
absl::Nonnull<absl::once_flag*> flag);
|
||||
std::atomic<uint32_t>* absl_nonnull ControlWord(
|
||||
absl::once_flag* absl_nonnull flag);
|
||||
} // namespace base_internal
|
||||
|
||||
// call_once()
|
||||
@@ -93,8 +93,8 @@ class once_flag {
|
||||
once_flag& operator=(const once_flag&) = delete;
|
||||
|
||||
private:
|
||||
friend absl::Nonnull<std::atomic<uint32_t>*> base_internal::ControlWord(
|
||||
absl::Nonnull<once_flag*> flag);
|
||||
friend std::atomic<uint32_t>* absl_nonnull base_internal::ControlWord(
|
||||
once_flag* absl_nonnull flag);
|
||||
std::atomic<uint32_t> control_;
|
||||
};
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace base_internal {
|
||||
// Like call_once, but uses KERNEL_ONLY scheduling. Intended to be used to
|
||||
// initialize entities used by the scheduler implementation.
|
||||
template <typename Callable, typename... Args>
|
||||
void LowLevelCallOnce(absl::Nonnull<absl::once_flag*> flag, Callable&& fn,
|
||||
void LowLevelCallOnce(absl::once_flag* absl_nonnull flag, Callable&& fn,
|
||||
Args&&... args);
|
||||
|
||||
// Disables scheduling while on stack when scheduling mode is non-cooperative.
|
||||
@@ -150,7 +150,7 @@ enum {
|
||||
|
||||
template <typename Callable, typename... Args>
|
||||
void
|
||||
CallOnceImpl(absl::Nonnull<std::atomic<uint32_t>*> control,
|
||||
CallOnceImpl(std::atomic<uint32_t>* absl_nonnull control,
|
||||
base_internal::SchedulingMode scheduling_mode, Callable&& fn,
|
||||
Args&&... args) {
|
||||
#ifndef NDEBUG
|
||||
@@ -190,13 +190,13 @@ template <typename Callable, typename... Args>
|
||||
} // else *control is already kOnceDone
|
||||
}
|
||||
|
||||
inline absl::Nonnull<std::atomic<uint32_t>*> ControlWord(
|
||||
absl::Nonnull<once_flag*> flag) {
|
||||
inline std::atomic<uint32_t>* absl_nonnull ControlWord(
|
||||
once_flag* absl_nonnull flag) {
|
||||
return &flag->control_;
|
||||
}
|
||||
|
||||
template <typename Callable, typename... Args>
|
||||
void LowLevelCallOnce(absl::Nonnull<absl::once_flag*> flag, Callable&& fn,
|
||||
void LowLevelCallOnce(absl::once_flag* absl_nonnull flag, Callable&& fn,
|
||||
Args&&... args) {
|
||||
std::atomic<uint32_t>* once = base_internal::ControlWord(flag);
|
||||
uint32_t s = once->load(std::memory_order_acquire);
|
||||
|
||||
@@ -157,27 +157,27 @@ inline int64_t ToHost(int64_t x) {
|
||||
}
|
||||
|
||||
// Functions to do unaligned loads and stores in little-endian order.
|
||||
inline uint16_t Load16(absl::Nonnull<const void *> p) {
|
||||
inline uint16_t Load16(const void* absl_nonnull p) {
|
||||
return ToHost16(ABSL_INTERNAL_UNALIGNED_LOAD16(p));
|
||||
}
|
||||
|
||||
inline void Store16(absl::Nonnull<void *> p, uint16_t v) {
|
||||
inline void Store16(void* absl_nonnull p, uint16_t v) {
|
||||
ABSL_INTERNAL_UNALIGNED_STORE16(p, FromHost16(v));
|
||||
}
|
||||
|
||||
inline uint32_t Load32(absl::Nonnull<const void *> p) {
|
||||
inline uint32_t Load32(const void* absl_nonnull p) {
|
||||
return ToHost32(ABSL_INTERNAL_UNALIGNED_LOAD32(p));
|
||||
}
|
||||
|
||||
inline void Store32(absl::Nonnull<void *> p, uint32_t v) {
|
||||
inline void Store32(void* absl_nonnull p, uint32_t v) {
|
||||
ABSL_INTERNAL_UNALIGNED_STORE32(p, FromHost32(v));
|
||||
}
|
||||
|
||||
inline uint64_t Load64(absl::Nonnull<const void *> p) {
|
||||
inline uint64_t Load64(const void* absl_nonnull p) {
|
||||
return ToHost64(ABSL_INTERNAL_UNALIGNED_LOAD64(p));
|
||||
}
|
||||
|
||||
inline void Store64(absl::Nonnull<void *> p, uint64_t v) {
|
||||
inline void Store64(void* absl_nonnull p, uint64_t v) {
|
||||
ABSL_INTERNAL_UNALIGNED_STORE64(p, FromHost64(v));
|
||||
}
|
||||
|
||||
@@ -247,27 +247,27 @@ inline int64_t ToHost(int64_t x) {
|
||||
}
|
||||
|
||||
// Functions to do unaligned loads and stores in big-endian order.
|
||||
inline uint16_t Load16(absl::Nonnull<const void *> p) {
|
||||
inline uint16_t Load16(const void* absl_nonnull p) {
|
||||
return ToHost16(ABSL_INTERNAL_UNALIGNED_LOAD16(p));
|
||||
}
|
||||
|
||||
inline void Store16(absl::Nonnull<void *> p, uint16_t v) {
|
||||
inline void Store16(void* absl_nonnull p, uint16_t v) {
|
||||
ABSL_INTERNAL_UNALIGNED_STORE16(p, FromHost16(v));
|
||||
}
|
||||
|
||||
inline uint32_t Load32(absl::Nonnull<const void *> p) {
|
||||
inline uint32_t Load32(const void* absl_nonnull p) {
|
||||
return ToHost32(ABSL_INTERNAL_UNALIGNED_LOAD32(p));
|
||||
}
|
||||
|
||||
inline void Store32(absl::Nonnull<void *>p, uint32_t v) {
|
||||
inline void Store32(void* absl_nonnull p, uint32_t v) {
|
||||
ABSL_INTERNAL_UNALIGNED_STORE32(p, FromHost32(v));
|
||||
}
|
||||
|
||||
inline uint64_t Load64(absl::Nonnull<const void *> p) {
|
||||
inline uint64_t Load64(const void* absl_nonnull p) {
|
||||
return ToHost64(ABSL_INTERNAL_UNALIGNED_LOAD64(p));
|
||||
}
|
||||
|
||||
inline void Store64(absl::Nonnull<void *> p, uint64_t v) {
|
||||
inline void Store64(void* absl_nonnull p, uint64_t v) {
|
||||
ABSL_INTERNAL_UNALIGNED_STORE64(p, FromHost64(v));
|
||||
}
|
||||
|
||||
|
||||
@@ -36,33 +36,33 @@ namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace base_internal {
|
||||
|
||||
inline uint16_t UnalignedLoad16(absl::Nonnull<const void *> p) {
|
||||
inline uint16_t UnalignedLoad16(const void* absl_nonnull p) {
|
||||
uint16_t t;
|
||||
memcpy(&t, p, sizeof t);
|
||||
return t;
|
||||
}
|
||||
|
||||
inline uint32_t UnalignedLoad32(absl::Nonnull<const void *> p) {
|
||||
inline uint32_t UnalignedLoad32(const void* absl_nonnull p) {
|
||||
uint32_t t;
|
||||
memcpy(&t, p, sizeof t);
|
||||
return t;
|
||||
}
|
||||
|
||||
inline uint64_t UnalignedLoad64(absl::Nonnull<const void *> p) {
|
||||
inline uint64_t UnalignedLoad64(const void* absl_nonnull p) {
|
||||
uint64_t t;
|
||||
memcpy(&t, p, sizeof t);
|
||||
return t;
|
||||
}
|
||||
|
||||
inline void UnalignedStore16(absl::Nonnull<void *> p, uint16_t v) {
|
||||
inline void UnalignedStore16(void* absl_nonnull p, uint16_t v) {
|
||||
memcpy(p, &v, sizeof v);
|
||||
}
|
||||
|
||||
inline void UnalignedStore32(absl::Nonnull<void *> p, uint32_t v) {
|
||||
inline void UnalignedStore32(void* absl_nonnull p, uint32_t v) {
|
||||
memcpy(p, &v, sizeof v);
|
||||
}
|
||||
|
||||
inline void UnalignedStore64(absl::Nonnull<void *> p, uint64_t v) {
|
||||
inline void UnalignedStore64(void* absl_nonnull p, uint64_t v) {
|
||||
memcpy(p, &v, sizeof v);
|
||||
}
|
||||
|
||||
|
||||
@@ -135,11 +135,11 @@ class NoDestructor {
|
||||
// Pretend to be a smart pointer to T with deep constness.
|
||||
// Never returns a null pointer.
|
||||
T& operator*() { return *get(); }
|
||||
absl::Nonnull<T*> operator->() { return get(); }
|
||||
absl::Nonnull<T*> get() { return impl_.get(); }
|
||||
T* absl_nonnull operator->() { return get(); }
|
||||
T* absl_nonnull get() { return impl_.get(); }
|
||||
const T& operator*() const { return *get(); }
|
||||
absl::Nonnull<const T*> operator->() const { return get(); }
|
||||
absl::Nonnull<const T*> get() const { return impl_.get(); }
|
||||
const T* absl_nonnull operator->() const { return get(); }
|
||||
const T* absl_nonnull get() const { return impl_.get(); }
|
||||
|
||||
private:
|
||||
class DirectImpl {
|
||||
@@ -147,8 +147,8 @@ class NoDestructor {
|
||||
template <typename... Args>
|
||||
explicit constexpr DirectImpl(Args&&... args)
|
||||
: value_(std::forward<Args>(args)...) {}
|
||||
absl::Nonnull<const T*> get() const { return &value_; }
|
||||
absl::Nonnull<T*> get() { return &value_; }
|
||||
const T* absl_nonnull get() const { return &value_; }
|
||||
T* absl_nonnull get() { return &value_; }
|
||||
|
||||
private:
|
||||
T value_;
|
||||
@@ -160,10 +160,10 @@ class NoDestructor {
|
||||
explicit PlacementImpl(Args&&... args) {
|
||||
new (&space_) T(std::forward<Args>(args)...);
|
||||
}
|
||||
absl::Nonnull<const T*> get() const {
|
||||
const T* absl_nonnull get() const {
|
||||
return std::launder(reinterpret_cast<const T*>(&space_));
|
||||
}
|
||||
absl::Nonnull<T*> get() {
|
||||
T* absl_nonnull get() {
|
||||
return std::launder(reinterpret_cast<T*>(&space_));
|
||||
}
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ bool ScanNextDelta(const char*& punycode_begin, const char* const punycode_end,
|
||||
|
||||
} // namespace
|
||||
|
||||
absl::Nullable<char*> DecodeRustPunycode(DecodeRustPunycodeOptions options) {
|
||||
char* absl_nullable DecodeRustPunycode(DecodeRustPunycodeOptions options) {
|
||||
const char* punycode_begin = options.punycode_begin;
|
||||
const char* const punycode_end = options.punycode_end;
|
||||
char* const out_begin = options.out_begin;
|
||||
|
||||
@@ -46,7 +46,7 @@ struct DecodeRustPunycodeOptions {
|
||||
// DecodeRustPunycode is async-signal-safe with bounded runtime and a small
|
||||
// stack footprint, making it suitable for use in demangling Rust symbol names
|
||||
// from a signal handler.
|
||||
absl::Nullable<char*> DecodeRustPunycode(DecodeRustPunycodeOptions options);
|
||||
char* absl_nullable DecodeRustPunycode(DecodeRustPunycodeOptions options);
|
||||
|
||||
} // namespace debugging_internal
|
||||
ABSL_NAMESPACE_END
|
||||
|
||||
@@ -36,8 +36,8 @@ ABSL_NAMESPACE_BEGIN
|
||||
namespace log_internal {
|
||||
|
||||
#define ABSL_LOG_INTERNAL_DEFINE_MAKE_CHECK_OP_STRING(x) \
|
||||
template absl::Nonnull<const char*> MakeCheckOpString( \
|
||||
x, x, absl::Nonnull<const char*>)
|
||||
template const char* absl_nonnull MakeCheckOpString( \
|
||||
x, x, const char* absl_nonnull)
|
||||
ABSL_LOG_INTERNAL_DEFINE_MAKE_CHECK_OP_STRING(bool);
|
||||
ABSL_LOG_INTERNAL_DEFINE_MAKE_CHECK_OP_STRING(int64_t);
|
||||
ABSL_LOG_INTERNAL_DEFINE_MAKE_CHECK_OP_STRING(uint64_t);
|
||||
@@ -54,7 +54,7 @@ ABSL_LOG_INTERNAL_DEFINE_MAKE_CHECK_OP_STRING(const void*);
|
||||
#undef ABSL_LOG_INTERNAL_DEFINE_MAKE_CHECK_OP_STRING
|
||||
|
||||
CheckOpMessageBuilder::CheckOpMessageBuilder(
|
||||
absl::Nonnull<const char*> exprtext) {
|
||||
const char* absl_nonnull exprtext) {
|
||||
stream_ << exprtext << " (";
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ std::ostream& CheckOpMessageBuilder::ForVar2() {
|
||||
return stream_;
|
||||
}
|
||||
|
||||
absl::Nonnull<const char*> CheckOpMessageBuilder::NewString() {
|
||||
const char* absl_nonnull CheckOpMessageBuilder::NewString() {
|
||||
stream_ << ")";
|
||||
// There's no need to free this string since the process is crashing.
|
||||
return absl::IgnoreLeak(new std::string(std::move(stream_).str()))->c_str();
|
||||
@@ -103,9 +103,9 @@ void MakeCheckOpValueString(std::ostream& os, const void* p) {
|
||||
|
||||
// Helper functions for string comparisons.
|
||||
#define DEFINE_CHECK_STROP_IMPL(name, func, expected) \
|
||||
absl::Nullable<const char*> Check##func##expected##Impl( \
|
||||
absl::Nullable<const char*> s1, absl::Nullable<const char*> s2, \
|
||||
absl::Nonnull<const char*> exprtext) { \
|
||||
const char* absl_nullable Check##func##expected##Impl( \
|
||||
const char* absl_nullable s1, const char* absl_nullable s2, \
|
||||
const char* absl_nonnull exprtext) { \
|
||||
bool equal = s1 == s2 || (s1 && s2 && !func(s1, s2)); \
|
||||
if (equal == expected) { \
|
||||
return nullptr; \
|
||||
|
||||
@@ -64,49 +64,48 @@
|
||||
#endif
|
||||
|
||||
#define ABSL_LOG_INTERNAL_CHECK_OP(name, op, val1, val1_text, val2, val2_text) \
|
||||
while (absl::Nullable<const char*> absl_log_internal_check_op_result \
|
||||
[[maybe_unused]] = \
|
||||
::absl::log_internal::name##Impl( \
|
||||
::absl::log_internal::GetReferenceableValue(val1), \
|
||||
::absl::log_internal::GetReferenceableValue(val2), \
|
||||
ABSL_LOG_INTERNAL_STRIP_STRING_LITERAL( \
|
||||
val1_text " " #op " " val2_text))) \
|
||||
while (const char* absl_nullable absl_log_internal_check_op_result \
|
||||
[[maybe_unused]] = ::absl::log_internal::name##Impl( \
|
||||
::absl::log_internal::GetReferenceableValue(val1), \
|
||||
::absl::log_internal::GetReferenceableValue(val2), \
|
||||
ABSL_LOG_INTERNAL_STRIP_STRING_LITERAL(val1_text " " #op \
|
||||
" " val2_text))) \
|
||||
ABSL_LOG_INTERNAL_CONDITION_FATAL(STATELESS, true) \
|
||||
ABSL_LOG_INTERNAL_CHECK(absl::implicit_cast<absl::Nonnull<const char*>>( \
|
||||
ABSL_LOG_INTERNAL_CHECK(absl::implicit_cast<const char* absl_nonnull>( \
|
||||
absl_log_internal_check_op_result)) \
|
||||
.InternalStream()
|
||||
#define ABSL_LOG_INTERNAL_QCHECK_OP(name, op, val1, val1_text, val2, \
|
||||
val2_text) \
|
||||
while (absl::Nullable<const char*> absl_log_internal_qcheck_op_result = \
|
||||
::absl::log_internal::name##Impl( \
|
||||
::absl::log_internal::GetReferenceableValue(val1), \
|
||||
::absl::log_internal::GetReferenceableValue(val2), \
|
||||
ABSL_LOG_INTERNAL_STRIP_STRING_LITERAL( \
|
||||
val1_text " " #op " " val2_text))) \
|
||||
ABSL_LOG_INTERNAL_CONDITION_QFATAL(STATELESS, true) \
|
||||
ABSL_LOG_INTERNAL_QCHECK(absl::implicit_cast<absl::Nonnull<const char*>>( \
|
||||
absl_log_internal_qcheck_op_result)) \
|
||||
#define ABSL_LOG_INTERNAL_QCHECK_OP(name, op, val1, val1_text, val2, \
|
||||
val2_text) \
|
||||
while (const char* absl_nullable absl_log_internal_qcheck_op_result = \
|
||||
::absl::log_internal::name##Impl( \
|
||||
::absl::log_internal::GetReferenceableValue(val1), \
|
||||
::absl::log_internal::GetReferenceableValue(val2), \
|
||||
ABSL_LOG_INTERNAL_STRIP_STRING_LITERAL( \
|
||||
val1_text " " #op " " val2_text))) \
|
||||
ABSL_LOG_INTERNAL_CONDITION_QFATAL(STATELESS, true) \
|
||||
ABSL_LOG_INTERNAL_QCHECK(absl::implicit_cast<const char* absl_nonnull>( \
|
||||
absl_log_internal_qcheck_op_result)) \
|
||||
.InternalStream()
|
||||
#define ABSL_LOG_INTERNAL_CHECK_STROP(func, op, expected, s1, s1_text, s2, \
|
||||
s2_text) \
|
||||
while (absl::Nullable<const char*> absl_log_internal_check_strop_result = \
|
||||
while (const char* absl_nullable absl_log_internal_check_strop_result = \
|
||||
::absl::log_internal::Check##func##expected##Impl( \
|
||||
(s1), (s2), \
|
||||
ABSL_LOG_INTERNAL_STRIP_STRING_LITERAL(s1_text " " #op \
|
||||
" " s2_text))) \
|
||||
ABSL_LOG_INTERNAL_CONDITION_FATAL(STATELESS, true) \
|
||||
ABSL_LOG_INTERNAL_CHECK(absl::implicit_cast<absl::Nonnull<const char*>>( \
|
||||
ABSL_LOG_INTERNAL_CHECK(absl::implicit_cast<const char* absl_nonnull>( \
|
||||
absl_log_internal_check_strop_result)) \
|
||||
.InternalStream()
|
||||
#define ABSL_LOG_INTERNAL_QCHECK_STROP(func, op, expected, s1, s1_text, s2, \
|
||||
s2_text) \
|
||||
while (absl::Nullable<const char*> absl_log_internal_qcheck_strop_result = \
|
||||
while (const char* absl_nullable absl_log_internal_qcheck_strop_result = \
|
||||
::absl::log_internal::Check##func##expected##Impl( \
|
||||
(s1), (s2), \
|
||||
ABSL_LOG_INTERNAL_STRIP_STRING_LITERAL(s1_text " " #op \
|
||||
" " s2_text))) \
|
||||
ABSL_LOG_INTERNAL_CONDITION_QFATAL(STATELESS, true) \
|
||||
ABSL_LOG_INTERNAL_QCHECK(absl::implicit_cast<absl::Nonnull<const char*>>( \
|
||||
ABSL_LOG_INTERNAL_QCHECK(absl::implicit_cast<const char* absl_nonnull>( \
|
||||
absl_log_internal_qcheck_strop_result)) \
|
||||
.InternalStream()
|
||||
|
||||
@@ -134,41 +133,41 @@
|
||||
// string literal and abort without doing any streaming. We don't need to
|
||||
// strip the call to stringify the non-ok `Status` as long as we don't log it;
|
||||
// dropping the `Status`'s message text is out of scope.
|
||||
#define ABSL_LOG_INTERNAL_CHECK_OK(val, val_text) \
|
||||
for (::std::pair<absl::Nonnull<const ::absl::Status*>, \
|
||||
absl::Nullable<const char*>> \
|
||||
absl_log_internal_check_ok_goo; \
|
||||
absl_log_internal_check_ok_goo.first = \
|
||||
::absl::log_internal::AsStatus(val), \
|
||||
absl_log_internal_check_ok_goo.second = \
|
||||
ABSL_PREDICT_TRUE(absl_log_internal_check_ok_goo.first->ok()) \
|
||||
? nullptr \
|
||||
: ::absl::status_internal::MakeCheckFailString( \
|
||||
absl_log_internal_check_ok_goo.first, \
|
||||
ABSL_LOG_INTERNAL_STRIP_STRING_LITERAL(val_text \
|
||||
" is OK")), \
|
||||
!ABSL_PREDICT_TRUE(absl_log_internal_check_ok_goo.first->ok());) \
|
||||
ABSL_LOG_INTERNAL_CONDITION_FATAL(STATELESS, true) \
|
||||
ABSL_LOG_INTERNAL_CHECK(absl::implicit_cast<absl::Nonnull<const char*>>( \
|
||||
absl_log_internal_check_ok_goo.second)) \
|
||||
#define ABSL_LOG_INTERNAL_CHECK_OK(val, val_text) \
|
||||
for (::std::pair<const ::absl::Status* absl_nonnull, \
|
||||
const char* absl_nullable> \
|
||||
absl_log_internal_check_ok_goo; \
|
||||
absl_log_internal_check_ok_goo.first = \
|
||||
::absl::log_internal::AsStatus(val), \
|
||||
absl_log_internal_check_ok_goo.second = \
|
||||
ABSL_PREDICT_TRUE(absl_log_internal_check_ok_goo.first->ok()) \
|
||||
? nullptr \
|
||||
: ::absl::status_internal::MakeCheckFailString( \
|
||||
absl_log_internal_check_ok_goo.first, \
|
||||
ABSL_LOG_INTERNAL_STRIP_STRING_LITERAL(val_text \
|
||||
" is OK")), \
|
||||
!ABSL_PREDICT_TRUE(absl_log_internal_check_ok_goo.first->ok());) \
|
||||
ABSL_LOG_INTERNAL_CONDITION_FATAL(STATELESS, true) \
|
||||
ABSL_LOG_INTERNAL_CHECK(absl::implicit_cast<const char* absl_nonnull>( \
|
||||
absl_log_internal_check_ok_goo.second)) \
|
||||
.InternalStream()
|
||||
#define ABSL_LOG_INTERNAL_QCHECK_OK(val, val_text) \
|
||||
for (::std::pair<absl::Nonnull<const ::absl::Status*>, \
|
||||
absl::Nullable<const char*>> \
|
||||
absl_log_internal_qcheck_ok_goo; \
|
||||
absl_log_internal_qcheck_ok_goo.first = \
|
||||
::absl::log_internal::AsStatus(val), \
|
||||
absl_log_internal_qcheck_ok_goo.second = \
|
||||
ABSL_PREDICT_TRUE(absl_log_internal_qcheck_ok_goo.first->ok()) \
|
||||
? nullptr \
|
||||
: ::absl::status_internal::MakeCheckFailString( \
|
||||
absl_log_internal_qcheck_ok_goo.first, \
|
||||
ABSL_LOG_INTERNAL_STRIP_STRING_LITERAL(val_text \
|
||||
" is OK")), \
|
||||
!ABSL_PREDICT_TRUE(absl_log_internal_qcheck_ok_goo.first->ok());) \
|
||||
ABSL_LOG_INTERNAL_CONDITION_QFATAL(STATELESS, true) \
|
||||
ABSL_LOG_INTERNAL_QCHECK(absl::implicit_cast<absl::Nonnull<const char*>>( \
|
||||
absl_log_internal_qcheck_ok_goo.second)) \
|
||||
#define ABSL_LOG_INTERNAL_QCHECK_OK(val, val_text) \
|
||||
for (::std::pair<const ::absl::Status* absl_nonnull, \
|
||||
const char* absl_nullable> \
|
||||
absl_log_internal_qcheck_ok_goo; \
|
||||
absl_log_internal_qcheck_ok_goo.first = \
|
||||
::absl::log_internal::AsStatus(val), \
|
||||
absl_log_internal_qcheck_ok_goo.second = \
|
||||
ABSL_PREDICT_TRUE(absl_log_internal_qcheck_ok_goo.first->ok()) \
|
||||
? nullptr \
|
||||
: ::absl::status_internal::MakeCheckFailString( \
|
||||
absl_log_internal_qcheck_ok_goo.first, \
|
||||
ABSL_LOG_INTERNAL_STRIP_STRING_LITERAL(val_text \
|
||||
" is OK")), \
|
||||
!ABSL_PREDICT_TRUE(absl_log_internal_qcheck_ok_goo.first->ok());) \
|
||||
ABSL_LOG_INTERNAL_CONDITION_QFATAL(STATELESS, true) \
|
||||
ABSL_LOG_INTERNAL_QCHECK(absl::implicit_cast<const char* absl_nonnull>( \
|
||||
absl_log_internal_qcheck_ok_goo.second)) \
|
||||
.InternalStream()
|
||||
|
||||
namespace absl {
|
||||
@@ -179,9 +178,8 @@ template <typename T>
|
||||
class StatusOr;
|
||||
|
||||
namespace status_internal {
|
||||
ABSL_ATTRIBUTE_PURE_FUNCTION absl::Nonnull<const char*> MakeCheckFailString(
|
||||
absl::Nonnull<const absl::Status*> status,
|
||||
absl::Nonnull<const char*> prefix);
|
||||
ABSL_ATTRIBUTE_PURE_FUNCTION const char* absl_nonnull MakeCheckFailString(
|
||||
const absl::Status* absl_nonnull status, const char* absl_nonnull prefix);
|
||||
} // namespace status_internal
|
||||
|
||||
namespace log_internal {
|
||||
@@ -189,11 +187,11 @@ namespace log_internal {
|
||||
// Convert a Status or a StatusOr to its underlying status value.
|
||||
//
|
||||
// (This implementation does not require a dep on absl::Status to work.)
|
||||
inline absl::Nonnull<const absl::Status*> AsStatus(const absl::Status& s) {
|
||||
inline const absl::Status* absl_nonnull AsStatus(const absl::Status& s) {
|
||||
return &s;
|
||||
}
|
||||
template <typename T>
|
||||
absl::Nonnull<const absl::Status*> AsStatus(const absl::StatusOr<T>& s) {
|
||||
const absl::Status* absl_nonnull AsStatus(const absl::StatusOr<T>& s) {
|
||||
return &s.status();
|
||||
}
|
||||
|
||||
@@ -202,14 +200,14 @@ absl::Nonnull<const absl::Status*> AsStatus(const absl::StatusOr<T>& s) {
|
||||
class CheckOpMessageBuilder final {
|
||||
public:
|
||||
// Inserts `exprtext` and ` (` to the stream.
|
||||
explicit CheckOpMessageBuilder(absl::Nonnull<const char*> exprtext);
|
||||
explicit CheckOpMessageBuilder(const char* absl_nonnull exprtext);
|
||||
~CheckOpMessageBuilder() = default;
|
||||
// For inserting the first variable.
|
||||
std::ostream& ForVar1() { return stream_; }
|
||||
// For inserting the second variable (adds an intermediate ` vs. `).
|
||||
std::ostream& ForVar2();
|
||||
// Get the result (inserts the closing `)`).
|
||||
absl::Nonnull<const char*> NewString();
|
||||
const char* absl_nonnull NewString();
|
||||
|
||||
private:
|
||||
std::ostringstream stream_;
|
||||
@@ -352,12 +350,12 @@ using CheckOpStreamType = decltype(detect_specialization::Detect<T>(0));
|
||||
|
||||
// Build the error message string. Specify no inlining for code size.
|
||||
template <typename T1, typename T2>
|
||||
ABSL_ATTRIBUTE_RETURNS_NONNULL absl::Nonnull<const char*> MakeCheckOpString(
|
||||
T1 v1, T2 v2, absl::Nonnull<const char*> exprtext) ABSL_ATTRIBUTE_NOINLINE;
|
||||
ABSL_ATTRIBUTE_RETURNS_NONNULL const char* absl_nonnull MakeCheckOpString(
|
||||
T1 v1, T2 v2, const char* absl_nonnull exprtext) ABSL_ATTRIBUTE_NOINLINE;
|
||||
|
||||
template <typename T1, typename T2>
|
||||
absl::Nonnull<const char*> MakeCheckOpString(
|
||||
T1 v1, T2 v2, absl::Nonnull<const char*> exprtext) {
|
||||
const char* absl_nonnull MakeCheckOpString(T1 v1, T2 v2,
|
||||
const char* absl_nonnull exprtext) {
|
||||
CheckOpMessageBuilder comb(exprtext);
|
||||
MakeCheckOpValueString(comb.ForVar1(), v1);
|
||||
MakeCheckOpValueString(comb.ForVar2(), v2);
|
||||
@@ -367,8 +365,8 @@ absl::Nonnull<const char*> MakeCheckOpString(
|
||||
// Add a few commonly used instantiations as extern to reduce size of objects
|
||||
// files.
|
||||
#define ABSL_LOG_INTERNAL_DEFINE_MAKE_CHECK_OP_STRING_EXTERN(x) \
|
||||
extern template absl::Nonnull<const char*> MakeCheckOpString( \
|
||||
x, x, absl::Nonnull<const char*>)
|
||||
extern template const char* absl_nonnull MakeCheckOpString( \
|
||||
x, x, const char* absl_nonnull)
|
||||
ABSL_LOG_INTERNAL_DEFINE_MAKE_CHECK_OP_STRING_EXTERN(bool);
|
||||
ABSL_LOG_INTERNAL_DEFINE_MAKE_CHECK_OP_STRING_EXTERN(int64_t);
|
||||
ABSL_LOG_INTERNAL_DEFINE_MAKE_CHECK_OP_STRING_EXTERN(uint64_t);
|
||||
@@ -404,8 +402,8 @@ ABSL_LOG_INTERNAL_DEFINE_MAKE_CHECK_OP_STRING_EXTERN(const void*);
|
||||
// type.
|
||||
#define ABSL_LOG_INTERNAL_CHECK_OP_IMPL(name, op) \
|
||||
template <typename T1, typename T2> \
|
||||
inline constexpr absl::Nullable<const char*> name##Impl( \
|
||||
const T1& v1, const T2& v2, absl::Nonnull<const char*> exprtext) { \
|
||||
inline constexpr const char* absl_nullable name##Impl( \
|
||||
const T1& v1, const T2& v2, const char* absl_nonnull exprtext) { \
|
||||
using U1 = CheckOpStreamType<T1>; \
|
||||
using U2 = CheckOpStreamType<T2>; \
|
||||
return ABSL_PREDICT_TRUE(v1 op v2) \
|
||||
@@ -413,8 +411,8 @@ ABSL_LOG_INTERNAL_DEFINE_MAKE_CHECK_OP_STRING_EXTERN(const void*);
|
||||
: ABSL_LOG_INTERNAL_CHECK_OP_IMPL_RESULT(U1, U2, U1(v1), \
|
||||
U2(v2), exprtext); \
|
||||
} \
|
||||
inline constexpr absl::Nullable<const char*> name##Impl( \
|
||||
int v1, int v2, absl::Nonnull<const char*> exprtext) { \
|
||||
inline constexpr const char* absl_nullable name##Impl( \
|
||||
int v1, int v2, const char* absl_nonnull exprtext) { \
|
||||
return name##Impl<int, int>(v1, v2, exprtext); \
|
||||
}
|
||||
|
||||
@@ -427,18 +425,18 @@ ABSL_LOG_INTERNAL_CHECK_OP_IMPL(Check_GT, >)
|
||||
#undef ABSL_LOG_INTERNAL_CHECK_OP_IMPL_RESULT
|
||||
#undef ABSL_LOG_INTERNAL_CHECK_OP_IMPL
|
||||
|
||||
absl::Nullable<const char*> CheckstrcmptrueImpl(
|
||||
absl::Nullable<const char*> s1, absl::Nullable<const char*> s2,
|
||||
absl::Nonnull<const char*> exprtext);
|
||||
absl::Nullable<const char*> CheckstrcmpfalseImpl(
|
||||
absl::Nullable<const char*> s1, absl::Nullable<const char*> s2,
|
||||
absl::Nonnull<const char*> exprtext);
|
||||
absl::Nullable<const char*> CheckstrcasecmptrueImpl(
|
||||
absl::Nullable<const char*> s1, absl::Nullable<const char*> s2,
|
||||
absl::Nonnull<const char*> exprtext);
|
||||
absl::Nullable<const char*> CheckstrcasecmpfalseImpl(
|
||||
absl::Nullable<const char*> s1, absl::Nullable<const char*> s2,
|
||||
absl::Nonnull<const char*> exprtext);
|
||||
const char* absl_nullable CheckstrcmptrueImpl(
|
||||
const char* absl_nullable s1, const char* absl_nullable s2,
|
||||
const char* absl_nonnull exprtext);
|
||||
const char* absl_nullable CheckstrcmpfalseImpl(
|
||||
const char* absl_nullable s1, const char* absl_nullable s2,
|
||||
const char* absl_nonnull exprtext);
|
||||
const char* absl_nullable CheckstrcasecmptrueImpl(
|
||||
const char* absl_nullable s1, const char* absl_nullable s2,
|
||||
const char* absl_nonnull exprtext);
|
||||
const char* absl_nullable CheckstrcasecmpfalseImpl(
|
||||
const char* absl_nullable s1, const char* absl_nullable s2,
|
||||
const char* absl_nonnull exprtext);
|
||||
|
||||
// `CHECK_EQ` and friends want to pass their arguments by reference, however
|
||||
// this winds up exposing lots of cases where people have defined and
|
||||
|
||||
@@ -147,7 +147,7 @@ void WriteToStream(const char* data, void* os) {
|
||||
} // namespace
|
||||
|
||||
struct LogMessage::LogMessageData final {
|
||||
LogMessageData(absl::Nonnull<const char*> file, int line,
|
||||
LogMessageData(const char* absl_nonnull file, int line,
|
||||
absl::LogSeverity severity, absl::Time timestamp);
|
||||
LogMessageData(const LogMessageData&) = delete;
|
||||
LogMessageData& operator=(const LogMessageData&) = delete;
|
||||
@@ -163,7 +163,7 @@ struct LogMessage::LogMessageData final {
|
||||
bool is_perror;
|
||||
|
||||
// Extra `LogSink`s to log to, in addition to `global_sinks`.
|
||||
absl::InlinedVector<absl::Nonnull<absl::LogSink*>, 16> extra_sinks;
|
||||
absl::InlinedVector<absl::LogSink* absl_nonnull, 16> extra_sinks;
|
||||
// If true, log to `extra_sinks` but not to `global_sinks` or hardcoded
|
||||
// non-sink targets (e.g. stderr, log files).
|
||||
bool extra_sinks_only;
|
||||
@@ -199,7 +199,7 @@ struct LogMessage::LogMessageData final {
|
||||
void FinalizeEncodingAndFormat();
|
||||
};
|
||||
|
||||
LogMessage::LogMessageData::LogMessageData(absl::Nonnull<const char*> file,
|
||||
LogMessage::LogMessageData::LogMessageData(const char* absl_nonnull file,
|
||||
int line, absl::LogSeverity severity,
|
||||
absl::Time timestamp)
|
||||
: extra_sinks_only(false), manipulated(nullptr) {
|
||||
@@ -270,7 +270,7 @@ void LogMessage::LogMessageData::FinalizeEncodingAndFormat() {
|
||||
absl::MakeSpan(string_buf).subspan(0, chars_written);
|
||||
}
|
||||
|
||||
LogMessage::LogMessage(absl::Nonnull<const char*> file, int line,
|
||||
LogMessage::LogMessage(const char* absl_nonnull file, int line,
|
||||
absl::LogSeverity severity)
|
||||
: data_(absl::make_unique<LogMessageData>(file, line, severity,
|
||||
absl::Now())) {
|
||||
@@ -284,11 +284,11 @@ LogMessage::LogMessage(absl::Nonnull<const char*> file, int line,
|
||||
LogBacktraceIfNeeded();
|
||||
}
|
||||
|
||||
LogMessage::LogMessage(absl::Nonnull<const char*> file, int line, InfoTag)
|
||||
LogMessage::LogMessage(const char* absl_nonnull file, int line, InfoTag)
|
||||
: LogMessage(file, line, absl::LogSeverity::kInfo) {}
|
||||
LogMessage::LogMessage(absl::Nonnull<const char*> file, int line, WarningTag)
|
||||
LogMessage::LogMessage(const char* absl_nonnull file, int line, WarningTag)
|
||||
: LogMessage(file, line, absl::LogSeverity::kWarning) {}
|
||||
LogMessage::LogMessage(absl::Nonnull<const char*> file, int line, ErrorTag)
|
||||
LogMessage::LogMessage(const char* absl_nonnull file, int line, ErrorTag)
|
||||
: LogMessage(file, line, absl::LogSeverity::kError) {}
|
||||
|
||||
// This cannot go in the header since LogMessageData is defined in this file.
|
||||
@@ -343,13 +343,13 @@ LogMessage& LogMessage::WithPerror() {
|
||||
return *this;
|
||||
}
|
||||
|
||||
LogMessage& LogMessage::ToSinkAlso(absl::Nonnull<absl::LogSink*> sink) {
|
||||
LogMessage& LogMessage::ToSinkAlso(absl::LogSink* absl_nonnull sink) {
|
||||
ABSL_INTERNAL_CHECK(sink, "null LogSink*");
|
||||
data_->extra_sinks.push_back(sink);
|
||||
return *this;
|
||||
}
|
||||
|
||||
LogMessage& LogMessage::ToSinkOnly(absl::Nonnull<absl::LogSink*> sink) {
|
||||
LogMessage& LogMessage::ToSinkOnly(absl::LogSink* absl_nonnull sink) {
|
||||
ABSL_INTERNAL_CHECK(sink, "null LogSink*");
|
||||
data_->extra_sinks.clear();
|
||||
data_->extra_sinks.push_back(sink);
|
||||
@@ -673,11 +673,11 @@ void LogMessage::CopyToEncodedBufferWithStructuredProtoField(
|
||||
#pragma warning(disable : 4722)
|
||||
#endif
|
||||
|
||||
LogMessageFatal::LogMessageFatal(absl::Nonnull<const char*> file, int line)
|
||||
LogMessageFatal::LogMessageFatal(const char* absl_nonnull file, int line)
|
||||
: LogMessage(file, line, absl::LogSeverity::kFatal) {}
|
||||
|
||||
LogMessageFatal::LogMessageFatal(absl::Nonnull<const char*> file, int line,
|
||||
absl::Nonnull<const char*> failure_msg)
|
||||
LogMessageFatal::LogMessageFatal(const char* absl_nonnull file, int line,
|
||||
const char* absl_nonnull failure_msg)
|
||||
: LogMessage(file, line, absl::LogSeverity::kFatal) {
|
||||
*this << "Check failed: " << failure_msg << " ";
|
||||
}
|
||||
@@ -686,7 +686,7 @@ LogMessageFatal::~LogMessageFatal() {
|
||||
FailWithoutStackTrace();
|
||||
}
|
||||
|
||||
LogMessageDebugFatal::LogMessageDebugFatal(absl::Nonnull<const char*> file,
|
||||
LogMessageDebugFatal::LogMessageDebugFatal(const char* absl_nonnull file,
|
||||
int line)
|
||||
: LogMessage(file, line, absl::LogSeverity::kFatal) {}
|
||||
|
||||
@@ -695,7 +695,7 @@ LogMessageDebugFatal::~LogMessageDebugFatal() {
|
||||
}
|
||||
|
||||
LogMessageQuietlyDebugFatal::LogMessageQuietlyDebugFatal(
|
||||
absl::Nonnull<const char*> file, int line)
|
||||
const char* absl_nonnull file, int line)
|
||||
: LogMessage(file, line, absl::LogSeverity::kFatal) {
|
||||
SetFailQuietly();
|
||||
}
|
||||
@@ -704,15 +704,15 @@ LogMessageQuietlyDebugFatal::~LogMessageQuietlyDebugFatal() {
|
||||
FailQuietly();
|
||||
}
|
||||
|
||||
LogMessageQuietlyFatal::LogMessageQuietlyFatal(absl::Nonnull<const char*> file,
|
||||
LogMessageQuietlyFatal::LogMessageQuietlyFatal(const char* absl_nonnull file,
|
||||
int line)
|
||||
: LogMessage(file, line, absl::LogSeverity::kFatal) {
|
||||
SetFailQuietly();
|
||||
}
|
||||
|
||||
LogMessageQuietlyFatal::LogMessageQuietlyFatal(
|
||||
absl::Nonnull<const char*> file, int line,
|
||||
absl::Nonnull<const char*> failure_msg)
|
||||
const char* absl_nonnull file, int line,
|
||||
const char* absl_nonnull failure_msg)
|
||||
: LogMessageQuietlyFatal(file, line) {
|
||||
*this << "Check failed: " << failure_msg << " ";
|
||||
}
|
||||
|
||||
@@ -62,15 +62,15 @@ class LogMessage {
|
||||
struct ErrorTag {};
|
||||
|
||||
// Used for `LOG`.
|
||||
LogMessage(absl::Nonnull<const char*> file, int line,
|
||||
LogMessage(const char* absl_nonnull file, int line,
|
||||
absl::LogSeverity severity) ABSL_ATTRIBUTE_COLD;
|
||||
// These constructors are slightly smaller/faster to call; the severity is
|
||||
// curried into the function pointer.
|
||||
LogMessage(absl::Nonnull<const char*> file, int line,
|
||||
LogMessage(const char* absl_nonnull file, int line,
|
||||
InfoTag) ABSL_ATTRIBUTE_COLD ABSL_ATTRIBUTE_NOINLINE;
|
||||
LogMessage(absl::Nonnull<const char*> file, int line,
|
||||
LogMessage(const char* absl_nonnull file, int line,
|
||||
WarningTag) ABSL_ATTRIBUTE_COLD ABSL_ATTRIBUTE_NOINLINE;
|
||||
LogMessage(absl::Nonnull<const char*> file, int line,
|
||||
LogMessage(const char* absl_nonnull file, int line,
|
||||
ErrorTag) ABSL_ATTRIBUTE_COLD ABSL_ATTRIBUTE_NOINLINE;
|
||||
LogMessage(const LogMessage&) = delete;
|
||||
LogMessage& operator=(const LogMessage&) = delete;
|
||||
@@ -102,9 +102,9 @@ class LogMessage {
|
||||
LogMessage& WithPerror();
|
||||
// Sends this message to `*sink` in addition to whatever other sinks it would
|
||||
// otherwise have been sent to.
|
||||
LogMessage& ToSinkAlso(absl::Nonnull<absl::LogSink*> sink);
|
||||
LogMessage& ToSinkAlso(absl::LogSink* absl_nonnull sink);
|
||||
// Sends this message to `*sink` and no others.
|
||||
LogMessage& ToSinkOnly(absl::Nonnull<absl::LogSink*> sink);
|
||||
LogMessage& ToSinkOnly(absl::LogSink* absl_nonnull sink);
|
||||
|
||||
// Don't call this method from outside this library.
|
||||
LogMessage& InternalStream() { return *this; }
|
||||
@@ -141,10 +141,10 @@ class LogMessage {
|
||||
LogMessage& operator<<(unsigned long long v) {
|
||||
return operator<< <unsigned long long>(v);
|
||||
}
|
||||
LogMessage& operator<<(absl::Nullable<void*> v) {
|
||||
LogMessage& operator<<(void* absl_nullable v) {
|
||||
return operator<< <void*>(v);
|
||||
}
|
||||
LogMessage& operator<<(absl::Nullable<const void*> v) {
|
||||
LogMessage& operator<<(const void* absl_nullable v) {
|
||||
return operator<< <const void*>(v);
|
||||
}
|
||||
LogMessage& operator<<(float v) { return operator<< <float>(v); }
|
||||
@@ -271,7 +271,7 @@ class LogMessage {
|
||||
|
||||
// We keep the data in a separate struct so that each instance of `LogMessage`
|
||||
// uses less stack space.
|
||||
absl::Nonnull<std::unique_ptr<LogMessageData>> data_;
|
||||
absl_nonnull std::unique_ptr<LogMessageData> data_;
|
||||
};
|
||||
|
||||
// Helper class so that `AbslStringify()` can modify the LogMessage.
|
||||
@@ -289,7 +289,7 @@ class StringifySink final {
|
||||
}
|
||||
|
||||
// For types that implement `AbslStringify` using `absl::Format()`.
|
||||
friend void AbslFormatFlush(absl::Nonnull<StringifySink*> sink,
|
||||
friend void AbslFormatFlush(StringifySink* absl_nonnull sink,
|
||||
absl::string_view v) {
|
||||
sink->Append(v);
|
||||
}
|
||||
@@ -341,9 +341,9 @@ extern template LogMessage& LogMessage::operator<<(const unsigned long& v);
|
||||
extern template LogMessage& LogMessage::operator<<(const long long& v);
|
||||
extern template LogMessage& LogMessage::operator<<(const unsigned long long& v);
|
||||
extern template LogMessage& LogMessage::operator<<(
|
||||
absl::Nullable<void*> const& v);
|
||||
void* absl_nullable const& v);
|
||||
extern template LogMessage& LogMessage::operator<<(
|
||||
absl::Nullable<const void*> const& v);
|
||||
const void* absl_nullable const& v);
|
||||
extern template LogMessage& LogMessage::operator<<(const float& v);
|
||||
extern template LogMessage& LogMessage::operator<<(const double& v);
|
||||
extern template LogMessage& LogMessage::operator<<(const bool& v);
|
||||
@@ -364,10 +364,9 @@ extern template void LogMessage::CopyToEncodedBuffer<
|
||||
// message.
|
||||
class LogMessageFatal final : public LogMessage {
|
||||
public:
|
||||
LogMessageFatal(absl::Nonnull<const char*> file,
|
||||
int line) ABSL_ATTRIBUTE_COLD;
|
||||
LogMessageFatal(absl::Nonnull<const char*> file, int line,
|
||||
absl::Nonnull<const char*> failure_msg) ABSL_ATTRIBUTE_COLD;
|
||||
LogMessageFatal(const char* absl_nonnull file, int line) ABSL_ATTRIBUTE_COLD;
|
||||
LogMessageFatal(const char* absl_nonnull file, int line,
|
||||
const char* absl_nonnull failure_msg) ABSL_ATTRIBUTE_COLD;
|
||||
[[noreturn]] ~LogMessageFatal();
|
||||
};
|
||||
|
||||
@@ -376,7 +375,7 @@ class LogMessageFatal final : public LogMessage {
|
||||
// for DLOG(FATAL) variants.
|
||||
class LogMessageDebugFatal final : public LogMessage {
|
||||
public:
|
||||
LogMessageDebugFatal(absl::Nonnull<const char*> file,
|
||||
LogMessageDebugFatal(const char* absl_nonnull file,
|
||||
int line) ABSL_ATTRIBUTE_COLD;
|
||||
~LogMessageDebugFatal();
|
||||
};
|
||||
@@ -386,7 +385,7 @@ class LogMessageQuietlyDebugFatal final : public LogMessage {
|
||||
// DLOG(QFATAL) calls this instead of LogMessageQuietlyFatal to make sure the
|
||||
// destructor is not [[noreturn]] even if this is always FATAL as this is only
|
||||
// invoked when DLOG() is enabled.
|
||||
LogMessageQuietlyDebugFatal(absl::Nonnull<const char*> file,
|
||||
LogMessageQuietlyDebugFatal(const char* absl_nonnull file,
|
||||
int line) ABSL_ATTRIBUTE_COLD;
|
||||
~LogMessageQuietlyDebugFatal();
|
||||
};
|
||||
@@ -394,10 +393,10 @@ class LogMessageQuietlyDebugFatal final : public LogMessage {
|
||||
// Used for LOG(QFATAL) to make sure it's properly understood as [[noreturn]].
|
||||
class LogMessageQuietlyFatal final : public LogMessage {
|
||||
public:
|
||||
LogMessageQuietlyFatal(absl::Nonnull<const char*> file,
|
||||
LogMessageQuietlyFatal(const char* absl_nonnull file,
|
||||
int line) ABSL_ATTRIBUTE_COLD;
|
||||
LogMessageQuietlyFatal(absl::Nonnull<const char*> file, int line,
|
||||
absl::Nonnull<const char*> failure_msg)
|
||||
LogMessageQuietlyFatal(const char* absl_nonnull file, int line,
|
||||
const char* absl_nonnull failure_msg)
|
||||
ABSL_ATTRIBUTE_COLD;
|
||||
[[noreturn]] ~LogMessageQuietlyFatal();
|
||||
};
|
||||
|
||||
@@ -44,10 +44,10 @@ ABSL_NAMESPACE_BEGIN
|
||||
// sink instead which writes them to `stderr`.
|
||||
//
|
||||
// Do not call these inside `absl::LogSink::Send`.
|
||||
inline void AddLogSink(absl::Nonnull<absl::LogSink*> sink) {
|
||||
inline void AddLogSink(absl::LogSink* absl_nonnull sink) {
|
||||
log_internal::AddLogSink(sink);
|
||||
}
|
||||
inline void RemoveLogSink(absl::Nonnull<absl::LogSink*> sink) {
|
||||
inline void RemoveLogSink(absl::LogSink* absl_nonnull sink) {
|
||||
log_internal::RemoveLogSink(sink);
|
||||
}
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ bool StatusRep::operator==(const StatusRep& other) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
absl::Nonnull<StatusRep*> StatusRep::CloneAndUnref() const {
|
||||
StatusRep* absl_nonnull StatusRep::CloneAndUnref() const {
|
||||
// Optimization: no need to create a clone if we already have a refcount of 1.
|
||||
if (ref_.load(std::memory_order_acquire) == 1) {
|
||||
// All StatusRep instances are heap allocated and mutable, therefore this
|
||||
@@ -235,9 +235,8 @@ absl::StatusCode MapToLocalCode(int value) {
|
||||
}
|
||||
}
|
||||
|
||||
absl::Nonnull<const char*> MakeCheckFailString(
|
||||
absl::Nonnull<const absl::Status*> status,
|
||||
absl::Nonnull<const char*> prefix) {
|
||||
const char* absl_nonnull MakeCheckFailString(
|
||||
const absl::Status* absl_nonnull status, const char* absl_nonnull prefix) {
|
||||
// There's no need to free this string since the process is crashing.
|
||||
return absl::IgnoreLeak(
|
||||
new std::string(absl::StrCat(
|
||||
|
||||
@@ -100,7 +100,7 @@ class StatusRep {
|
||||
// Returns an equivalent heap allocated StatusRep with refcount 1.
|
||||
//
|
||||
// `this` is not safe to be used after calling as it may have been deleted.
|
||||
absl::Nonnull<StatusRep*> CloneAndUnref() const;
|
||||
StatusRep* absl_nonnull CloneAndUnref() const;
|
||||
|
||||
private:
|
||||
mutable std::atomic<int32_t> ref_;
|
||||
@@ -120,9 +120,8 @@ absl::StatusCode MapToLocalCode(int value);
|
||||
//
|
||||
// This is an internal implementation detail for Abseil logging.
|
||||
ABSL_ATTRIBUTE_PURE_FUNCTION
|
||||
absl::Nonnull<const char*> MakeCheckFailString(
|
||||
absl::Nonnull<const absl::Status*> status,
|
||||
absl::Nonnull<const char*> prefix);
|
||||
const char* absl_nonnull MakeCheckFailString(
|
||||
const absl::Status* absl_nonnull status, const char* absl_nonnull prefix);
|
||||
|
||||
} // namespace status_internal
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ using IsStatusOrAssignmentValid = absl::conjunction<
|
||||
class Helper {
|
||||
public:
|
||||
// Move type-agnostic error handling to the .cc.
|
||||
static void HandleInvalidStatusCtorArg(absl::Nonnull<Status*>);
|
||||
static void HandleInvalidStatusCtorArg(Status* absl_nonnull);
|
||||
[[noreturn]] static void Crash(const absl::Status& status);
|
||||
};
|
||||
|
||||
@@ -194,7 +194,7 @@ class Helper {
|
||||
// This abstraction is here mostly for the gcc performance fix.
|
||||
template <typename T, typename... Args>
|
||||
ABSL_ATTRIBUTE_NONNULL(1)
|
||||
void PlacementNew(absl::Nonnull<void*> p, Args&&... args) {
|
||||
void PlacementNew(void* absl_nonnull p, Args&&... args) {
|
||||
new (p) T(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,12 +91,12 @@ std::ostream& operator<<(std::ostream& os, StatusCode code) {
|
||||
return os << StatusCodeToString(code);
|
||||
}
|
||||
|
||||
absl::Nonnull<const std::string*> Status::EmptyString() {
|
||||
const std::string* absl_nonnull Status::EmptyString() {
|
||||
static const absl::NoDestructor<std::string> kEmpty;
|
||||
return kEmpty.get();
|
||||
}
|
||||
|
||||
absl::Nonnull<const std::string*> Status::MovedFromString() {
|
||||
const std::string* absl_nonnull Status::MovedFromString() {
|
||||
static const absl::NoDestructor<std::string> kMovedFrom(kMovedFromString);
|
||||
return kMovedFrom.get();
|
||||
}
|
||||
@@ -108,7 +108,7 @@ Status::Status(absl::StatusCode code, absl::string_view msg)
|
||||
}
|
||||
}
|
||||
|
||||
absl::Nonnull<status_internal::StatusRep*> Status::PrepareToModify(
|
||||
status_internal::StatusRep* absl_nonnull Status::PrepareToModify(
|
||||
uintptr_t rep) {
|
||||
if (IsInlined(rep)) {
|
||||
return new status_internal::StatusRep(InlinedRepToCode(rep),
|
||||
@@ -406,7 +406,7 @@ Status ErrnoToStatus(int error_number, absl::string_view message) {
|
||||
MessageForErrnoToStatus(error_number, message));
|
||||
}
|
||||
|
||||
absl::Nonnull<const char*> StatusMessageAsCStr(const Status& status) {
|
||||
const char* absl_nonnull StatusMessageAsCStr(const Status& status) {
|
||||
// As an internal implementation detail, we guarantee that if status.message()
|
||||
// is non-empty, then the resulting string_view is null terminated.
|
||||
auto sv_message = status.message();
|
||||
|
||||
@@ -623,15 +623,15 @@ class ABSL_ATTRIBUTE_TRIVIAL_ABI Status final {
|
||||
|
||||
// REQUIRES: !ok()
|
||||
// Ensures rep is not inlined or shared with any other Status.
|
||||
static absl::Nonnull<status_internal::StatusRep*> PrepareToModify(
|
||||
static status_internal::StatusRep* absl_nonnull PrepareToModify(
|
||||
uintptr_t rep);
|
||||
|
||||
// MSVC 14.0 limitation requires the const.
|
||||
static constexpr const char kMovedFromString[] =
|
||||
"Status accessed after move.";
|
||||
|
||||
static absl::Nonnull<const std::string*> EmptyString();
|
||||
static absl::Nonnull<const std::string*> MovedFromString();
|
||||
static const std::string* absl_nonnull EmptyString();
|
||||
static const std::string* absl_nonnull MovedFromString();
|
||||
|
||||
// Returns whether rep contains an inlined representation.
|
||||
// See rep_ for details.
|
||||
@@ -649,8 +649,8 @@ class ABSL_ATTRIBUTE_TRIVIAL_ABI Status final {
|
||||
|
||||
// Converts between StatusRep* and the external uintptr_t representation used
|
||||
// by rep_. See rep_ for details.
|
||||
static uintptr_t PointerToRep(absl::Nonnull<status_internal::StatusRep*> r);
|
||||
static absl::Nonnull<const status_internal::StatusRep*> RepToPointer(
|
||||
static uintptr_t PointerToRep(status_internal::StatusRep* absl_nonnull r);
|
||||
static const status_internal::StatusRep* absl_nonnull RepToPointer(
|
||||
uintptr_t r);
|
||||
|
||||
static std::string ToStringSlow(uintptr_t rep, StatusToStringMode mode);
|
||||
@@ -902,14 +902,14 @@ constexpr uintptr_t Status::MovedFromRep() {
|
||||
return CodeToInlinedRep(absl::StatusCode::kInternal) | 2;
|
||||
}
|
||||
|
||||
inline absl::Nonnull<const status_internal::StatusRep*> Status::RepToPointer(
|
||||
inline const status_internal::StatusRep* absl_nonnull Status::RepToPointer(
|
||||
uintptr_t rep) {
|
||||
assert(!IsInlined(rep));
|
||||
return reinterpret_cast<const status_internal::StatusRep*>(rep);
|
||||
}
|
||||
|
||||
inline uintptr_t Status::PointerToRep(
|
||||
absl::Nonnull<status_internal::StatusRep*> rep) {
|
||||
status_internal::StatusRep* absl_nonnull rep) {
|
||||
return reinterpret_cast<uintptr_t>(rep);
|
||||
}
|
||||
|
||||
@@ -934,7 +934,7 @@ inline Status CancelledError() { return Status(absl::StatusCode::kCancelled); }
|
||||
// If the status's message is empty, the empty string is returned.
|
||||
//
|
||||
// StatusMessageAsCStr exists for C support. Use `status.message()` in C++.
|
||||
absl::Nonnull<const char*> StatusMessageAsCStr(
|
||||
const char* absl_nonnull StatusMessageAsCStr(
|
||||
const Status& status ABSL_ATTRIBUTE_LIFETIME_BOUND);
|
||||
|
||||
ABSL_NAMESPACE_END
|
||||
|
||||
@@ -55,7 +55,7 @@ BadStatusOrAccess& BadStatusOrAccess::operator=(BadStatusOrAccess&& other) {
|
||||
BadStatusOrAccess::BadStatusOrAccess(BadStatusOrAccess&& other)
|
||||
: status_(std::move(other.status_)) {}
|
||||
|
||||
absl::Nonnull<const char*> BadStatusOrAccess::what() const noexcept {
|
||||
const char* absl_nonnull BadStatusOrAccess::what() const noexcept {
|
||||
InitWhat();
|
||||
return what_.c_str();
|
||||
}
|
||||
@@ -70,7 +70,7 @@ void BadStatusOrAccess::InitWhat() const {
|
||||
|
||||
namespace internal_statusor {
|
||||
|
||||
void Helper::HandleInvalidStatusCtorArg(absl::Nonnull<absl::Status*> status) {
|
||||
void Helper::HandleInvalidStatusCtorArg(absl::Status* absl_nonnull status) {
|
||||
const char* kMessage =
|
||||
"An OK status is not a valid constructor argument to StatusOr<T>";
|
||||
#ifdef NDEBUG
|
||||
|
||||
@@ -93,7 +93,7 @@ class BadStatusOrAccess : public std::exception {
|
||||
//
|
||||
// The pointer of this string is guaranteed to be valid until any non-const
|
||||
// function is invoked on the exception object.
|
||||
absl::Nonnull<const char*> what() const noexcept override;
|
||||
const char* absl_nonnull what() const noexcept override;
|
||||
|
||||
// BadStatusOrAccess::status()
|
||||
//
|
||||
@@ -756,13 +756,13 @@ T&& StatusOr<T>::operator*() && {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
absl::Nonnull<const T*> StatusOr<T>::operator->() const {
|
||||
const T* absl_nonnull StatusOr<T>::operator->() const {
|
||||
this->EnsureOk();
|
||||
return &this->data_;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
absl::Nonnull<T*> StatusOr<T>::operator->() {
|
||||
T* absl_nonnull StatusOr<T>::operator->() {
|
||||
this->EnsureOk();
|
||||
return &this->data_;
|
||||
}
|
||||
|
||||
@@ -183,8 +183,8 @@ constexpr bool AsciiInAZRangeNaive(unsigned char c) {
|
||||
}
|
||||
|
||||
template <bool ToUpper, bool Naive>
|
||||
constexpr void AsciiStrCaseFoldImpl(absl::Nonnull<char*> dst,
|
||||
absl::Nullable<const char*> src,
|
||||
constexpr void AsciiStrCaseFoldImpl(char* absl_nonnull dst,
|
||||
const char* absl_nullable src,
|
||||
size_t size) {
|
||||
// The upper- and lowercase versions of ASCII characters differ by only 1 bit.
|
||||
// When we need to flip the case, we can xor with this bit to achieve the
|
||||
@@ -211,18 +211,18 @@ constexpr void AsciiStrCaseFoldImpl(absl::Nonnull<char*> dst,
|
||||
// strings it's not important).
|
||||
// `src` may be null iff `size` is zero.
|
||||
template <bool ToUpper>
|
||||
constexpr void AsciiStrCaseFold(absl::Nonnull<char*> dst,
|
||||
absl::Nullable<const char*> src, size_t size) {
|
||||
constexpr void AsciiStrCaseFold(char* absl_nonnull dst,
|
||||
const char* absl_nullable src, size_t size) {
|
||||
size < 16 ? AsciiStrCaseFoldImpl<ToUpper, /*Naive=*/true>(dst, src, size)
|
||||
: AsciiStrCaseFoldImpl<ToUpper, /*Naive=*/false>(dst, src, size);
|
||||
}
|
||||
|
||||
void AsciiStrToLower(absl::Nonnull<char*> dst, absl::Nullable<const char*> src,
|
||||
void AsciiStrToLower(char* absl_nonnull dst, const char* absl_nullable src,
|
||||
size_t n) {
|
||||
return AsciiStrCaseFold<false>(dst, src, n);
|
||||
}
|
||||
|
||||
void AsciiStrToUpper(absl::Nonnull<char*> dst, absl::Nullable<const char*> src,
|
||||
void AsciiStrToUpper(char* absl_nonnull dst, const char* absl_nullable src,
|
||||
size_t n) {
|
||||
return AsciiStrCaseFold<true>(dst, src, n);
|
||||
}
|
||||
@@ -253,17 +253,17 @@ static_assert(ValidateAsciiCasefold() == 0, "error in case conversion");
|
||||
|
||||
} // namespace ascii_internal
|
||||
|
||||
void AsciiStrToLower(absl::Nonnull<std::string*> s) {
|
||||
void AsciiStrToLower(std::string* absl_nonnull s) {
|
||||
char* p = &(*s)[0];
|
||||
return ascii_internal::AsciiStrCaseFold<false>(p, p, s->size());
|
||||
}
|
||||
|
||||
void AsciiStrToUpper(absl::Nonnull<std::string*> s) {
|
||||
void AsciiStrToUpper(std::string* absl_nonnull s) {
|
||||
char* p = &(*s)[0];
|
||||
return ascii_internal::AsciiStrCaseFold<true>(p, p, s->size());
|
||||
}
|
||||
|
||||
void RemoveExtraAsciiWhitespace(absl::Nonnull<std::string*> str) {
|
||||
void RemoveExtraAsciiWhitespace(std::string* absl_nonnull str) {
|
||||
auto stripped = StripAsciiWhitespace(*str);
|
||||
|
||||
if (stripped.empty()) {
|
||||
|
||||
@@ -76,10 +76,10 @@ ABSL_DLL extern const char kToUpper[256];
|
||||
// Declaration for the array of characters to lower-case characters.
|
||||
ABSL_DLL extern const char kToLower[256];
|
||||
|
||||
void AsciiStrToLower(absl::Nonnull<char*> dst, absl::Nullable<const char*> src,
|
||||
void AsciiStrToLower(char* absl_nonnull dst, const char* absl_nullable src,
|
||||
size_t n);
|
||||
|
||||
void AsciiStrToUpper(absl::Nonnull<char*> dst, absl::Nullable<const char*> src,
|
||||
void AsciiStrToUpper(char* absl_nonnull dst, const char* absl_nullable src,
|
||||
size_t n);
|
||||
|
||||
} // namespace ascii_internal
|
||||
@@ -185,7 +185,7 @@ inline char ascii_tolower(unsigned char c) {
|
||||
}
|
||||
|
||||
// Converts the characters in `s` to lowercase, changing the contents of `s`.
|
||||
void AsciiStrToLower(absl::Nonnull<std::string*> s);
|
||||
void AsciiStrToLower(std::string* absl_nonnull s);
|
||||
|
||||
// Creates a lowercase string from a given absl::string_view.
|
||||
[[nodiscard]] inline std::string AsciiStrToLower(absl::string_view s) {
|
||||
@@ -214,7 +214,7 @@ inline char ascii_toupper(unsigned char c) {
|
||||
}
|
||||
|
||||
// Converts the characters in `s` to uppercase, changing the contents of `s`.
|
||||
void AsciiStrToUpper(absl::Nonnull<std::string*> s);
|
||||
void AsciiStrToUpper(std::string* absl_nonnull s);
|
||||
|
||||
// Creates an uppercase string from a given absl::string_view.
|
||||
[[nodiscard]] inline std::string AsciiStrToUpper(absl::string_view s) {
|
||||
@@ -243,7 +243,7 @@ template <int&... DoNotSpecify>
|
||||
}
|
||||
|
||||
// Strips in place whitespace from the beginning of the given string.
|
||||
inline void StripLeadingAsciiWhitespace(absl::Nonnull<std::string*> str) {
|
||||
inline void StripLeadingAsciiWhitespace(std::string* absl_nonnull str) {
|
||||
auto it = std::find_if_not(str->begin(), str->end(), absl::ascii_isspace);
|
||||
str->erase(str->begin(), it);
|
||||
}
|
||||
@@ -257,7 +257,7 @@ inline void StripLeadingAsciiWhitespace(absl::Nonnull<std::string*> str) {
|
||||
}
|
||||
|
||||
// Strips in place whitespace from the end of the given string
|
||||
inline void StripTrailingAsciiWhitespace(absl::Nonnull<std::string*> str) {
|
||||
inline void StripTrailingAsciiWhitespace(std::string* absl_nonnull str) {
|
||||
auto it = std::find_if_not(str->rbegin(), str->rend(), absl::ascii_isspace);
|
||||
str->erase(static_cast<size_t>(str->rend() - it));
|
||||
}
|
||||
@@ -270,13 +270,13 @@ inline void StripTrailingAsciiWhitespace(absl::Nonnull<std::string*> str) {
|
||||
}
|
||||
|
||||
// Strips in place whitespace from both ends of the given string
|
||||
inline void StripAsciiWhitespace(absl::Nonnull<std::string*> str) {
|
||||
inline void StripAsciiWhitespace(std::string* absl_nonnull str) {
|
||||
StripTrailingAsciiWhitespace(str);
|
||||
StripLeadingAsciiWhitespace(str);
|
||||
}
|
||||
|
||||
// Removes leading, trailing, and consecutive internal whitespace.
|
||||
void RemoveExtraAsciiWhitespace(absl::Nonnull<std::string*> str);
|
||||
void RemoveExtraAsciiWhitespace(std::string* absl_nonnull str);
|
||||
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
|
||||
@@ -120,7 +120,7 @@ struct FloatTraits<double> {
|
||||
// Parsing a smaller N will produce something finite.
|
||||
static constexpr int kEiselLemireMaxExclusiveExp10 = 309;
|
||||
|
||||
static double MakeNan(absl::Nonnull<const char*> tagp) {
|
||||
static double MakeNan(const char* absl_nonnull tagp) {
|
||||
#if ABSL_HAVE_BUILTIN(__builtin_nan)
|
||||
// Use __builtin_nan() if available since it has a fix for
|
||||
// https://bugs.llvm.org/show_bug.cgi?id=37778
|
||||
@@ -193,7 +193,7 @@ struct FloatTraits<float> {
|
||||
static constexpr int kEiselLemireMinInclusiveExp10 = -46 - 18;
|
||||
static constexpr int kEiselLemireMaxExclusiveExp10 = 39;
|
||||
|
||||
static float MakeNan(absl::Nonnull<const char*> tagp) {
|
||||
static float MakeNan(const char* absl_nonnull tagp) {
|
||||
#if ABSL_HAVE_BUILTIN(__builtin_nanf)
|
||||
// Use __builtin_nanf() if available since it has a fix for
|
||||
// https://bugs.llvm.org/show_bug.cgi?id=37778
|
||||
@@ -345,7 +345,7 @@ int NormalizedShiftSize(int mantissa_width, int binary_exponent) {
|
||||
// `value` must be wider than the requested bit width.
|
||||
//
|
||||
// Returns the number of bits shifted.
|
||||
int TruncateToBitWidth(int bit_width, absl::Nonnull<uint128*> value) {
|
||||
int TruncateToBitWidth(int bit_width, uint128* absl_nonnull value) {
|
||||
const int current_bit_width = BitWidth(*value);
|
||||
const int shift = current_bit_width - bit_width;
|
||||
*value >>= shift;
|
||||
@@ -357,7 +357,7 @@ int TruncateToBitWidth(int bit_width, absl::Nonnull<uint128*> value) {
|
||||
// the appropriate double, and returns true.
|
||||
template <typename FloatType>
|
||||
bool HandleEdgeCase(const strings_internal::ParsedFloat& input, bool negative,
|
||||
absl::Nonnull<FloatType*> value) {
|
||||
FloatType* absl_nonnull value) {
|
||||
if (input.type == strings_internal::FloatType::kNan) {
|
||||
// A bug in gcc would cause the compiler to optimize away the buffer we are
|
||||
// building below. Declaring the buffer volatile avoids the issue, and has
|
||||
@@ -403,8 +403,8 @@ bool HandleEdgeCase(const strings_internal::ParsedFloat& input, bool negative,
|
||||
// number is stored in *value.
|
||||
template <typename FloatType>
|
||||
void EncodeResult(const CalculatedFloat& calculated, bool negative,
|
||||
absl::Nonnull<absl::from_chars_result*> result,
|
||||
absl::Nonnull<FloatType*> value) {
|
||||
absl::from_chars_result* absl_nonnull result,
|
||||
FloatType* absl_nonnull value) {
|
||||
if (calculated.exponent == kOverflow) {
|
||||
result->ec = std::errc::result_out_of_range;
|
||||
*value = negative ? -std::numeric_limits<FloatType>::max()
|
||||
@@ -450,7 +450,7 @@ void EncodeResult(const CalculatedFloat& calculated, bool negative,
|
||||
// Zero and negative values of `shift` are accepted, in which case the word is
|
||||
// shifted left, as necessary.
|
||||
uint64_t ShiftRightAndRound(uint128 value, int shift, bool input_exact,
|
||||
absl::Nonnull<bool*> output_exact) {
|
||||
bool* absl_nonnull output_exact) {
|
||||
if (shift <= 0) {
|
||||
*output_exact = input_exact;
|
||||
return static_cast<uint64_t>(value << -shift);
|
||||
@@ -684,8 +684,7 @@ CalculatedFloat CalculateFromParsedDecimal(
|
||||
// this function returns false) is both fast and correct.
|
||||
template <typename FloatType>
|
||||
bool EiselLemire(const strings_internal::ParsedFloat& input, bool negative,
|
||||
absl::Nonnull<FloatType*> value,
|
||||
absl::Nonnull<std::errc*> ec) {
|
||||
FloatType* absl_nonnull value, std::errc* absl_nonnull ec) {
|
||||
uint64_t man = input.mantissa;
|
||||
int exp10 = input.exponent;
|
||||
if (exp10 < FloatTraits<FloatType>::kEiselLemireMinInclusiveExp10) {
|
||||
@@ -858,9 +857,9 @@ bool EiselLemire(const strings_internal::ParsedFloat& input, bool negative,
|
||||
}
|
||||
|
||||
template <typename FloatType>
|
||||
from_chars_result FromCharsImpl(absl::Nonnull<const char*> first,
|
||||
absl::Nonnull<const char*> last,
|
||||
FloatType& value, chars_format fmt_flags) {
|
||||
from_chars_result FromCharsImpl(const char* absl_nonnull first,
|
||||
const char* absl_nonnull last, FloatType& value,
|
||||
chars_format fmt_flags) {
|
||||
from_chars_result result;
|
||||
result.ptr = first; // overwritten on successful parse
|
||||
result.ec = std::errc();
|
||||
@@ -945,14 +944,14 @@ from_chars_result FromCharsImpl(absl::Nonnull<const char*> first,
|
||||
}
|
||||
} // namespace
|
||||
|
||||
from_chars_result from_chars(absl::Nonnull<const char*> first,
|
||||
absl::Nonnull<const char*> last, double& value,
|
||||
from_chars_result from_chars(const char* absl_nonnull first,
|
||||
const char* absl_nonnull last, double& value,
|
||||
chars_format fmt) {
|
||||
return FromCharsImpl(first, last, value, fmt);
|
||||
}
|
||||
|
||||
from_chars_result from_chars(absl::Nonnull<const char*> first,
|
||||
absl::Nonnull<const char*> last, float& value,
|
||||
from_chars_result from_chars(const char* absl_nonnull first,
|
||||
const char* absl_nonnull last, float& value,
|
||||
chars_format fmt) {
|
||||
return FromCharsImpl(first, last, value, fmt);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ enum class chars_format {
|
||||
// characters that were successfully parsed. If none was found, `ptr` is set
|
||||
// to the `first` argument to from_chars.
|
||||
struct from_chars_result {
|
||||
absl::Nonnull<const char*> ptr;
|
||||
const char* absl_nonnull ptr;
|
||||
std::errc ec;
|
||||
};
|
||||
|
||||
@@ -77,13 +77,13 @@ struct from_chars_result {
|
||||
// format that strtod() accepts, except that a "0x" prefix is NOT matched.
|
||||
// (In particular, in `hex` mode, the input "0xff" results in the largest
|
||||
// matching pattern "0".)
|
||||
absl::from_chars_result from_chars(absl::Nonnull<const char*> first,
|
||||
absl::Nonnull<const char*> last,
|
||||
absl::from_chars_result from_chars(const char* absl_nonnull first,
|
||||
const char* absl_nonnull last,
|
||||
double& value, // NOLINT
|
||||
chars_format fmt = chars_format::general);
|
||||
|
||||
absl::from_chars_result from_chars(absl::Nonnull<const char*> first,
|
||||
absl::Nonnull<const char*> last,
|
||||
absl::from_chars_result from_chars(const char* absl_nonnull first,
|
||||
const char* absl_nonnull last,
|
||||
float& value, // NOLINT
|
||||
chars_format fmt = chars_format::general);
|
||||
|
||||
|
||||
@@ -75,21 +75,19 @@ using ::absl::cord_internal::kMinFlatLength;
|
||||
using ::absl::cord_internal::kInlinedVectorSize;
|
||||
using ::absl::cord_internal::kMaxBytesToCopy;
|
||||
|
||||
static void DumpNode(absl::Nonnull<CordRep*> nonnull_rep, bool include_data,
|
||||
absl::Nonnull<std::ostream*> os, int indent = 0);
|
||||
static bool VerifyNode(absl::Nonnull<CordRep*> root,
|
||||
absl::Nonnull<CordRep*> start_node);
|
||||
static void DumpNode(CordRep* absl_nonnull nonnull_rep, bool include_data,
|
||||
std::ostream* absl_nonnull os, int indent = 0);
|
||||
static bool VerifyNode(CordRep* absl_nonnull root,
|
||||
CordRep* absl_nonnull start_node);
|
||||
|
||||
static inline absl::Nullable<CordRep*> VerifyTree(
|
||||
absl::Nullable<CordRep*> node) {
|
||||
static inline CordRep* absl_nullable VerifyTree(CordRep* absl_nullable node) {
|
||||
assert(node == nullptr || VerifyNode(node, node));
|
||||
static_cast<void>(&VerifyNode);
|
||||
return node;
|
||||
}
|
||||
|
||||
static absl::Nonnull<CordRepFlat*> CreateFlat(absl::Nonnull<const char*> data,
|
||||
size_t length,
|
||||
size_t alloc_hint) {
|
||||
static CordRepFlat* absl_nonnull CreateFlat(const char* absl_nonnull data,
|
||||
size_t length, size_t alloc_hint) {
|
||||
CordRepFlat* flat = CordRepFlat::New(length + alloc_hint);
|
||||
flat->length = length;
|
||||
memcpy(flat->Data(), data, length);
|
||||
@@ -98,8 +96,8 @@ static absl::Nonnull<CordRepFlat*> CreateFlat(absl::Nonnull<const char*> data,
|
||||
|
||||
// Creates a new flat or Btree out of the specified array.
|
||||
// The returned node has a refcount of 1.
|
||||
static absl::Nonnull<CordRep*> NewBtree(absl::Nonnull<const char*> data,
|
||||
size_t length, size_t alloc_hint) {
|
||||
static CordRep* absl_nonnull NewBtree(const char* absl_nonnull data,
|
||||
size_t length, size_t alloc_hint) {
|
||||
if (length <= kMaxFlatLength) {
|
||||
return CreateFlat(data, length, alloc_hint);
|
||||
}
|
||||
@@ -112,8 +110,8 @@ static absl::Nonnull<CordRep*> NewBtree(absl::Nonnull<const char*> data,
|
||||
|
||||
// Create a new tree out of the specified array.
|
||||
// The returned node has a refcount of 1.
|
||||
static absl::Nullable<CordRep*> NewTree(absl::Nullable<const char*> data,
|
||||
size_t length, size_t alloc_hint) {
|
||||
static CordRep* absl_nullable NewTree(const char* absl_nullable data,
|
||||
size_t length, size_t alloc_hint) {
|
||||
if (length == 0) return nullptr;
|
||||
return NewBtree(data, length, alloc_hint);
|
||||
}
|
||||
@@ -121,7 +119,7 @@ static absl::Nullable<CordRep*> NewTree(absl::Nullable<const char*> data,
|
||||
namespace cord_internal {
|
||||
|
||||
void InitializeCordRepExternal(absl::string_view data,
|
||||
absl::Nonnull<CordRepExternal*> rep) {
|
||||
CordRepExternal* absl_nonnull rep) {
|
||||
assert(!data.empty());
|
||||
rep->length = data.size();
|
||||
rep->tag = EXTERNAL;
|
||||
@@ -135,7 +133,7 @@ void InitializeCordRepExternal(absl::string_view data,
|
||||
// and not wasteful, we move the string into an external cord rep, preserving
|
||||
// the already allocated string contents.
|
||||
// Requires the provided string length to be larger than `kMaxInline`.
|
||||
static absl::Nonnull<CordRep*> CordRepFromString(std::string&& src) {
|
||||
static CordRep* absl_nonnull CordRepFromString(std::string&& src) {
|
||||
assert(src.length() > cord_internal::kMaxInline);
|
||||
if (
|
||||
// String is short: copy data to avoid external block overhead.
|
||||
@@ -163,13 +161,12 @@ static absl::Nonnull<CordRep*> CordRepFromString(std::string&& src) {
|
||||
// --------------------------------------------------------------------
|
||||
// Cord::InlineRep functions
|
||||
|
||||
inline void Cord::InlineRep::set_data(absl::Nonnull<const char*> data,
|
||||
size_t n) {
|
||||
inline void Cord::InlineRep::set_data(const char* absl_nonnull data, size_t n) {
|
||||
static_assert(kMaxInline == 15, "set_data is hard-coded for a length of 15");
|
||||
data_.set_inline_data(data, n);
|
||||
}
|
||||
|
||||
inline absl::Nonnull<char*> Cord::InlineRep::set_data(size_t n) {
|
||||
inline char* absl_nonnull Cord::InlineRep::set_data(size_t n) {
|
||||
assert(n <= kMaxInline);
|
||||
ResetToEmpty();
|
||||
set_inline_size(n);
|
||||
@@ -193,13 +190,13 @@ inline void Cord::InlineRep::remove_prefix(size_t n) {
|
||||
|
||||
// Returns `rep` converted into a CordRepBtree.
|
||||
// Directly returns `rep` if `rep` is already a CordRepBtree.
|
||||
static absl::Nonnull<CordRepBtree*> ForceBtree(CordRep* rep) {
|
||||
static CordRepBtree* absl_nonnull ForceBtree(CordRep* rep) {
|
||||
return rep->IsBtree()
|
||||
? rep->btree()
|
||||
: CordRepBtree::Create(cord_internal::RemoveCrcNode(rep));
|
||||
}
|
||||
|
||||
void Cord::InlineRep::AppendTreeToInlined(absl::Nonnull<CordRep*> tree,
|
||||
void Cord::InlineRep::AppendTreeToInlined(CordRep* absl_nonnull tree,
|
||||
MethodIdentifier method) {
|
||||
assert(!is_tree());
|
||||
if (!data_.is_empty()) {
|
||||
@@ -209,7 +206,7 @@ void Cord::InlineRep::AppendTreeToInlined(absl::Nonnull<CordRep*> tree,
|
||||
EmplaceTree(tree, method);
|
||||
}
|
||||
|
||||
void Cord::InlineRep::AppendTreeToTree(absl::Nonnull<CordRep*> tree,
|
||||
void Cord::InlineRep::AppendTreeToTree(CordRep* absl_nonnull tree,
|
||||
MethodIdentifier method) {
|
||||
assert(is_tree());
|
||||
const CordzUpdateScope scope(data_.cordz_info(), method);
|
||||
@@ -217,7 +214,7 @@ void Cord::InlineRep::AppendTreeToTree(absl::Nonnull<CordRep*> tree,
|
||||
SetTree(tree, scope);
|
||||
}
|
||||
|
||||
void Cord::InlineRep::AppendTree(absl::Nonnull<CordRep*> tree,
|
||||
void Cord::InlineRep::AppendTree(CordRep* absl_nonnull tree,
|
||||
MethodIdentifier method) {
|
||||
assert(tree != nullptr);
|
||||
assert(tree->length != 0);
|
||||
@@ -229,7 +226,7 @@ void Cord::InlineRep::AppendTree(absl::Nonnull<CordRep*> tree,
|
||||
}
|
||||
}
|
||||
|
||||
void Cord::InlineRep::PrependTreeToInlined(absl::Nonnull<CordRep*> tree,
|
||||
void Cord::InlineRep::PrependTreeToInlined(CordRep* absl_nonnull tree,
|
||||
MethodIdentifier method) {
|
||||
assert(!is_tree());
|
||||
if (!data_.is_empty()) {
|
||||
@@ -239,7 +236,7 @@ void Cord::InlineRep::PrependTreeToInlined(absl::Nonnull<CordRep*> tree,
|
||||
EmplaceTree(tree, method);
|
||||
}
|
||||
|
||||
void Cord::InlineRep::PrependTreeToTree(absl::Nonnull<CordRep*> tree,
|
||||
void Cord::InlineRep::PrependTreeToTree(CordRep* absl_nonnull tree,
|
||||
MethodIdentifier method) {
|
||||
assert(is_tree());
|
||||
const CordzUpdateScope scope(data_.cordz_info(), method);
|
||||
@@ -247,7 +244,7 @@ void Cord::InlineRep::PrependTreeToTree(absl::Nonnull<CordRep*> tree,
|
||||
SetTree(tree, scope);
|
||||
}
|
||||
|
||||
void Cord::InlineRep::PrependTree(absl::Nonnull<CordRep*> tree,
|
||||
void Cord::InlineRep::PrependTree(CordRep* absl_nonnull tree,
|
||||
MethodIdentifier method) {
|
||||
assert(tree != nullptr);
|
||||
assert(tree->length != 0);
|
||||
@@ -263,9 +260,10 @@ void Cord::InlineRep::PrependTree(absl::Nonnull<CordRep*> tree,
|
||||
// suitable leaf is found, the function will update the length field for all
|
||||
// nodes to account for the size increase. The append region address will be
|
||||
// written to region and the actual size increase will be written to size.
|
||||
static inline bool PrepareAppendRegion(
|
||||
absl::Nonnull<CordRep*> root, absl::Nonnull<absl::Nullable<char*>*> region,
|
||||
absl::Nonnull<size_t*> size, size_t max_length) {
|
||||
static inline bool PrepareAppendRegion(CordRep* absl_nonnull root,
|
||||
char* absl_nullable* absl_nonnull region,
|
||||
size_t* absl_nonnull size,
|
||||
size_t max_length) {
|
||||
if (root->IsBtree() && root->refcount.IsOne()) {
|
||||
Span<char> span = root->btree()->GetAppendBuffer(max_length);
|
||||
if (!span.empty()) {
|
||||
@@ -468,11 +466,11 @@ void Cord::InlineRep::AppendArray(absl::string_view src,
|
||||
CommitTree(root, rep, scope, method);
|
||||
}
|
||||
|
||||
inline absl::Nonnull<CordRep*> Cord::TakeRep() const& {
|
||||
inline CordRep* absl_nonnull Cord::TakeRep() const& {
|
||||
return CordRep::Ref(contents_.tree());
|
||||
}
|
||||
|
||||
inline absl::Nonnull<CordRep*> Cord::TakeRep() && {
|
||||
inline CordRep* absl_nonnull Cord::TakeRep() && {
|
||||
CordRep* rep = contents_.tree();
|
||||
contents_.clear();
|
||||
return rep;
|
||||
@@ -530,7 +528,7 @@ inline void Cord::AppendImpl(C&& src) {
|
||||
contents_.AppendTree(rep, CordzUpdateTracker::kAppendCord);
|
||||
}
|
||||
|
||||
static CordRep::ExtractResult ExtractAppendBuffer(absl::Nonnull<CordRep*> rep,
|
||||
static CordRep::ExtractResult ExtractAppendBuffer(CordRep* absl_nonnull rep,
|
||||
size_t min_capacity) {
|
||||
switch (rep->tag) {
|
||||
case cord_internal::BTREE:
|
||||
@@ -777,9 +775,9 @@ int ClampResult(int memcmp_res) {
|
||||
return static_cast<int>(memcmp_res > 0) - static_cast<int>(memcmp_res < 0);
|
||||
}
|
||||
|
||||
int CompareChunks(absl::Nonnull<absl::string_view*> lhs,
|
||||
absl::Nonnull<absl::string_view*> rhs,
|
||||
absl::Nonnull<size_t*> size_to_compare) {
|
||||
int CompareChunks(absl::string_view* absl_nonnull lhs,
|
||||
absl::string_view* absl_nonnull rhs,
|
||||
size_t* absl_nonnull size_to_compare) {
|
||||
size_t compared_size = std::min(lhs->size(), rhs->size());
|
||||
assert(*size_to_compare >= compared_size);
|
||||
*size_to_compare -= compared_size;
|
||||
@@ -877,7 +875,7 @@ void Cord::SetExpectedChecksum(uint32_t crc) {
|
||||
SetCrcCordState(std::move(state));
|
||||
}
|
||||
|
||||
absl::Nullable<const crc_internal::CrcCordState*> Cord::MaybeGetCrcCordState()
|
||||
const crc_internal::CrcCordState* absl_nullable Cord::MaybeGetCrcCordState()
|
||||
const {
|
||||
if (!contents_.is_tree() || !contents_.tree()->IsCrc()) {
|
||||
return nullptr;
|
||||
@@ -895,8 +893,8 @@ absl::optional<uint32_t> Cord::ExpectedChecksum() const {
|
||||
|
||||
inline int Cord::CompareSlowPath(absl::string_view rhs, size_t compared_size,
|
||||
size_t size_to_compare) const {
|
||||
auto advance = [](absl::Nonnull<Cord::ChunkIterator*> it,
|
||||
absl::Nonnull<absl::string_view*> chunk) {
|
||||
auto advance = [](Cord::ChunkIterator* absl_nonnull it,
|
||||
absl::string_view* absl_nonnull chunk) {
|
||||
if (!chunk->empty()) return true;
|
||||
++*it;
|
||||
if (it->bytes_remaining_ == 0) return false;
|
||||
@@ -926,8 +924,8 @@ inline int Cord::CompareSlowPath(absl::string_view rhs, size_t compared_size,
|
||||
|
||||
inline int Cord::CompareSlowPath(const Cord& rhs, size_t compared_size,
|
||||
size_t size_to_compare) const {
|
||||
auto advance = [](absl::Nonnull<Cord::ChunkIterator*> it,
|
||||
absl::Nonnull<absl::string_view*> chunk) {
|
||||
auto advance = [](Cord::ChunkIterator* absl_nonnull it,
|
||||
absl::string_view* absl_nonnull chunk) {
|
||||
if (!chunk->empty()) return true;
|
||||
++*it;
|
||||
if (it->bytes_remaining_ == 0) return false;
|
||||
@@ -1051,7 +1049,7 @@ Cord::operator std::string() const {
|
||||
return s;
|
||||
}
|
||||
|
||||
void CopyCordToString(const Cord& src, absl::Nonnull<std::string*> dst) {
|
||||
void CopyCordToString(const Cord& src, std::string* absl_nonnull dst) {
|
||||
if (!src.contents_.is_tree()) {
|
||||
src.contents_.CopyTo(dst);
|
||||
} else {
|
||||
@@ -1060,7 +1058,7 @@ void CopyCordToString(const Cord& src, absl::Nonnull<std::string*> dst) {
|
||||
}
|
||||
}
|
||||
|
||||
void AppendCordToString(const Cord& src, absl::Nonnull<std::string*> dst) {
|
||||
void AppendCordToString(const Cord& src, std::string* absl_nonnull dst) {
|
||||
const size_t cur_dst_size = dst->size();
|
||||
const size_t new_dst_size = cur_dst_size + src.size();
|
||||
absl::strings_internal::STLStringResizeUninitializedAmortized(dst,
|
||||
@@ -1069,7 +1067,7 @@ void AppendCordToString(const Cord& src, absl::Nonnull<std::string*> dst) {
|
||||
src.CopyToArrayImpl(append_ptr);
|
||||
}
|
||||
|
||||
void Cord::CopyToArraySlowPath(absl::Nonnull<char*> dst) const {
|
||||
void Cord::CopyToArraySlowPath(char* absl_nonnull dst) const {
|
||||
assert(contents_.is_tree());
|
||||
absl::string_view fragment;
|
||||
if (GetFlatAux(contents_.tree(), &fragment) && !fragment.empty()) {
|
||||
@@ -1395,8 +1393,8 @@ absl::string_view Cord::FlattenSlowPath() {
|
||||
return absl::string_view(new_buffer, total_size);
|
||||
}
|
||||
|
||||
/* static */ bool Cord::GetFlatAux(absl::Nonnull<CordRep*> rep,
|
||||
absl::Nonnull<absl::string_view*> fragment) {
|
||||
/* static */ bool Cord::GetFlatAux(CordRep* absl_nonnull rep,
|
||||
absl::string_view* absl_nonnull fragment) {
|
||||
assert(rep != nullptr);
|
||||
if (rep->length == 0) {
|
||||
*fragment = absl::string_view();
|
||||
@@ -1430,7 +1428,7 @@ absl::string_view Cord::FlattenSlowPath() {
|
||||
}
|
||||
|
||||
/* static */ void Cord::ForEachChunkAux(
|
||||
absl::Nonnull<absl::cord_internal::CordRep*> rep,
|
||||
absl::cord_internal::CordRep* absl_nonnull rep,
|
||||
absl::FunctionRef<void(absl::string_view)> callback) {
|
||||
assert(rep != nullptr);
|
||||
if (rep->length == 0) return;
|
||||
@@ -1455,8 +1453,8 @@ absl::string_view Cord::FlattenSlowPath() {
|
||||
}
|
||||
}
|
||||
|
||||
static void DumpNode(absl::Nonnull<CordRep*> nonnull_rep, bool include_data,
|
||||
absl::Nonnull<std::ostream*> os, int indent) {
|
||||
static void DumpNode(CordRep* absl_nonnull nonnull_rep, bool include_data,
|
||||
std::ostream* absl_nonnull os, int indent) {
|
||||
CordRep* rep = nonnull_rep;
|
||||
const int kIndentStep = 1;
|
||||
for (;;) {
|
||||
@@ -1502,17 +1500,17 @@ static void DumpNode(absl::Nonnull<CordRep*> nonnull_rep, bool include_data,
|
||||
}
|
||||
}
|
||||
|
||||
static std::string ReportError(absl::Nonnull<CordRep*> root,
|
||||
absl::Nonnull<CordRep*> node) {
|
||||
static std::string ReportError(CordRep* absl_nonnull root,
|
||||
CordRep* absl_nonnull node) {
|
||||
std::ostringstream buf;
|
||||
buf << "Error at node " << node << " in:";
|
||||
DumpNode(root, true, &buf);
|
||||
return buf.str();
|
||||
}
|
||||
|
||||
static bool VerifyNode(absl::Nonnull<CordRep*> root,
|
||||
absl::Nonnull<CordRep*> start_node) {
|
||||
absl::InlinedVector<absl::Nonnull<CordRep*>, 2> worklist;
|
||||
static bool VerifyNode(CordRep* absl_nonnull root,
|
||||
CordRep* absl_nonnull start_node) {
|
||||
absl::InlinedVector<CordRep* absl_nonnull, 2> worklist;
|
||||
worklist.push_back(start_node);
|
||||
do {
|
||||
CordRep* node = worklist.back();
|
||||
|
||||
@@ -102,8 +102,8 @@ class Cord;
|
||||
class CordTestPeer;
|
||||
template <typename Releaser>
|
||||
Cord MakeCordFromExternal(absl::string_view, Releaser&&);
|
||||
void CopyCordToString(const Cord& src, absl::Nonnull<std::string*> dst);
|
||||
void AppendCordToString(const Cord& src, absl::Nonnull<std::string*> dst);
|
||||
void CopyCordToString(const Cord& src, std::string* absl_nonnull dst);
|
||||
void AppendCordToString(const Cord& src, std::string* absl_nonnull dst);
|
||||
|
||||
// Cord memory accounting modes
|
||||
enum class CordMemoryAccounting {
|
||||
@@ -417,8 +417,7 @@ class Cord {
|
||||
// guarantee that pointers previously returned by `dst->data()` remain valid
|
||||
// even if `*dst` had enough capacity to hold `src`. If `*dst` is a new
|
||||
// object, prefer to simply use the conversion operator to `std::string`.
|
||||
friend void CopyCordToString(const Cord& src,
|
||||
absl::Nonnull<std::string*> dst);
|
||||
friend void CopyCordToString(const Cord& src, std::string* absl_nonnull dst);
|
||||
|
||||
// AppendCordToString()
|
||||
//
|
||||
@@ -430,7 +429,7 @@ class Cord {
|
||||
// `dst->data()`. If `*dst` is a new object, prefer to simply use the
|
||||
// conversion operator to `std::string`.
|
||||
friend void AppendCordToString(const Cord& src,
|
||||
absl::Nonnull<std::string*> dst);
|
||||
std::string* absl_nonnull dst);
|
||||
|
||||
class CharIterator;
|
||||
|
||||
@@ -467,7 +466,7 @@ class Cord {
|
||||
using iterator_category = std::input_iterator_tag;
|
||||
using value_type = absl::string_view;
|
||||
using difference_type = ptrdiff_t;
|
||||
using pointer = absl::Nonnull<const value_type*>;
|
||||
using pointer = const value_type* absl_nonnull;
|
||||
using reference = value_type;
|
||||
|
||||
ChunkIterator() = default;
|
||||
@@ -488,13 +487,13 @@ class Cord {
|
||||
using CordRepBtreeReader = absl::cord_internal::CordRepBtreeReader;
|
||||
|
||||
// Constructs a `begin()` iterator from `tree`.
|
||||
explicit ChunkIterator(absl::Nonnull<cord_internal::CordRep*> tree);
|
||||
explicit ChunkIterator(cord_internal::CordRep* absl_nonnull tree);
|
||||
|
||||
// Constructs a `begin()` iterator from `cord`.
|
||||
explicit ChunkIterator(absl::Nonnull<const Cord*> cord);
|
||||
explicit ChunkIterator(const Cord* absl_nonnull cord);
|
||||
|
||||
// Initializes this instance from a tree. Invoked by constructors.
|
||||
void InitTree(absl::Nonnull<cord_internal::CordRep*> tree);
|
||||
void InitTree(cord_internal::CordRep* absl_nonnull tree);
|
||||
|
||||
// Removes `n` bytes from `current_chunk_`. Expects `n` to be smaller than
|
||||
// `current_chunk_.size()`.
|
||||
@@ -512,7 +511,7 @@ class Cord {
|
||||
// The current leaf, or `nullptr` if the iterator points to short data.
|
||||
// If the current chunk is a substring node, current_leaf_ points to the
|
||||
// underlying flat or external node.
|
||||
absl::Nullable<absl::cord_internal::CordRep*> current_leaf_ = nullptr;
|
||||
absl::cord_internal::CordRep* absl_nullable current_leaf_ = nullptr;
|
||||
// The number of bytes left in the `Cord` over which we are iterating.
|
||||
size_t bytes_remaining_ = 0;
|
||||
|
||||
@@ -569,13 +568,13 @@ class Cord {
|
||||
using iterator = ChunkIterator;
|
||||
using const_iterator = ChunkIterator;
|
||||
|
||||
explicit ChunkRange(absl::Nonnull<const Cord*> cord) : cord_(cord) {}
|
||||
explicit ChunkRange(const Cord* absl_nonnull cord) : cord_(cord) {}
|
||||
|
||||
ChunkIterator begin() const;
|
||||
ChunkIterator end() const;
|
||||
|
||||
private:
|
||||
absl::Nonnull<const Cord*> cord_;
|
||||
const Cord* absl_nonnull cord_;
|
||||
};
|
||||
|
||||
// Cord::Chunks()
|
||||
@@ -628,7 +627,7 @@ class Cord {
|
||||
using iterator_category = std::input_iterator_tag;
|
||||
using value_type = char;
|
||||
using difference_type = ptrdiff_t;
|
||||
using pointer = absl::Nonnull<const char*>;
|
||||
using pointer = const char* absl_nonnull;
|
||||
using reference = const char&;
|
||||
|
||||
CharIterator() = default;
|
||||
@@ -642,7 +641,7 @@ class Cord {
|
||||
friend Cord;
|
||||
|
||||
private:
|
||||
explicit CharIterator(absl::Nonnull<const Cord*> cord)
|
||||
explicit CharIterator(const Cord* absl_nonnull cord)
|
||||
: chunk_iterator_(cord) {}
|
||||
|
||||
ChunkIterator chunk_iterator_;
|
||||
@@ -654,14 +653,14 @@ class Cord {
|
||||
// advanced as a separate `Cord`. `n_bytes` must be less than or equal to the
|
||||
// number of bytes within the Cord; otherwise, behavior is undefined. It is
|
||||
// valid to pass `char_end()` and `0`.
|
||||
static Cord AdvanceAndRead(absl::Nonnull<CharIterator*> it, size_t n_bytes);
|
||||
static Cord AdvanceAndRead(CharIterator* absl_nonnull it, size_t n_bytes);
|
||||
|
||||
// Cord::Advance()
|
||||
//
|
||||
// Advances the `Cord::CharIterator` by `n_bytes`. `n_bytes` must be less than
|
||||
// or equal to the number of bytes remaining within the Cord; otherwise,
|
||||
// behavior is undefined. It is valid to pass `char_end()` and `0`.
|
||||
static void Advance(absl::Nonnull<CharIterator*> it, size_t n_bytes);
|
||||
static void Advance(CharIterator* absl_nonnull it, size_t n_bytes);
|
||||
|
||||
// Cord::ChunkRemaining()
|
||||
//
|
||||
@@ -710,13 +709,13 @@ class Cord {
|
||||
using iterator = CharIterator;
|
||||
using const_iterator = CharIterator;
|
||||
|
||||
explicit CharRange(absl::Nonnull<const Cord*> cord) : cord_(cord) {}
|
||||
explicit CharRange(const Cord* absl_nonnull cord) : cord_(cord) {}
|
||||
|
||||
CharIterator begin() const;
|
||||
CharIterator end() const;
|
||||
|
||||
private:
|
||||
absl::Nonnull<const Cord*> cord_;
|
||||
const Cord* absl_nonnull cord_;
|
||||
};
|
||||
|
||||
// Cord::Chars()
|
||||
@@ -775,7 +774,7 @@ class Cord {
|
||||
CharIterator Find(const absl::Cord& needle) const;
|
||||
|
||||
// Supports absl::Cord as a sink object for absl::Format().
|
||||
friend void AbslFormatFlush(absl::Nonnull<absl::Cord*> cord,
|
||||
friend void AbslFormatFlush(absl::Cord* absl_nonnull cord,
|
||||
absl::string_view part) {
|
||||
cord->Append(part);
|
||||
}
|
||||
@@ -878,7 +877,7 @@ class Cord {
|
||||
}
|
||||
#endif
|
||||
|
||||
friend absl::Nullable<const CordzInfo*> GetCordzInfoForTesting(
|
||||
friend const CordzInfo* absl_nullable GetCordzInfoForTesting(
|
||||
const Cord& cord);
|
||||
|
||||
// Calls the provided function once for each cord chunk, in order. Unlike
|
||||
@@ -907,21 +906,21 @@ class Cord {
|
||||
InlineRep& operator=(InlineRep&& src) noexcept;
|
||||
|
||||
explicit constexpr InlineRep(absl::string_view sv,
|
||||
absl::Nullable<CordRep*> rep);
|
||||
CordRep* absl_nullable rep);
|
||||
|
||||
void Swap(absl::Nonnull<InlineRep*> rhs);
|
||||
void Swap(InlineRep* absl_nonnull rhs);
|
||||
size_t size() const;
|
||||
// Returns nullptr if holding pointer
|
||||
absl::Nullable<const char*> data() const;
|
||||
const char* absl_nullable data() const;
|
||||
// Discards pointer, if any
|
||||
void set_data(absl::Nonnull<const char*> data, size_t n);
|
||||
absl::Nonnull<char*> set_data(size_t n); // Write data to the result
|
||||
void set_data(const char* absl_nonnull data, size_t n);
|
||||
char* absl_nonnull set_data(size_t n); // Write data to the result
|
||||
// Returns nullptr if holding bytes
|
||||
absl::Nullable<absl::cord_internal::CordRep*> tree() const;
|
||||
absl::Nonnull<absl::cord_internal::CordRep*> as_tree() const;
|
||||
absl::Nonnull<const char*> as_chars() const;
|
||||
absl::cord_internal::CordRep* absl_nullable tree() const;
|
||||
absl::cord_internal::CordRep* absl_nonnull as_tree() const;
|
||||
const char* absl_nonnull as_chars() const;
|
||||
// Returns non-null iff was holding a pointer
|
||||
absl::Nullable<absl::cord_internal::CordRep*> clear();
|
||||
absl::cord_internal::CordRep* absl_nullable clear();
|
||||
// Converts to pointer if necessary.
|
||||
void reduce_size(size_t n); // REQUIRES: holding data
|
||||
void remove_prefix(size_t n); // REQUIRES: holding data
|
||||
@@ -930,58 +929,56 @@ class Cord {
|
||||
|
||||
// Creates a CordRepFlat instance from the current inlined data with `extra'
|
||||
// bytes of desired additional capacity.
|
||||
absl::Nonnull<CordRepFlat*> MakeFlatWithExtraCapacity(size_t extra);
|
||||
CordRepFlat* absl_nonnull MakeFlatWithExtraCapacity(size_t extra);
|
||||
|
||||
// Sets the tree value for this instance. `rep` must not be null.
|
||||
// Requires the current instance to hold a tree, and a lock to be held on
|
||||
// any CordzInfo referenced by this instance. The latter is enforced through
|
||||
// the CordzUpdateScope argument. If the current instance is sampled, then
|
||||
// the CordzInfo instance is updated to reference the new `rep` value.
|
||||
void SetTree(absl::Nonnull<CordRep*> rep, const CordzUpdateScope& scope);
|
||||
void SetTree(CordRep* absl_nonnull rep, const CordzUpdateScope& scope);
|
||||
|
||||
// Identical to SetTree(), except that `rep` is allowed to be null, in
|
||||
// which case the current instance is reset to an empty value.
|
||||
void SetTreeOrEmpty(absl::Nullable<CordRep*> rep,
|
||||
void SetTreeOrEmpty(CordRep* absl_nullable rep,
|
||||
const CordzUpdateScope& scope);
|
||||
|
||||
// Sets the tree value for this instance, and randomly samples this cord.
|
||||
// This function disregards existing contents in `data_`, and should be
|
||||
// called when a Cord is 'promoted' from an 'uninitialized' or 'inlined'
|
||||
// value to a non-inlined (tree / ring) value.
|
||||
void EmplaceTree(absl::Nonnull<CordRep*> rep, MethodIdentifier method);
|
||||
void EmplaceTree(CordRep* absl_nonnull rep, MethodIdentifier method);
|
||||
|
||||
// Identical to EmplaceTree, except that it copies the parent stack from
|
||||
// the provided `parent` data if the parent is sampled.
|
||||
void EmplaceTree(absl::Nonnull<CordRep*> rep, const InlineData& parent,
|
||||
void EmplaceTree(CordRep* absl_nonnull rep, const InlineData& parent,
|
||||
MethodIdentifier method);
|
||||
|
||||
// Commits the change of a newly created, or updated `rep` root value into
|
||||
// this cord. `old_rep` indicates the old (inlined or tree) value of the
|
||||
// cord, and determines if the commit invokes SetTree() or EmplaceTree().
|
||||
void CommitTree(absl::Nullable<const CordRep*> old_rep,
|
||||
absl::Nonnull<CordRep*> rep, const CordzUpdateScope& scope,
|
||||
void CommitTree(const CordRep* absl_nullable old_rep,
|
||||
CordRep* absl_nonnull rep, const CordzUpdateScope& scope,
|
||||
MethodIdentifier method);
|
||||
|
||||
void AppendTreeToInlined(absl::Nonnull<CordRep*> tree,
|
||||
void AppendTreeToInlined(CordRep* absl_nonnull tree,
|
||||
MethodIdentifier method);
|
||||
void AppendTreeToTree(absl::Nonnull<CordRep*> tree,
|
||||
MethodIdentifier method);
|
||||
void AppendTree(absl::Nonnull<CordRep*> tree, MethodIdentifier method);
|
||||
void PrependTreeToInlined(absl::Nonnull<CordRep*> tree,
|
||||
void AppendTreeToTree(CordRep* absl_nonnull tree, MethodIdentifier method);
|
||||
void AppendTree(CordRep* absl_nonnull tree, MethodIdentifier method);
|
||||
void PrependTreeToInlined(CordRep* absl_nonnull tree,
|
||||
MethodIdentifier method);
|
||||
void PrependTreeToTree(absl::Nonnull<CordRep*> tree,
|
||||
MethodIdentifier method);
|
||||
void PrependTree(absl::Nonnull<CordRep*> tree, MethodIdentifier method);
|
||||
void PrependTreeToTree(CordRep* absl_nonnull tree, MethodIdentifier method);
|
||||
void PrependTree(CordRep* absl_nonnull tree, MethodIdentifier method);
|
||||
|
||||
bool IsSame(const InlineRep& other) const { return data_ == other.data_; }
|
||||
|
||||
// Copies the inline contents into `dst`. Assumes the cord is not empty.
|
||||
void CopyTo(absl::Nonnull<std::string*> dst) const {
|
||||
void CopyTo(std::string* absl_nonnull dst) const {
|
||||
data_.CopyInlineToString(dst);
|
||||
}
|
||||
|
||||
// Copies the inline contents into `dst`. Assumes the cord is not empty.
|
||||
void CopyToArray(absl::Nonnull<char*> dst) const;
|
||||
void CopyToArray(char* absl_nonnull dst) const;
|
||||
|
||||
bool is_tree() const { return data_.is_tree(); }
|
||||
|
||||
@@ -994,12 +991,12 @@ class Cord {
|
||||
}
|
||||
|
||||
// Returns the profiled CordzInfo, or nullptr if not sampled.
|
||||
absl::Nullable<absl::cord_internal::CordzInfo*> cordz_info() const {
|
||||
absl::cord_internal::CordzInfo* absl_nullable cordz_info() const {
|
||||
return data_.cordz_info();
|
||||
}
|
||||
|
||||
// Sets the profiled CordzInfo.
|
||||
void set_cordz_info(absl::Nonnull<cord_internal::CordzInfo*> cordz_info) {
|
||||
void set_cordz_info(cord_internal::CordzInfo* absl_nonnull cordz_info) {
|
||||
assert(cordz_info != nullptr);
|
||||
data_.set_cordz_info(cordz_info);
|
||||
}
|
||||
@@ -1031,19 +1028,19 @@ class Cord {
|
||||
InlineRep contents_;
|
||||
|
||||
// Helper for GetFlat() and TryFlat().
|
||||
static bool GetFlatAux(absl::Nonnull<absl::cord_internal::CordRep*> rep,
|
||||
absl::Nonnull<absl::string_view*> fragment);
|
||||
static bool GetFlatAux(absl::cord_internal::CordRep* absl_nonnull rep,
|
||||
absl::string_view* absl_nonnull fragment);
|
||||
|
||||
// Helper for ForEachChunk().
|
||||
static void ForEachChunkAux(
|
||||
absl::Nonnull<absl::cord_internal::CordRep*> rep,
|
||||
absl::cord_internal::CordRep* absl_nonnull rep,
|
||||
absl::FunctionRef<void(absl::string_view)> callback);
|
||||
|
||||
// The destructor for non-empty Cords.
|
||||
void DestroyCordSlow();
|
||||
|
||||
// Out-of-line implementation of slower parts of logic.
|
||||
void CopyToArraySlowPath(absl::Nonnull<char*> dst) const;
|
||||
void CopyToArraySlowPath(char* absl_nonnull dst) const;
|
||||
int CompareSlowPath(absl::string_view rhs, size_t compared_size,
|
||||
size_t size_to_compare) const;
|
||||
int CompareSlowPath(const Cord& rhs, size_t compared_size,
|
||||
@@ -1060,8 +1057,8 @@ class Cord {
|
||||
|
||||
// Returns a new reference to contents_.tree(), or steals an existing
|
||||
// reference if called on an rvalue.
|
||||
absl::Nonnull<absl::cord_internal::CordRep*> TakeRep() const&;
|
||||
absl::Nonnull<absl::cord_internal::CordRep*> TakeRep() &&;
|
||||
absl::cord_internal::CordRep* absl_nonnull TakeRep() const&;
|
||||
absl::cord_internal::CordRep* absl_nonnull TakeRep() &&;
|
||||
|
||||
// Helper for Append().
|
||||
template <typename C>
|
||||
@@ -1098,12 +1095,11 @@ class Cord {
|
||||
|
||||
friend class CrcCord;
|
||||
void SetCrcCordState(crc_internal::CrcCordState state);
|
||||
absl::Nullable<const crc_internal::CrcCordState*> MaybeGetCrcCordState()
|
||||
const;
|
||||
const crc_internal::CrcCordState* absl_nullable MaybeGetCrcCordState() const;
|
||||
|
||||
CharIterator FindImpl(CharIterator it, absl::string_view needle) const;
|
||||
|
||||
void CopyToArrayImpl(absl::Nonnull<char*> dst) const;
|
||||
void CopyToArrayImpl(char* absl_nonnull dst) const;
|
||||
};
|
||||
|
||||
ABSL_NAMESPACE_END
|
||||
@@ -1123,14 +1119,14 @@ namespace cord_internal {
|
||||
// Does non-template-specific `CordRepExternal` initialization.
|
||||
// Requires `data` to be non-empty.
|
||||
void InitializeCordRepExternal(absl::string_view data,
|
||||
absl::Nonnull<CordRepExternal*> rep);
|
||||
CordRepExternal* absl_nonnull rep);
|
||||
|
||||
// Creates a new `CordRep` that owns `data` and `releaser` and returns a pointer
|
||||
// to it. Requires `data` to be non-empty.
|
||||
template <typename Releaser>
|
||||
// NOLINTNEXTLINE - suppress clang-tidy raw pointer return.
|
||||
absl::Nonnull<CordRep*> NewExternalRep(absl::string_view data,
|
||||
Releaser&& releaser) {
|
||||
CordRep* absl_nonnull NewExternalRep(absl::string_view data,
|
||||
Releaser&& releaser) {
|
||||
assert(!data.empty());
|
||||
using ReleaserType = absl::decay_t<Releaser>;
|
||||
CordRepExternal* rep = new CordRepExternalImpl<ReleaserType>(
|
||||
@@ -1142,7 +1138,7 @@ absl::Nonnull<CordRep*> NewExternalRep(absl::string_view data,
|
||||
// Overload for function reference types that dispatches using a function
|
||||
// pointer because there are no `alignof()` or `sizeof()` a function reference.
|
||||
// NOLINTNEXTLINE - suppress clang-tidy raw pointer return.
|
||||
inline absl::Nonnull<CordRep*> NewExternalRep(
|
||||
inline CordRep* absl_nonnull NewExternalRep(
|
||||
absl::string_view data, void (&releaser)(absl::string_view)) {
|
||||
return NewExternalRep(data, &releaser);
|
||||
}
|
||||
@@ -1166,7 +1162,7 @@ Cord MakeCordFromExternal(absl::string_view data, Releaser&& releaser) {
|
||||
}
|
||||
|
||||
constexpr Cord::InlineRep::InlineRep(absl::string_view sv,
|
||||
absl::Nullable<CordRep*> rep)
|
||||
CordRep* absl_nullable rep)
|
||||
: data_(sv, rep) {}
|
||||
|
||||
inline Cord::InlineRep::InlineRep(const Cord::InlineRep& src)
|
||||
@@ -1205,7 +1201,7 @@ inline Cord::InlineRep& Cord::InlineRep::operator=(
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline void Cord::InlineRep::Swap(absl::Nonnull<Cord::InlineRep*> rhs) {
|
||||
inline void Cord::InlineRep::Swap(Cord::InlineRep* absl_nonnull rhs) {
|
||||
if (rhs == this) {
|
||||
return;
|
||||
}
|
||||
@@ -1213,22 +1209,22 @@ inline void Cord::InlineRep::Swap(absl::Nonnull<Cord::InlineRep*> rhs) {
|
||||
swap(data_, rhs->data_);
|
||||
}
|
||||
|
||||
inline absl::Nullable<const char*> Cord::InlineRep::data() const {
|
||||
inline const char* absl_nullable Cord::InlineRep::data() const {
|
||||
return is_tree() ? nullptr : data_.as_chars();
|
||||
}
|
||||
|
||||
inline absl::Nonnull<const char*> Cord::InlineRep::as_chars() const {
|
||||
inline const char* absl_nonnull Cord::InlineRep::as_chars() const {
|
||||
assert(!data_.is_tree());
|
||||
return data_.as_chars();
|
||||
}
|
||||
|
||||
inline absl::Nonnull<absl::cord_internal::CordRep*> Cord::InlineRep::as_tree()
|
||||
inline absl::cord_internal::CordRep* absl_nonnull Cord::InlineRep::as_tree()
|
||||
const {
|
||||
assert(data_.is_tree());
|
||||
return data_.as_tree();
|
||||
}
|
||||
|
||||
inline absl::Nullable<absl::cord_internal::CordRep*> Cord::InlineRep::tree()
|
||||
inline absl::cord_internal::CordRep* absl_nullable Cord::InlineRep::tree()
|
||||
const {
|
||||
if (is_tree()) {
|
||||
return as_tree();
|
||||
@@ -1241,7 +1237,7 @@ inline size_t Cord::InlineRep::size() const {
|
||||
return is_tree() ? as_tree()->length : inline_size();
|
||||
}
|
||||
|
||||
inline absl::Nonnull<cord_internal::CordRepFlat*>
|
||||
inline cord_internal::CordRepFlat* absl_nonnull
|
||||
Cord::InlineRep::MakeFlatWithExtraCapacity(size_t extra) {
|
||||
static_assert(cord_internal::kMinFlatLength >= sizeof(data_), "");
|
||||
size_t len = data_.inline_size();
|
||||
@@ -1251,21 +1247,21 @@ Cord::InlineRep::MakeFlatWithExtraCapacity(size_t extra) {
|
||||
return result;
|
||||
}
|
||||
|
||||
inline void Cord::InlineRep::EmplaceTree(absl::Nonnull<CordRep*> rep,
|
||||
inline void Cord::InlineRep::EmplaceTree(CordRep* absl_nonnull rep,
|
||||
MethodIdentifier method) {
|
||||
assert(rep);
|
||||
data_.make_tree(rep);
|
||||
CordzInfo::MaybeTrackCord(data_, method);
|
||||
}
|
||||
|
||||
inline void Cord::InlineRep::EmplaceTree(absl::Nonnull<CordRep*> rep,
|
||||
inline void Cord::InlineRep::EmplaceTree(CordRep* absl_nonnull rep,
|
||||
const InlineData& parent,
|
||||
MethodIdentifier method) {
|
||||
data_.make_tree(rep);
|
||||
CordzInfo::MaybeTrackCord(data_, parent, method);
|
||||
}
|
||||
|
||||
inline void Cord::InlineRep::SetTree(absl::Nonnull<CordRep*> rep,
|
||||
inline void Cord::InlineRep::SetTree(CordRep* absl_nonnull rep,
|
||||
const CordzUpdateScope& scope) {
|
||||
assert(rep);
|
||||
assert(data_.is_tree());
|
||||
@@ -1273,7 +1269,7 @@ inline void Cord::InlineRep::SetTree(absl::Nonnull<CordRep*> rep,
|
||||
scope.SetCordRep(rep);
|
||||
}
|
||||
|
||||
inline void Cord::InlineRep::SetTreeOrEmpty(absl::Nullable<CordRep*> rep,
|
||||
inline void Cord::InlineRep::SetTreeOrEmpty(CordRep* absl_nullable rep,
|
||||
const CordzUpdateScope& scope) {
|
||||
assert(data_.is_tree());
|
||||
if (rep) {
|
||||
@@ -1284,8 +1280,8 @@ inline void Cord::InlineRep::SetTreeOrEmpty(absl::Nullable<CordRep*> rep,
|
||||
scope.SetCordRep(rep);
|
||||
}
|
||||
|
||||
inline void Cord::InlineRep::CommitTree(absl::Nullable<const CordRep*> old_rep,
|
||||
absl::Nonnull<CordRep*> rep,
|
||||
inline void Cord::InlineRep::CommitTree(const CordRep* absl_nullable old_rep,
|
||||
CordRep* absl_nonnull rep,
|
||||
const CordzUpdateScope& scope,
|
||||
MethodIdentifier method) {
|
||||
if (old_rep) {
|
||||
@@ -1295,7 +1291,7 @@ inline void Cord::InlineRep::CommitTree(absl::Nullable<const CordRep*> old_rep,
|
||||
}
|
||||
}
|
||||
|
||||
inline absl::Nullable<absl::cord_internal::CordRep*> Cord::InlineRep::clear() {
|
||||
inline absl::cord_internal::CordRep* absl_nullable Cord::InlineRep::clear() {
|
||||
if (is_tree()) {
|
||||
CordzInfo::MaybeUntrackCord(cordz_info());
|
||||
}
|
||||
@@ -1304,7 +1300,7 @@ inline absl::Nullable<absl::cord_internal::CordRep*> Cord::InlineRep::clear() {
|
||||
return result;
|
||||
}
|
||||
|
||||
inline void Cord::InlineRep::CopyToArray(absl::Nonnull<char*> dst) const {
|
||||
inline void Cord::InlineRep::CopyToArray(char* absl_nonnull dst) const {
|
||||
assert(!is_tree());
|
||||
size_t n = inline_size();
|
||||
assert(n != 0);
|
||||
@@ -1488,7 +1484,7 @@ inline bool Cord::StartsWith(absl::string_view rhs) const {
|
||||
return EqualsImpl(rhs, rhs_size);
|
||||
}
|
||||
|
||||
inline void Cord::CopyToArrayImpl(absl::Nonnull<char*> dst) const {
|
||||
inline void Cord::CopyToArrayImpl(char* absl_nonnull dst) const {
|
||||
if (!contents_.is_tree()) {
|
||||
if (!empty()) contents_.CopyToArray(dst);
|
||||
} else {
|
||||
@@ -1497,7 +1493,7 @@ inline void Cord::CopyToArrayImpl(absl::Nonnull<char*> dst) const {
|
||||
}
|
||||
|
||||
inline void Cord::ChunkIterator::InitTree(
|
||||
absl::Nonnull<cord_internal::CordRep*> tree) {
|
||||
cord_internal::CordRep* absl_nonnull tree) {
|
||||
tree = cord_internal::SkipCrcNode(tree);
|
||||
if (tree->tag == cord_internal::BTREE) {
|
||||
current_chunk_ = btree_reader_.Init(tree->btree());
|
||||
@@ -1508,12 +1504,12 @@ inline void Cord::ChunkIterator::InitTree(
|
||||
}
|
||||
|
||||
inline Cord::ChunkIterator::ChunkIterator(
|
||||
absl::Nonnull<cord_internal::CordRep*> tree) {
|
||||
cord_internal::CordRep* absl_nonnull tree) {
|
||||
bytes_remaining_ = tree->length;
|
||||
InitTree(tree);
|
||||
}
|
||||
|
||||
inline Cord::ChunkIterator::ChunkIterator(absl::Nonnull<const Cord*> cord) {
|
||||
inline Cord::ChunkIterator::ChunkIterator(const Cord* absl_nonnull cord) {
|
||||
if (CordRep* tree = cord->contents_.tree()) {
|
||||
bytes_remaining_ = tree->length;
|
||||
if (ABSL_PREDICT_TRUE(bytes_remaining_ != 0)) {
|
||||
@@ -1649,13 +1645,13 @@ inline Cord::CharIterator::reference Cord::CharIterator::operator*() const {
|
||||
return *chunk_iterator_->data();
|
||||
}
|
||||
|
||||
inline Cord Cord::AdvanceAndRead(absl::Nonnull<CharIterator*> it,
|
||||
inline Cord Cord::AdvanceAndRead(CharIterator* absl_nonnull it,
|
||||
size_t n_bytes) {
|
||||
assert(it != nullptr);
|
||||
return it->chunk_iterator_.AdvanceAndReadBytes(n_bytes);
|
||||
}
|
||||
|
||||
inline void Cord::Advance(absl::Nonnull<CharIterator*> it, size_t n_bytes) {
|
||||
inline void Cord::Advance(CharIterator* absl_nonnull it, size_t n_bytes) {
|
||||
assert(it != nullptr);
|
||||
it->chunk_iterator_.AdvanceBytes(n_bytes);
|
||||
}
|
||||
|
||||
@@ -39,15 +39,15 @@ enum class Mode { kFairShare, kTotal, kTotalMorePrecise };
|
||||
template <Mode mode>
|
||||
struct CordRepRef {
|
||||
// Instantiates a CordRepRef instance.
|
||||
explicit CordRepRef(absl::Nonnull<const CordRep*> r) : rep(r) {}
|
||||
explicit CordRepRef(const CordRep* absl_nonnull r) : rep(r) {}
|
||||
|
||||
// Creates a child reference holding the provided child.
|
||||
// Overloaded to add cumulative reference count for kFairShare.
|
||||
CordRepRef Child(absl::Nonnull<const CordRep*> child) const {
|
||||
CordRepRef Child(const CordRep* absl_nonnull child) const {
|
||||
return CordRepRef(child);
|
||||
}
|
||||
|
||||
absl::Nonnull<const CordRep*> rep;
|
||||
const CordRep* absl_nonnull rep;
|
||||
};
|
||||
|
||||
// RawUsage holds the computed total number of bytes.
|
||||
@@ -66,7 +66,7 @@ template <>
|
||||
struct RawUsage<Mode::kTotalMorePrecise> {
|
||||
size_t total = 0;
|
||||
// TODO(b/289250880): Replace this with a flat_hash_set.
|
||||
std::unordered_set<absl::Nonnull<const CordRep*>> counted;
|
||||
std::unordered_set<const CordRep* absl_nonnull> counted;
|
||||
|
||||
void Add(size_t size, CordRepRef<Mode::kTotalMorePrecise> repref) {
|
||||
if (counted.insert(repref.rep).second) {
|
||||
@@ -90,15 +90,15 @@ double MaybeDiv(double d, refcount_t refcount) {
|
||||
template <>
|
||||
struct CordRepRef<Mode::kFairShare> {
|
||||
// Creates a CordRepRef with the provided rep and top (parent) fraction.
|
||||
explicit CordRepRef(absl::Nonnull<const CordRep*> r, double frac = 1.0)
|
||||
explicit CordRepRef(const CordRep* absl_nonnull r, double frac = 1.0)
|
||||
: rep(r), fraction(MaybeDiv(frac, r->refcount.Get())) {}
|
||||
|
||||
// Returns a CordRepRef with a fraction of `this->fraction / child.refcount`
|
||||
CordRepRef Child(absl::Nonnull<const CordRep*> child) const {
|
||||
CordRepRef Child(const CordRep* absl_nonnull child) const {
|
||||
return CordRepRef(child, fraction);
|
||||
}
|
||||
|
||||
absl::Nonnull<const CordRep*> rep;
|
||||
const CordRep* absl_nonnull rep;
|
||||
double fraction;
|
||||
};
|
||||
|
||||
@@ -150,7 +150,7 @@ void AnalyzeBtree(CordRepRef<mode> rep, RawUsage<mode>& raw_usage) {
|
||||
}
|
||||
|
||||
template <Mode mode>
|
||||
size_t GetEstimatedUsage(absl::Nonnull<const CordRep*> rep) {
|
||||
size_t GetEstimatedUsage(const CordRep* absl_nonnull rep) {
|
||||
// Zero initialized memory usage totals.
|
||||
RawUsage<mode> raw_usage;
|
||||
|
||||
@@ -179,15 +179,15 @@ size_t GetEstimatedUsage(absl::Nonnull<const CordRep*> rep) {
|
||||
|
||||
} // namespace
|
||||
|
||||
size_t GetEstimatedMemoryUsage(absl::Nonnull<const CordRep*> rep) {
|
||||
size_t GetEstimatedMemoryUsage(const CordRep* absl_nonnull rep) {
|
||||
return GetEstimatedUsage<Mode::kTotal>(rep);
|
||||
}
|
||||
|
||||
size_t GetEstimatedFairShareMemoryUsage(absl::Nonnull<const CordRep*> rep) {
|
||||
size_t GetEstimatedFairShareMemoryUsage(const CordRep* absl_nonnull rep) {
|
||||
return GetEstimatedUsage<Mode::kFairShare>(rep);
|
||||
}
|
||||
|
||||
size_t GetMorePreciseMemoryUsage(absl::Nonnull<const CordRep*> rep) {
|
||||
size_t GetMorePreciseMemoryUsage(const CordRep* absl_nonnull rep) {
|
||||
return GetEstimatedUsage<Mode::kTotalMorePrecise>(rep);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace cord_internal {
|
||||
// Returns the *approximate* number of bytes held in full or in part by this
|
||||
// Cord (which may not remain the same between invocations). Cords that share
|
||||
// memory could each be "charged" independently for the same shared memory.
|
||||
size_t GetEstimatedMemoryUsage(absl::Nonnull<const CordRep*> rep);
|
||||
size_t GetEstimatedMemoryUsage(const CordRep* absl_nonnull rep);
|
||||
|
||||
// Returns the *approximate* number of bytes held in full or in part by this
|
||||
// Cord for the distinct memory held by this cord. This is similar to
|
||||
@@ -47,13 +47,13 @@ size_t GetEstimatedMemoryUsage(absl::Nonnull<const CordRep*> rep);
|
||||
//
|
||||
// This is more expensive than `GetEstimatedMemoryUsage()` as it requires
|
||||
// deduplicating all memory references.
|
||||
size_t GetMorePreciseMemoryUsage(absl::Nonnull<const CordRep*> rep);
|
||||
size_t GetMorePreciseMemoryUsage(const CordRep* absl_nonnull rep);
|
||||
|
||||
// Returns the *approximate* number of bytes held in full or in part by this
|
||||
// CordRep weighted by the sharing ratio of that data. For example, if some data
|
||||
// edge is shared by 4 different Cords, then each cord is attribute 1/4th of
|
||||
// the total memory usage as a 'fair share' of the total memory usage.
|
||||
size_t GetEstimatedFairShareMemoryUsage(absl::Nonnull<const CordRep*> rep);
|
||||
size_t GetEstimatedFairShareMemoryUsage(const CordRep* absl_nonnull rep);
|
||||
|
||||
} // namespace cord_internal
|
||||
ABSL_NAMESPACE_END
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
|
||||
// Returns the CordzInfo for the cord, or nullptr if the cord is not sampled.
|
||||
inline absl::Nullable<const cord_internal::CordzInfo*> GetCordzInfoForTesting(
|
||||
inline const cord_internal::CordzInfo* absl_nullable GetCordzInfoForTesting(
|
||||
const Cord& cord) {
|
||||
if (!cord.contents_.is_tree()) return nullptr;
|
||||
return cord.contents_.cordz_info();
|
||||
@@ -42,7 +42,7 @@ inline absl::Nullable<const cord_internal::CordzInfo*> GetCordzInfoForTesting(
|
||||
|
||||
// Returns true if the provided cordz_info is in the list of sampled cords.
|
||||
inline bool CordzInfoIsListed(
|
||||
absl::Nonnull<const cord_internal::CordzInfo*> cordz_info,
|
||||
const cord_internal::CordzInfo* absl_nonnull cordz_info,
|
||||
cord_internal::CordzSampleToken token = {}) {
|
||||
for (const cord_internal::CordzInfo& info : token) {
|
||||
if (cordz_info == &info) return true;
|
||||
@@ -121,7 +121,7 @@ class CordzSamplingIntervalHelper {
|
||||
|
||||
// Wrapper struct managing a small CordRep `rep`
|
||||
struct TestCordRep {
|
||||
absl::Nonnull<cord_internal::CordRepFlat*> rep;
|
||||
cord_internal::CordRepFlat* absl_nonnull rep;
|
||||
|
||||
TestCordRep() {
|
||||
rep = cord_internal::CordRepFlat::New(100);
|
||||
|
||||
@@ -59,7 +59,7 @@ inline unsigned int hex_digit_to_int(char c) {
|
||||
}
|
||||
|
||||
inline bool IsSurrogate(char32_t c, absl::string_view src,
|
||||
absl::Nullable<std::string*> error) {
|
||||
std::string* absl_nullable error) {
|
||||
if (c >= 0xD800 && c <= 0xDFFF) {
|
||||
if (error) {
|
||||
*error = absl::StrCat("invalid surrogate character (0xD800-DFFF): \\",
|
||||
@@ -85,8 +85,8 @@ inline bool IsSurrogate(char32_t c, absl::string_view src,
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
bool CUnescapeInternal(absl::string_view src, bool leave_nulls_escaped,
|
||||
absl::Nonnull<std::string*> dst,
|
||||
absl::Nullable<std::string*> error) {
|
||||
std::string* absl_nonnull dst,
|
||||
std::string* absl_nullable error) {
|
||||
strings_internal::STLStringResizeUninitialized(dst, src.size());
|
||||
|
||||
absl::string_view::size_type p = 0; // Current src position.
|
||||
@@ -432,7 +432,7 @@ inline size_t CEscapedLength(absl::string_view src) {
|
||||
}
|
||||
|
||||
void CEscapeAndAppendInternal(absl::string_view src,
|
||||
absl::Nonnull<std::string*> dest) {
|
||||
std::string* absl_nonnull dest) {
|
||||
size_t escaped_len = CEscapedLength(src);
|
||||
if (escaped_len == src.size()) {
|
||||
dest->append(src.data(), src.size());
|
||||
@@ -461,10 +461,10 @@ void CEscapeAndAppendInternal(absl::string_view src,
|
||||
|
||||
// Reverses the mapping in Base64EscapeInternal; see that method's
|
||||
// documentation for details of the mapping.
|
||||
bool Base64UnescapeInternal(absl::Nullable<const char*> src_param, size_t szsrc,
|
||||
absl::Nullable<char*> dest, size_t szdest,
|
||||
bool Base64UnescapeInternal(const char* absl_nullable src_param, size_t szsrc,
|
||||
char* absl_nullable dest, size_t szdest,
|
||||
const std::array<signed char, 256>& unbase64,
|
||||
absl::Nonnull<size_t*> len) {
|
||||
size_t* absl_nonnull len) {
|
||||
static const char kPad64Equals = '=';
|
||||
static const char kPad64Dot = '.';
|
||||
|
||||
@@ -800,8 +800,8 @@ constexpr std::array<signed char, 256> kUnWebSafeBase64 = {
|
||||
/* clang-format on */
|
||||
|
||||
template <typename String>
|
||||
bool Base64UnescapeInternal(absl::Nullable<const char*> src, size_t slen,
|
||||
absl::Nonnull<String*> dest,
|
||||
bool Base64UnescapeInternal(const char* absl_nullable src, size_t slen,
|
||||
String* absl_nonnull dest,
|
||||
const std::array<signed char, 256>& unbase64) {
|
||||
// Determine the size of the output string. Base64 encodes every 3 bytes into
|
||||
// 4 characters. Any leftover chars are added directly for good measure.
|
||||
@@ -870,7 +870,7 @@ constexpr std::array<signed char, 256> kHexValueStrict = {
|
||||
// or a string. This works because we use the [] operator to access
|
||||
// individual characters at a time.
|
||||
template <typename T>
|
||||
void HexStringToBytesInternal(absl::Nullable<const char*> from, T to,
|
||||
void HexStringToBytesInternal(const char* absl_nullable from, T to,
|
||||
size_t num) {
|
||||
for (size_t i = 0; i < num; i++) {
|
||||
to[i] = static_cast<char>(kHexValueLenient[from[i * 2] & 0xFF] << 4) +
|
||||
@@ -897,8 +897,8 @@ void BytesToHexStringInternal(absl::Nullable<const unsigned char*> src, T dest,
|
||||
//
|
||||
// See CUnescapeInternal() for implementation details.
|
||||
// ----------------------------------------------------------------------
|
||||
bool CUnescape(absl::string_view source, absl::Nonnull<std::string*> dest,
|
||||
absl::Nullable<std::string*> error) {
|
||||
bool CUnescape(absl::string_view source, std::string* absl_nonnull dest,
|
||||
std::string* absl_nullable error) {
|
||||
return CUnescapeInternal(source, kUnescapeNulls, dest, error);
|
||||
}
|
||||
|
||||
@@ -920,23 +920,23 @@ std::string Utf8SafeCHexEscape(absl::string_view src) {
|
||||
return CEscapeInternal(src, true, true);
|
||||
}
|
||||
|
||||
bool Base64Unescape(absl::string_view src, absl::Nonnull<std::string*> dest) {
|
||||
bool Base64Unescape(absl::string_view src, std::string* absl_nonnull dest) {
|
||||
return Base64UnescapeInternal(src.data(), src.size(), dest, kUnBase64);
|
||||
}
|
||||
|
||||
bool WebSafeBase64Unescape(absl::string_view src,
|
||||
absl::Nonnull<std::string*> dest) {
|
||||
std::string* absl_nonnull dest) {
|
||||
return Base64UnescapeInternal(src.data(), src.size(), dest, kUnWebSafeBase64);
|
||||
}
|
||||
|
||||
void Base64Escape(absl::string_view src, absl::Nonnull<std::string*> dest) {
|
||||
void Base64Escape(absl::string_view src, std::string* absl_nonnull dest) {
|
||||
strings_internal::Base64EscapeInternal(
|
||||
reinterpret_cast<const unsigned char*>(src.data()), src.size(), dest,
|
||||
true, strings_internal::kBase64Chars);
|
||||
}
|
||||
|
||||
void WebSafeBase64Escape(absl::string_view src,
|
||||
absl::Nonnull<std::string*> dest) {
|
||||
std::string* absl_nonnull dest) {
|
||||
strings_internal::Base64EscapeInternal(
|
||||
reinterpret_cast<const unsigned char*>(src.data()), src.size(), dest,
|
||||
false, strings_internal::kWebSafeBase64Chars);
|
||||
@@ -958,8 +958,7 @@ std::string WebSafeBase64Escape(absl::string_view src) {
|
||||
return dest;
|
||||
}
|
||||
|
||||
bool HexStringToBytes(absl::string_view hex,
|
||||
absl::Nonnull<std::string*> bytes) {
|
||||
bool HexStringToBytes(absl::string_view hex, std::string* absl_nonnull bytes) {
|
||||
std::string output;
|
||||
|
||||
size_t num_bytes = hex.size() / 2;
|
||||
|
||||
@@ -71,12 +71,12 @@ ABSL_NAMESPACE_BEGIN
|
||||
// ...
|
||||
// }
|
||||
// EXPECT_EQ(unescaped_s, "foo\rbar\nbaz\t");
|
||||
bool CUnescape(absl::string_view source, absl::Nonnull<std::string*> dest,
|
||||
absl::Nullable<std::string*> error);
|
||||
bool CUnescape(absl::string_view source, std::string* absl_nonnull dest,
|
||||
std::string* absl_nullable error);
|
||||
|
||||
// Overload of `CUnescape()` with no error reporting.
|
||||
inline bool CUnescape(absl::string_view source,
|
||||
absl::Nonnull<std::string*> dest) {
|
||||
std::string* absl_nonnull dest) {
|
||||
return CUnescape(source, dest, nullptr);
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ std::string Utf8SafeCHexEscape(absl::string_view src);
|
||||
// Encodes a `src` string into a base64-encoded 'dest' string with padding
|
||||
// characters. This function conforms with RFC 4648 section 4 (base64) and RFC
|
||||
// 2045.
|
||||
void Base64Escape(absl::string_view src, absl::Nonnull<std::string*> dest);
|
||||
void Base64Escape(absl::string_view src, std::string* absl_nonnull dest);
|
||||
std::string Base64Escape(absl::string_view src);
|
||||
|
||||
// WebSafeBase64Escape()
|
||||
@@ -134,8 +134,7 @@ std::string Base64Escape(absl::string_view src);
|
||||
// Encodes a `src` string into a base64 string, like Base64Escape() does, but
|
||||
// outputs '-' instead of '+' and '_' instead of '/', and does not pad 'dest'.
|
||||
// This function conforms with RFC 4648 section 5 (base64url).
|
||||
void WebSafeBase64Escape(absl::string_view src,
|
||||
absl::Nonnull<std::string*> dest);
|
||||
void WebSafeBase64Escape(absl::string_view src, std::string* absl_nonnull dest);
|
||||
std::string WebSafeBase64Escape(absl::string_view src);
|
||||
|
||||
// Base64Unescape()
|
||||
@@ -145,7 +144,7 @@ std::string WebSafeBase64Escape(absl::string_view src);
|
||||
// `src` contains invalid characters, `dest` is cleared and returns `false`.
|
||||
// If padding is included (note that `Base64Escape()` does produce it), it must
|
||||
// be correct. In the padding, '=' and '.' are treated identically.
|
||||
bool Base64Unescape(absl::string_view src, absl::Nonnull<std::string*> dest);
|
||||
bool Base64Unescape(absl::string_view src, std::string* absl_nonnull dest);
|
||||
|
||||
// WebSafeBase64Unescape()
|
||||
//
|
||||
@@ -155,7 +154,7 @@ bool Base64Unescape(absl::string_view src, absl::Nonnull<std::string*> dest);
|
||||
// included (note that `WebSafeBase64Escape()` does not produce it), it must be
|
||||
// correct. In the padding, '=' and '.' are treated identically.
|
||||
bool WebSafeBase64Unescape(absl::string_view src,
|
||||
absl::Nonnull<std::string*> dest);
|
||||
std::string* absl_nonnull dest);
|
||||
|
||||
// HexStringToBytes()
|
||||
//
|
||||
@@ -164,7 +163,7 @@ bool WebSafeBase64Unescape(absl::string_view src,
|
||||
// function returns false and leaves `bytes` in an unspecified state. Returns
|
||||
// true on success.
|
||||
[[nodiscard]] bool HexStringToBytes(absl::string_view hex,
|
||||
absl::Nonnull<std::string*> bytes);
|
||||
std::string* absl_nonnull bytes);
|
||||
|
||||
// HexStringToBytes()
|
||||
//
|
||||
|
||||
@@ -635,7 +635,7 @@ class InlineData {
|
||||
poison();
|
||||
}
|
||||
|
||||
void CopyInlineToString(absl::Nonnull<std::string*> dst) const {
|
||||
void CopyInlineToString(std::string* absl_nonnull dst) const {
|
||||
assert(!is_tree());
|
||||
// As Cord can store only 15 bytes it is smaller than std::string's
|
||||
// small string optimization buffer size. Therefore we will always trigger
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
|
||||
bool SimpleAtof(absl::string_view str, absl::Nonnull<float*> out) {
|
||||
bool SimpleAtof(absl::string_view str, float* absl_nonnull out) {
|
||||
*out = 0.0;
|
||||
str = StripAsciiWhitespace(str);
|
||||
// std::from_chars doesn't accept an initial +, but SimpleAtof does, so if one
|
||||
@@ -78,7 +78,7 @@ bool SimpleAtof(absl::string_view str, absl::Nonnull<float*> out) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SimpleAtod(absl::string_view str, absl::Nonnull<double*> out) {
|
||||
bool SimpleAtod(absl::string_view str, double* absl_nonnull out) {
|
||||
*out = 0.0;
|
||||
str = StripAsciiWhitespace(str);
|
||||
// std::from_chars doesn't accept an initial +, but SimpleAtod does, so if one
|
||||
@@ -109,7 +109,7 @@ bool SimpleAtod(absl::string_view str, absl::Nonnull<double*> out) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SimpleAtob(absl::string_view str, absl::Nonnull<bool*> out) {
|
||||
bool SimpleAtob(absl::string_view str, bool* absl_nonnull out) {
|
||||
ABSL_RAW_CHECK(out != nullptr, "Output pointer must not be nullptr.");
|
||||
if (EqualsIgnoreCase(str, "true") || EqualsIgnoreCase(str, "t") ||
|
||||
EqualsIgnoreCase(str, "yes") || EqualsIgnoreCase(str, "y") ||
|
||||
@@ -168,7 +168,7 @@ constexpr uint64_t kDivisionBy100Mul = 10486u;
|
||||
constexpr uint64_t kDivisionBy100Div = 1 << 20;
|
||||
|
||||
// Encode functions write the ASCII output of input `n` to `out_str`.
|
||||
inline char* EncodeHundred(uint32_t n, absl::Nonnull<char*> out_str) {
|
||||
inline char* EncodeHundred(uint32_t n, char* absl_nonnull out_str) {
|
||||
int num_digits = static_cast<int>(n - 10) >> 8;
|
||||
uint32_t div10 = (n * kDivisionBy10Mul) / kDivisionBy10Div;
|
||||
uint32_t mod10 = n - 10u * div10;
|
||||
@@ -178,7 +178,7 @@ inline char* EncodeHundred(uint32_t n, absl::Nonnull<char*> out_str) {
|
||||
return out_str + 2 + num_digits;
|
||||
}
|
||||
|
||||
inline char* EncodeTenThousand(uint32_t n, absl::Nonnull<char*> out_str) {
|
||||
inline char* EncodeTenThousand(uint32_t n, char* absl_nonnull out_str) {
|
||||
// We split lower 2 digits and upper 2 digits of n into 2 byte consecutive
|
||||
// blocks. 123 -> [\0\1][\0\23]. We divide by 10 both blocks
|
||||
// (it's 1 division + zeroing upper bits), and compute modulo 10 as well "in
|
||||
@@ -234,8 +234,8 @@ inline uint64_t PrepareEightDigits(uint32_t i) {
|
||||
return tens;
|
||||
}
|
||||
|
||||
inline ABSL_ATTRIBUTE_ALWAYS_INLINE absl::Nonnull<char*> EncodeFullU32(
|
||||
uint32_t n, absl::Nonnull<char*> out_str) {
|
||||
inline ABSL_ATTRIBUTE_ALWAYS_INLINE char* absl_nonnull EncodeFullU32(
|
||||
uint32_t n, char* absl_nonnull out_str) {
|
||||
if (n < 10) {
|
||||
*out_str = static_cast<char>('0' + n);
|
||||
return out_str + 1;
|
||||
@@ -284,7 +284,7 @@ inline ABSL_ATTRIBUTE_ALWAYS_INLINE char* EncodeFullU64(uint64_t i,
|
||||
|
||||
} // namespace
|
||||
|
||||
void numbers_internal::PutTwoDigits(uint32_t i, absl::Nonnull<char*> buf) {
|
||||
void numbers_internal::PutTwoDigits(uint32_t i, char* absl_nonnull buf) {
|
||||
assert(i < 100);
|
||||
uint32_t base = kTwoZeroBytes;
|
||||
uint32_t div10 = (i * kDivisionBy10Mul) / kDivisionBy10Div;
|
||||
@@ -293,15 +293,15 @@ void numbers_internal::PutTwoDigits(uint32_t i, absl::Nonnull<char*> buf) {
|
||||
little_endian::Store16(buf, static_cast<uint16_t>(base));
|
||||
}
|
||||
|
||||
absl::Nonnull<char*> numbers_internal::FastIntToBuffer(
|
||||
uint32_t n, absl::Nonnull<char*> out_str) {
|
||||
char* absl_nonnull numbers_internal::FastIntToBuffer(
|
||||
uint32_t n, char* absl_nonnull out_str) {
|
||||
out_str = EncodeFullU32(n, out_str);
|
||||
*out_str = '\0';
|
||||
return out_str;
|
||||
}
|
||||
|
||||
absl::Nonnull<char*> numbers_internal::FastIntToBuffer(
|
||||
int32_t i, absl::Nonnull<char*> buffer) {
|
||||
char* absl_nonnull numbers_internal::FastIntToBuffer(
|
||||
int32_t i, char* absl_nonnull buffer) {
|
||||
uint32_t u = static_cast<uint32_t>(i);
|
||||
if (i < 0) {
|
||||
*buffer++ = '-';
|
||||
@@ -315,15 +315,15 @@ absl::Nonnull<char*> numbers_internal::FastIntToBuffer(
|
||||
return buffer;
|
||||
}
|
||||
|
||||
absl::Nonnull<char*> numbers_internal::FastIntToBuffer(
|
||||
uint64_t i, absl::Nonnull<char*> buffer) {
|
||||
char* absl_nonnull numbers_internal::FastIntToBuffer(
|
||||
uint64_t i, char* absl_nonnull buffer) {
|
||||
buffer = EncodeFullU64(i, buffer);
|
||||
*buffer = '\0';
|
||||
return buffer;
|
||||
}
|
||||
|
||||
absl::Nonnull<char*> numbers_internal::FastIntToBuffer(
|
||||
int64_t i, absl::Nonnull<char*> buffer) {
|
||||
char* absl_nonnull numbers_internal::FastIntToBuffer(
|
||||
int64_t i, char* absl_nonnull buffer) {
|
||||
uint64_t u = static_cast<uint64_t>(i);
|
||||
if (i < 0) {
|
||||
*buffer++ = '-';
|
||||
@@ -546,7 +546,7 @@ static ExpDigits SplitToSix(const double value) {
|
||||
// Helper function for fast formatting of floating-point.
|
||||
// The result is the same as "%g", a.k.a. "%.6g".
|
||||
size_t numbers_internal::SixDigitsToBuffer(double d,
|
||||
absl::Nonnull<char*> const buffer) {
|
||||
char* absl_nonnull const buffer) {
|
||||
static_assert(std::numeric_limits<float>::is_iec559,
|
||||
"IEEE-754/IEC-559 support only");
|
||||
|
||||
@@ -694,9 +694,9 @@ static constexpr std::array<int8_t, 256> kAsciiToInt = {
|
||||
|
||||
// Parse the sign and optional hex or oct prefix in text.
|
||||
inline bool safe_parse_sign_and_base(
|
||||
absl::Nonnull<absl::string_view*> text /*inout*/,
|
||||
absl::Nonnull<int*> base_ptr /*inout*/,
|
||||
absl::Nonnull<bool*> negative_ptr /*output*/) {
|
||||
absl::string_view* absl_nonnull text /*inout*/,
|
||||
int* absl_nonnull base_ptr /*inout*/,
|
||||
bool* absl_nonnull negative_ptr /*output*/) {
|
||||
if (text->data() == nullptr) {
|
||||
return false;
|
||||
}
|
||||
@@ -981,7 +981,7 @@ ABSL_CONST_INIT const IntType LookupTables<IntType>::kVminOverBase[] =
|
||||
|
||||
template <typename IntType>
|
||||
inline bool safe_parse_positive_int(absl::string_view text, int base,
|
||||
absl::Nonnull<IntType*> value_p) {
|
||||
IntType* absl_nonnull value_p) {
|
||||
IntType value = 0;
|
||||
const IntType vmax = std::numeric_limits<IntType>::max();
|
||||
assert(vmax > 0);
|
||||
@@ -1018,7 +1018,7 @@ inline bool safe_parse_positive_int(absl::string_view text, int base,
|
||||
|
||||
template <typename IntType>
|
||||
inline bool safe_parse_negative_int(absl::string_view text, int base,
|
||||
absl::Nonnull<IntType*> value_p) {
|
||||
IntType* absl_nonnull value_p) {
|
||||
IntType value = 0;
|
||||
const IntType vmin = std::numeric_limits<IntType>::min();
|
||||
assert(vmin < 0);
|
||||
@@ -1063,7 +1063,7 @@ inline bool safe_parse_negative_int(absl::string_view text, int base,
|
||||
// http://pubs.opengroup.org/onlinepubs/9699919799/functions/strtol.html
|
||||
template <typename IntType>
|
||||
inline bool safe_int_internal(absl::string_view text,
|
||||
absl::Nonnull<IntType*> value_p, int base) {
|
||||
IntType* absl_nonnull value_p, int base) {
|
||||
*value_p = 0;
|
||||
bool negative;
|
||||
if (!safe_parse_sign_and_base(&text, &base, &negative)) {
|
||||
@@ -1078,7 +1078,7 @@ inline bool safe_int_internal(absl::string_view text,
|
||||
|
||||
template <typename IntType>
|
||||
inline bool safe_uint_internal(absl::string_view text,
|
||||
absl::Nonnull<IntType*> value_p, int base) {
|
||||
IntType* absl_nonnull value_p, int base) {
|
||||
*value_p = 0;
|
||||
bool negative;
|
||||
if (!safe_parse_sign_and_base(&text, &base, &negative) || negative) {
|
||||
@@ -1112,52 +1112,52 @@ ABSL_CONST_INIT ABSL_DLL const char kHexTable[513] =
|
||||
"e0e1e2e3e4e5e6e7e8e9eaebecedeeef"
|
||||
"f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff";
|
||||
|
||||
bool safe_strto8_base(absl::string_view text, absl::Nonnull<int8_t*> value,
|
||||
bool safe_strto8_base(absl::string_view text, int8_t* absl_nonnull value,
|
||||
int base) {
|
||||
return safe_int_internal<int8_t>(text, value, base);
|
||||
}
|
||||
|
||||
bool safe_strto16_base(absl::string_view text, absl::Nonnull<int16_t*> value,
|
||||
bool safe_strto16_base(absl::string_view text, int16_t* absl_nonnull value,
|
||||
int base) {
|
||||
return safe_int_internal<int16_t>(text, value, base);
|
||||
}
|
||||
|
||||
bool safe_strto32_base(absl::string_view text, absl::Nonnull<int32_t*> value,
|
||||
bool safe_strto32_base(absl::string_view text, int32_t* absl_nonnull value,
|
||||
int base) {
|
||||
return safe_int_internal<int32_t>(text, value, base);
|
||||
}
|
||||
|
||||
bool safe_strto64_base(absl::string_view text, absl::Nonnull<int64_t*> value,
|
||||
bool safe_strto64_base(absl::string_view text, int64_t* absl_nonnull value,
|
||||
int base) {
|
||||
return safe_int_internal<int64_t>(text, value, base);
|
||||
}
|
||||
|
||||
bool safe_strto128_base(absl::string_view text, absl::Nonnull<int128*> value,
|
||||
bool safe_strto128_base(absl::string_view text, int128* absl_nonnull value,
|
||||
int base) {
|
||||
return safe_int_internal<absl::int128>(text, value, base);
|
||||
}
|
||||
|
||||
bool safe_strtou8_base(absl::string_view text, absl::Nonnull<uint8_t*> value,
|
||||
bool safe_strtou8_base(absl::string_view text, uint8_t* absl_nonnull value,
|
||||
int base) {
|
||||
return safe_uint_internal<uint8_t>(text, value, base);
|
||||
}
|
||||
|
||||
bool safe_strtou16_base(absl::string_view text, absl::Nonnull<uint16_t*> value,
|
||||
bool safe_strtou16_base(absl::string_view text, uint16_t* absl_nonnull value,
|
||||
int base) {
|
||||
return safe_uint_internal<uint16_t>(text, value, base);
|
||||
}
|
||||
|
||||
bool safe_strtou32_base(absl::string_view text, absl::Nonnull<uint32_t*> value,
|
||||
bool safe_strtou32_base(absl::string_view text, uint32_t* absl_nonnull value,
|
||||
int base) {
|
||||
return safe_uint_internal<uint32_t>(text, value, base);
|
||||
}
|
||||
|
||||
bool safe_strtou64_base(absl::string_view text, absl::Nonnull<uint64_t*> value,
|
||||
bool safe_strtou64_base(absl::string_view text, uint64_t* absl_nonnull value,
|
||||
int base) {
|
||||
return safe_uint_internal<uint64_t>(text, value, base);
|
||||
}
|
||||
|
||||
bool safe_strtou128_base(absl::string_view text, absl::Nonnull<uint128*> value,
|
||||
bool safe_strtou128_base(absl::string_view text, uint128* absl_nonnull value,
|
||||
int base) {
|
||||
return safe_uint_internal<absl::uint128>(text, value, base);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ ABSL_NAMESPACE_BEGIN
|
||||
// state.
|
||||
template <typename int_type>
|
||||
[[nodiscard]] bool SimpleAtoi(absl::string_view str,
|
||||
absl::Nonnull<int_type*> out);
|
||||
int_type* absl_nonnull out);
|
||||
|
||||
// SimpleAtof()
|
||||
//
|
||||
@@ -74,7 +74,7 @@ template <typename int_type>
|
||||
// allowed formats for `str`, except SimpleAtof() is locale-independent and will
|
||||
// always use the "C" locale. If any errors are encountered, this function
|
||||
// returns `false`, leaving `out` in an unspecified state.
|
||||
[[nodiscard]] bool SimpleAtof(absl::string_view str, absl::Nonnull<float*> out);
|
||||
[[nodiscard]] bool SimpleAtof(absl::string_view str, float* absl_nonnull out);
|
||||
|
||||
// SimpleAtod()
|
||||
//
|
||||
@@ -85,8 +85,7 @@ template <typename int_type>
|
||||
// allowed formats for `str`, except SimpleAtod is locale-independent and will
|
||||
// always use the "C" locale. If any errors are encountered, this function
|
||||
// returns `false`, leaving `out` in an unspecified state.
|
||||
[[nodiscard]] bool SimpleAtod(absl::string_view str,
|
||||
absl::Nonnull<double*> out);
|
||||
[[nodiscard]] bool SimpleAtod(absl::string_view str, double* absl_nonnull out);
|
||||
|
||||
// SimpleAtob()
|
||||
//
|
||||
@@ -96,7 +95,7 @@ template <typename int_type>
|
||||
// are interpreted as boolean `false`: "false", "f", "no", "n", "0". If any
|
||||
// errors are encountered, this function returns `false`, leaving `out` in an
|
||||
// unspecified state.
|
||||
[[nodiscard]] bool SimpleAtob(absl::string_view str, absl::Nonnull<bool*> out);
|
||||
[[nodiscard]] bool SimpleAtob(absl::string_view str, bool* absl_nonnull out);
|
||||
|
||||
// SimpleHexAtoi()
|
||||
//
|
||||
@@ -110,13 +109,13 @@ template <typename int_type>
|
||||
// `false`, leaving `out` in an unspecified state.
|
||||
template <typename int_type>
|
||||
[[nodiscard]] bool SimpleHexAtoi(absl::string_view str,
|
||||
absl::Nonnull<int_type*> out);
|
||||
int_type* absl_nonnull out);
|
||||
|
||||
// Overloads of SimpleHexAtoi() for 128 bit integers.
|
||||
[[nodiscard]] inline bool SimpleHexAtoi(absl::string_view str,
|
||||
absl::Nonnull<absl::int128*> out);
|
||||
absl::int128* absl_nonnull out);
|
||||
[[nodiscard]] inline bool SimpleHexAtoi(absl::string_view str,
|
||||
absl::Nonnull<absl::uint128*> out);
|
||||
absl::uint128* absl_nonnull out);
|
||||
|
||||
ABSL_NAMESPACE_END
|
||||
} // namespace absl
|
||||
@@ -150,30 +149,30 @@ ABSL_DLL extern const char
|
||||
// PutTwoDigits(42, buf);
|
||||
// // buf[0] == '4'
|
||||
// // buf[1] == '2'
|
||||
void PutTwoDigits(uint32_t i, absl::Nonnull<char*> buf);
|
||||
void PutTwoDigits(uint32_t i, char* absl_nonnull buf);
|
||||
|
||||
// safe_strto?() functions for implementing SimpleAtoi()
|
||||
|
||||
bool safe_strto8_base(absl::string_view text, absl::Nonnull<int8_t*> value,
|
||||
bool safe_strto8_base(absl::string_view text, int8_t* absl_nonnull value,
|
||||
int base);
|
||||
bool safe_strto16_base(absl::string_view text, absl::Nonnull<int16_t*> value,
|
||||
bool safe_strto16_base(absl::string_view text, int16_t* absl_nonnull value,
|
||||
int base);
|
||||
bool safe_strto32_base(absl::string_view text, absl::Nonnull<int32_t*> value,
|
||||
bool safe_strto32_base(absl::string_view text, int32_t* absl_nonnull value,
|
||||
int base);
|
||||
bool safe_strto64_base(absl::string_view text, absl::Nonnull<int64_t*> value,
|
||||
bool safe_strto64_base(absl::string_view text, int64_t* absl_nonnull value,
|
||||
int base);
|
||||
bool safe_strto128_base(absl::string_view text,
|
||||
absl::Nonnull<absl::int128*> value, int base);
|
||||
bool safe_strtou8_base(absl::string_view text, absl::Nonnull<uint8_t*> value,
|
||||
absl::int128* absl_nonnull value, int base);
|
||||
bool safe_strtou8_base(absl::string_view text, uint8_t* absl_nonnull value,
|
||||
int base);
|
||||
bool safe_strtou16_base(absl::string_view text, absl::Nonnull<uint16_t*> value,
|
||||
bool safe_strtou16_base(absl::string_view text, uint16_t* absl_nonnull value,
|
||||
int base);
|
||||
bool safe_strtou32_base(absl::string_view text, absl::Nonnull<uint32_t*> value,
|
||||
bool safe_strtou32_base(absl::string_view text, uint32_t* absl_nonnull value,
|
||||
int base);
|
||||
bool safe_strtou64_base(absl::string_view text, absl::Nonnull<uint64_t*> value,
|
||||
bool safe_strtou64_base(absl::string_view text, uint64_t* absl_nonnull value,
|
||||
int base);
|
||||
bool safe_strtou128_base(absl::string_view text,
|
||||
absl::Nonnull<absl::uint128*> value, int base);
|
||||
absl::uint128* absl_nonnull value, int base);
|
||||
|
||||
static const int kFastToBufferSize = 32;
|
||||
static const int kSixDigitsToBufferSize = 16;
|
||||
@@ -184,25 +183,25 @@ static const int kSixDigitsToBufferSize = 16;
|
||||
// outside the range 0.0001-999999 are output using scientific notation
|
||||
// (1.23456e+06). This routine is heavily optimized.
|
||||
// Required buffer size is `kSixDigitsToBufferSize`.
|
||||
size_t SixDigitsToBuffer(double d, absl::Nonnull<char*> buffer);
|
||||
size_t SixDigitsToBuffer(double d, char* absl_nonnull buffer);
|
||||
|
||||
// WARNING: These functions may write more characters than necessary, because
|
||||
// they are intended for speed. All functions take an output buffer
|
||||
// as an argument and return a pointer to the last byte they wrote, which is the
|
||||
// terminating '\0'. At most `kFastToBufferSize` bytes are written.
|
||||
absl::Nonnull<char*> FastIntToBuffer(int32_t i, absl::Nonnull<char*> buffer)
|
||||
char* absl_nonnull FastIntToBuffer(int32_t i, char* absl_nonnull buffer)
|
||||
ABSL_INTERNAL_NEED_MIN_SIZE(buffer, kFastToBufferSize);
|
||||
absl::Nonnull<char*> FastIntToBuffer(uint32_t n, absl::Nonnull<char*> out_str)
|
||||
char* absl_nonnull FastIntToBuffer(uint32_t n, char* absl_nonnull out_str)
|
||||
ABSL_INTERNAL_NEED_MIN_SIZE(out_str, kFastToBufferSize);
|
||||
absl::Nonnull<char*> FastIntToBuffer(int64_t i, absl::Nonnull<char*> buffer)
|
||||
char* absl_nonnull FastIntToBuffer(int64_t i, char* absl_nonnull buffer)
|
||||
ABSL_INTERNAL_NEED_MIN_SIZE(buffer, kFastToBufferSize);
|
||||
absl::Nonnull<char*> FastIntToBuffer(uint64_t i, absl::Nonnull<char*> buffer)
|
||||
char* absl_nonnull FastIntToBuffer(uint64_t i, char* absl_nonnull buffer)
|
||||
ABSL_INTERNAL_NEED_MIN_SIZE(buffer, kFastToBufferSize);
|
||||
|
||||
// For enums and integer types that are not an exact match for the types above,
|
||||
// use templates to call the appropriate one of the four overloads above.
|
||||
template <typename int_type>
|
||||
absl::Nonnull<char*> FastIntToBuffer(int_type i, absl::Nonnull<char*> buffer)
|
||||
char* absl_nonnull FastIntToBuffer(int_type i, char* absl_nonnull buffer)
|
||||
ABSL_INTERNAL_NEED_MIN_SIZE(buffer, kFastToBufferSize) {
|
||||
static_assert(sizeof(i) <= 64 / 8,
|
||||
"FastIntToBuffer works only with 64-bit-or-less integers.");
|
||||
@@ -228,7 +227,7 @@ absl::Nonnull<char*> FastIntToBuffer(int_type i, absl::Nonnull<char*> buffer)
|
||||
// with base different from 10 elsewhere in Abseil implementation).
|
||||
template <typename int_type>
|
||||
[[nodiscard]] bool safe_strtoi_base(absl::string_view s,
|
||||
absl::Nonnull<int_type*> out, int base) {
|
||||
int_type* absl_nonnull out, int base) {
|
||||
static_assert(sizeof(*out) == 1 || sizeof(*out) == 2 || sizeof(*out) == 4 ||
|
||||
sizeof(*out) == 8,
|
||||
"SimpleAtoi works only with 8, 16, 32, or 64-bit integers.");
|
||||
@@ -284,7 +283,7 @@ template <typename int_type>
|
||||
// without the terminating null character. Thus `out` must be of length >= 16.
|
||||
// Returns the number of non-pad digits of the output (it can never be zero
|
||||
// since 0 has one digit).
|
||||
inline size_t FastHexToBufferZeroPad16(uint64_t val, absl::Nonnull<char*> out) {
|
||||
inline size_t FastHexToBufferZeroPad16(uint64_t val, char* absl_nonnull out) {
|
||||
#ifdef ABSL_INTERNAL_HAVE_SSSE3
|
||||
uint64_t be = absl::big_endian::FromHost64(val);
|
||||
const auto kNibbleMask = _mm_set1_epi8(0xf);
|
||||
@@ -311,33 +310,33 @@ inline size_t FastHexToBufferZeroPad16(uint64_t val, absl::Nonnull<char*> out) {
|
||||
|
||||
template <typename int_type>
|
||||
[[nodiscard]] bool SimpleAtoi(absl::string_view str,
|
||||
absl::Nonnull<int_type*> out) {
|
||||
int_type* absl_nonnull out) {
|
||||
return numbers_internal::safe_strtoi_base(str, out, 10);
|
||||
}
|
||||
|
||||
[[nodiscard]] inline bool SimpleAtoi(absl::string_view str,
|
||||
absl::Nonnull<absl::int128*> out) {
|
||||
absl::int128* absl_nonnull out) {
|
||||
return numbers_internal::safe_strto128_base(str, out, 10);
|
||||
}
|
||||
|
||||
[[nodiscard]] inline bool SimpleAtoi(absl::string_view str,
|
||||
absl::Nonnull<absl::uint128*> out) {
|
||||
absl::uint128* absl_nonnull out) {
|
||||
return numbers_internal::safe_strtou128_base(str, out, 10);
|
||||
}
|
||||
|
||||
template <typename int_type>
|
||||
[[nodiscard]] bool SimpleHexAtoi(absl::string_view str,
|
||||
absl::Nonnull<int_type*> out) {
|
||||
int_type* absl_nonnull out) {
|
||||
return numbers_internal::safe_strtoi_base(str, out, 16);
|
||||
}
|
||||
|
||||
[[nodiscard]] inline bool SimpleHexAtoi(absl::string_view str,
|
||||
absl::Nonnull<absl::int128*> out) {
|
||||
absl::int128* absl_nonnull out) {
|
||||
return numbers_internal::safe_strto128_base(str, out, 16);
|
||||
}
|
||||
|
||||
[[nodiscard]] inline bool SimpleHexAtoi(absl::string_view str,
|
||||
absl::Nonnull<absl::uint128*> out) {
|
||||
absl::uint128* absl_nonnull out) {
|
||||
return numbers_internal::safe_strtou128_base(str, out, 16);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,8 +42,7 @@ ABSL_NAMESPACE_BEGIN
|
||||
namespace {
|
||||
// Append is merely a version of memcpy that returns the address of the byte
|
||||
// after the area just overwritten.
|
||||
inline absl::Nonnull<char*> Append(absl::Nonnull<char*> out,
|
||||
const AlphaNum& x) {
|
||||
inline char* absl_nonnull Append(char* absl_nonnull out, const AlphaNum& x) {
|
||||
// memcpy is allowed to overwrite arbitrary memory, so doing this after the
|
||||
// call would force an extra fetch of x.size().
|
||||
char* after = out + x.size();
|
||||
@@ -159,7 +158,7 @@ std::string CatPieces(std::initializer_list<absl::string_view> pieces) {
|
||||
assert(((src).size() == 0) || \
|
||||
(uintptr_t((src).data() - (dest).data()) > uintptr_t((dest).size())))
|
||||
|
||||
void AppendPieces(absl::Nonnull<std::string*> dest,
|
||||
void AppendPieces(std::string* absl_nonnull dest,
|
||||
std::initializer_list<absl::string_view> pieces) {
|
||||
size_t old_size = dest->size();
|
||||
size_t to_append = 0;
|
||||
@@ -183,7 +182,7 @@ void AppendPieces(absl::Nonnull<std::string*> dest,
|
||||
|
||||
} // namespace strings_internal
|
||||
|
||||
void StrAppend(absl::Nonnull<std::string*> dest, const AlphaNum& a) {
|
||||
void StrAppend(std::string* absl_nonnull dest, const AlphaNum& a) {
|
||||
ASSERT_NO_OVERLAP(*dest, a);
|
||||
std::string::size_type old_size = dest->size();
|
||||
STLStringAppendUninitializedAmortized(dest, a.size());
|
||||
@@ -193,7 +192,7 @@ void StrAppend(absl::Nonnull<std::string*> dest, const AlphaNum& a) {
|
||||
assert(out == begin + dest->size());
|
||||
}
|
||||
|
||||
void StrAppend(absl::Nonnull<std::string*> dest, const AlphaNum& a,
|
||||
void StrAppend(std::string* absl_nonnull dest, const AlphaNum& a,
|
||||
const AlphaNum& b) {
|
||||
ASSERT_NO_OVERLAP(*dest, a);
|
||||
ASSERT_NO_OVERLAP(*dest, b);
|
||||
@@ -206,7 +205,7 @@ void StrAppend(absl::Nonnull<std::string*> dest, const AlphaNum& a,
|
||||
assert(out == begin + dest->size());
|
||||
}
|
||||
|
||||
void StrAppend(absl::Nonnull<std::string*> dest, const AlphaNum& a,
|
||||
void StrAppend(std::string* absl_nonnull dest, const AlphaNum& a,
|
||||
const AlphaNum& b, const AlphaNum& c) {
|
||||
ASSERT_NO_OVERLAP(*dest, a);
|
||||
ASSERT_NO_OVERLAP(*dest, b);
|
||||
@@ -221,7 +220,7 @@ void StrAppend(absl::Nonnull<std::string*> dest, const AlphaNum& a,
|
||||
assert(out == begin + dest->size());
|
||||
}
|
||||
|
||||
void StrAppend(absl::Nonnull<std::string*> dest, const AlphaNum& a,
|
||||
void StrAppend(std::string* absl_nonnull dest, const AlphaNum& a,
|
||||
const AlphaNum& b, const AlphaNum& c, const AlphaNum& d) {
|
||||
ASSERT_NO_OVERLAP(*dest, a);
|
||||
ASSERT_NO_OVERLAP(*dest, b);
|
||||
|
||||
@@ -213,7 +213,7 @@ struct Hex {
|
||||
!std::is_pointer<Int>::value>::type* = nullptr)
|
||||
: Hex(spec, static_cast<uint64_t>(v)) {}
|
||||
template <typename Pointee>
|
||||
explicit Hex(absl::Nullable<Pointee*> v, PadSpec spec = absl::kNoPad)
|
||||
explicit Hex(Pointee* absl_nullable v, PadSpec spec = absl::kNoPad)
|
||||
: Hex(spec, reinterpret_cast<uintptr_t>(v)) {}
|
||||
|
||||
template <typename S>
|
||||
@@ -359,7 +359,7 @@ class AlphaNum {
|
||||
ABSL_ATTRIBUTE_LIFETIME_BOUND)
|
||||
: piece_(&buf.data[0], buf.size) {}
|
||||
|
||||
AlphaNum(absl::Nullable<const char*> c_str // NOLINT(runtime/explicit)
|
||||
AlphaNum(const char* absl_nullable c_str // NOLINT(runtime/explicit)
|
||||
ABSL_ATTRIBUTE_LIFETIME_BOUND)
|
||||
: piece_(NullSafeStringView(c_str)) {}
|
||||
AlphaNum(absl::string_view pc // NOLINT(runtime/explicit)
|
||||
@@ -392,7 +392,7 @@ class AlphaNum {
|
||||
AlphaNum& operator=(const AlphaNum&) = delete;
|
||||
|
||||
absl::string_view::size_type size() const { return piece_.size(); }
|
||||
absl::Nullable<const char*> data() const { return piece_.data(); }
|
||||
const char* absl_nullable data() const { return piece_.data(); }
|
||||
absl::string_view Piece() const { return piece_; }
|
||||
|
||||
// Match unscoped enums. Use integral promotion so that a `char`-backed
|
||||
@@ -462,7 +462,7 @@ namespace strings_internal {
|
||||
|
||||
// Do not call directly - this is not part of the public API.
|
||||
std::string CatPieces(std::initializer_list<absl::string_view> pieces);
|
||||
void AppendPieces(absl::Nonnull<std::string*> dest,
|
||||
void AppendPieces(std::string* absl_nonnull dest,
|
||||
std::initializer_list<absl::string_view> pieces);
|
||||
|
||||
template <typename Integer>
|
||||
@@ -592,18 +592,18 @@ template <typename... AV>
|
||||
// absl::string_view p = s;
|
||||
// StrAppend(&s, p);
|
||||
|
||||
inline void StrAppend(absl::Nonnull<std::string*>) {}
|
||||
void StrAppend(absl::Nonnull<std::string*> dest, const AlphaNum& a);
|
||||
void StrAppend(absl::Nonnull<std::string*> dest, const AlphaNum& a,
|
||||
inline void StrAppend(std::string* absl_nonnull) {}
|
||||
void StrAppend(std::string* absl_nonnull dest, const AlphaNum& a);
|
||||
void StrAppend(std::string* absl_nonnull dest, const AlphaNum& a,
|
||||
const AlphaNum& b);
|
||||
void StrAppend(absl::Nonnull<std::string*> dest, const AlphaNum& a,
|
||||
void StrAppend(std::string* absl_nonnull dest, const AlphaNum& a,
|
||||
const AlphaNum& b, const AlphaNum& c);
|
||||
void StrAppend(absl::Nonnull<std::string*> dest, const AlphaNum& a,
|
||||
void StrAppend(std::string* absl_nonnull dest, const AlphaNum& a,
|
||||
const AlphaNum& b, const AlphaNum& c, const AlphaNum& d);
|
||||
|
||||
// Support 5 or more arguments
|
||||
template <typename... AV>
|
||||
inline void StrAppend(absl::Nonnull<std::string*> dest, const AlphaNum& a,
|
||||
inline void StrAppend(std::string* absl_nonnull dest, const AlphaNum& a,
|
||||
const AlphaNum& b, const AlphaNum& c, const AlphaNum& d,
|
||||
const AlphaNum& e, const AV&... args) {
|
||||
strings_internal::AppendPieces(
|
||||
|
||||
@@ -112,7 +112,7 @@ class UntypedFormatSpec {
|
||||
|
||||
protected:
|
||||
explicit UntypedFormatSpec(
|
||||
absl::Nonnull<const str_format_internal::ParsedFormatBase*> pc)
|
||||
const str_format_internal::ParsedFormatBase* absl_nonnull pc)
|
||||
: spec_(pc) {}
|
||||
|
||||
private:
|
||||
@@ -152,7 +152,7 @@ str_format_internal::StreamedWrapper<T> FormatStreamed(const T& v) {
|
||||
// EXPECT_EQ(8, n);
|
||||
class FormatCountCapture {
|
||||
public:
|
||||
explicit FormatCountCapture(absl::Nonnull<int*> p) : p_(p) {}
|
||||
explicit FormatCountCapture(int* absl_nonnull p) : p_(p) {}
|
||||
|
||||
private:
|
||||
// FormatCountCaptureHelper is used to define FormatConvertImpl() for this
|
||||
@@ -161,8 +161,8 @@ class FormatCountCapture {
|
||||
// Unused() is here because of the false positive from -Wunused-private-field
|
||||
// p_ is used in the templated function of the friend FormatCountCaptureHelper
|
||||
// class.
|
||||
absl::Nonnull<int*> Unused() { return p_; }
|
||||
absl::Nonnull<int*> p_;
|
||||
int* absl_nonnull Unused() { return p_; }
|
||||
int* absl_nonnull p_;
|
||||
};
|
||||
|
||||
// FormatSpec
|
||||
@@ -377,7 +377,7 @@ template <typename... Args>
|
||||
// std::string orig("For example PI is approximately ");
|
||||
// std::cout << StrAppendFormat(&orig, "%12.6f", 3.14);
|
||||
template <typename... Args>
|
||||
std::string& StrAppendFormat(absl::Nonnull<std::string*> dst,
|
||||
std::string& StrAppendFormat(std::string* absl_nonnull dst,
|
||||
const FormatSpec<Args...>& format,
|
||||
const Args&... args) {
|
||||
return str_format_internal::AppendPack(
|
||||
@@ -437,7 +437,7 @@ int PrintF(const FormatSpec<Args...>& format, const Args&... args) {
|
||||
// Outputs: "The capital of Mongolia is Ulaanbaatar"
|
||||
//
|
||||
template <typename... Args>
|
||||
int FPrintF(absl::Nonnull<std::FILE*> output, const FormatSpec<Args...>& format,
|
||||
int FPrintF(std::FILE* absl_nonnull output, const FormatSpec<Args...>& format,
|
||||
const Args&... args) {
|
||||
return str_format_internal::FprintF(
|
||||
output, str_format_internal::UntypedFormatSpecImpl::Extract(format),
|
||||
@@ -466,7 +466,7 @@ int FPrintF(absl::Nonnull<std::FILE*> output, const FormatSpec<Args...>& format,
|
||||
// Post-condition: output == "The capital of Mongolia is Ulaanbaatar"
|
||||
//
|
||||
template <typename... Args>
|
||||
int SNPrintF(absl::Nonnull<char*> output, std::size_t size,
|
||||
int SNPrintF(char* absl_nonnull output, std::size_t size,
|
||||
const FormatSpec<Args...>& format, const Args&... args) {
|
||||
return str_format_internal::SnprintF(
|
||||
output, size, str_format_internal::UntypedFormatSpecImpl::Extract(format),
|
||||
@@ -500,7 +500,7 @@ class FormatRawSink {
|
||||
template <typename T,
|
||||
typename = typename std::enable_if<std::is_constructible<
|
||||
str_format_internal::FormatRawSinkImpl, T*>::value>::type>
|
||||
FormatRawSink(absl::Nonnull<T*> raw) // NOLINT
|
||||
FormatRawSink(T* absl_nonnull raw) // NOLINT
|
||||
: sink_(raw) {}
|
||||
|
||||
private:
|
||||
@@ -857,16 +857,16 @@ class FormatSink {
|
||||
}
|
||||
|
||||
// Support `absl::Format(&sink, format, args...)`.
|
||||
friend void AbslFormatFlush(absl::Nonnull<FormatSink*> sink,
|
||||
friend void AbslFormatFlush(FormatSink* absl_nonnull sink,
|
||||
absl::string_view v) {
|
||||
sink->Append(v);
|
||||
}
|
||||
|
||||
private:
|
||||
friend str_format_internal::FormatSinkImpl;
|
||||
explicit FormatSink(absl::Nonnull<str_format_internal::FormatSinkImpl*> s)
|
||||
explicit FormatSink(str_format_internal::FormatSinkImpl* absl_nonnull s)
|
||||
: sink_(s) {}
|
||||
absl::Nonnull<str_format_internal::FormatSinkImpl*> sink_;
|
||||
str_format_internal::FormatSinkImpl* absl_nonnull sink_;
|
||||
};
|
||||
|
||||
// FormatConvertResult
|
||||
|
||||
@@ -37,8 +37,8 @@ using FixedMapping =
|
||||
// occurred.
|
||||
int ApplySubstitutions(
|
||||
absl::string_view s,
|
||||
absl::Nonnull<std::vector<strings_internal::ViableSubstitution>*> subs_ptr,
|
||||
absl::Nonnull<std::string*> result_ptr) {
|
||||
std::vector<strings_internal::ViableSubstitution>* absl_nonnull subs_ptr,
|
||||
std::string* absl_nonnull result_ptr) {
|
||||
auto& subs = *subs_ptr;
|
||||
int substitutions = 0;
|
||||
size_t pos = 0;
|
||||
@@ -83,7 +83,7 @@ std::string StrReplaceAll(absl::string_view s,
|
||||
}
|
||||
|
||||
int StrReplaceAll(strings_internal::FixedMapping replacements,
|
||||
absl::Nonnull<std::string*> target) {
|
||||
std::string* absl_nonnull target) {
|
||||
return StrReplaceAll<strings_internal::FixedMapping>(replacements, target);
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ std::string StrReplaceAll(absl::string_view s,
|
||||
int StrReplaceAll(
|
||||
std::initializer_list<std::pair<absl::string_view, absl::string_view>>
|
||||
replacements,
|
||||
absl::Nonnull<std::string*> target);
|
||||
std::string* absl_nonnull target);
|
||||
|
||||
// Overload of `StrReplaceAll()` to replace patterns within a given output
|
||||
// string *in place* with replacements provided within a container of key/value
|
||||
@@ -130,7 +130,7 @@ int StrReplaceAll(
|
||||
// EXPECT_EQ("if (ptr < &foo)", s);
|
||||
template <typename StrToStrMapping>
|
||||
int StrReplaceAll(const StrToStrMapping& replacements,
|
||||
absl::Nonnull<std::string*> target);
|
||||
std::string* absl_nonnull target);
|
||||
|
||||
// Implementation details only, past this point.
|
||||
namespace strings_internal {
|
||||
@@ -187,8 +187,8 @@ std::vector<ViableSubstitution> FindSubstitutions(
|
||||
}
|
||||
|
||||
int ApplySubstitutions(absl::string_view s,
|
||||
absl::Nonnull<std::vector<ViableSubstitution>*> subs_ptr,
|
||||
absl::Nonnull<std::string*> result_ptr);
|
||||
std::vector<ViableSubstitution>* absl_nonnull subs_ptr,
|
||||
std::string* absl_nonnull result_ptr);
|
||||
|
||||
} // namespace strings_internal
|
||||
|
||||
@@ -204,7 +204,7 @@ std::string StrReplaceAll(absl::string_view s,
|
||||
|
||||
template <typename StrToStrMapping>
|
||||
int StrReplaceAll(const StrToStrMapping& replacements,
|
||||
absl::Nonnull<std::string*> target) {
|
||||
std::string* absl_nonnull target) {
|
||||
auto subs = strings_internal::FindSubstitutions(*target, replacements);
|
||||
if (subs.empty()) return 0;
|
||||
|
||||
|
||||
@@ -30,10 +30,10 @@ namespace {
|
||||
|
||||
// This is significantly faster for case-sensitive matches with very
|
||||
// few possible matches.
|
||||
absl::Nullable<const char*> memmatch(absl::Nullable<const char*> phaystack,
|
||||
size_t haylen,
|
||||
absl::Nullable<const char*> pneedle,
|
||||
size_t neelen) {
|
||||
const char* absl_nullable memmatch(const char* absl_nullable phaystack,
|
||||
size_t haylen,
|
||||
const char* absl_nullable pneedle,
|
||||
size_t neelen) {
|
||||
if (0 == neelen) {
|
||||
return phaystack; // even if haylen is 0
|
||||
}
|
||||
|
||||
@@ -163,11 +163,11 @@ class ABSL_ATTRIBUTE_VIEW string_view {
|
||||
public:
|
||||
using traits_type = std::char_traits<char>;
|
||||
using value_type = char;
|
||||
using pointer = absl::Nullable<char*>;
|
||||
using const_pointer = absl::Nullable<const char*>;
|
||||
using pointer = char* absl_nullable;
|
||||
using const_pointer = const char* absl_nullable;
|
||||
using reference = char&;
|
||||
using const_reference = const char&;
|
||||
using const_iterator = absl::Nullable<const char*>;
|
||||
using const_iterator = const char* absl_nullable;
|
||||
using iterator = const_iterator;
|
||||
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
||||
using reverse_iterator = const_reverse_iterator;
|
||||
@@ -197,11 +197,11 @@ class ABSL_ATTRIBUTE_VIEW string_view {
|
||||
// instead (see below).
|
||||
// The length check is skipped since it is unnecessary and causes code bloat.
|
||||
constexpr string_view( // NOLINT(runtime/explicit)
|
||||
absl::Nonnull<const char*> str)
|
||||
const char* absl_nonnull str)
|
||||
: ptr_(str), length_(str ? StrlenInternal(str) : 0) {}
|
||||
|
||||
// Constructor of a `string_view` from a `const char*` and length.
|
||||
constexpr string_view(absl::Nullable<const char*> data, size_type len)
|
||||
constexpr string_view(const char* absl_nullable data, size_type len)
|
||||
: ptr_(data), length_(CheckLengthInternal(len)) {}
|
||||
|
||||
constexpr string_view(const string_view&) noexcept = default;
|
||||
@@ -430,21 +430,21 @@ class ABSL_ATTRIBUTE_VIEW string_view {
|
||||
|
||||
// Overload of `string_view::compare()` for comparing a `string_view` and a
|
||||
// a different C-style string `s`.
|
||||
constexpr int compare(absl::Nonnull<const char*> s) const {
|
||||
constexpr int compare(const char* absl_nonnull s) const {
|
||||
return compare(string_view(s));
|
||||
}
|
||||
|
||||
// Overload of `string_view::compare()` for comparing a substring of the
|
||||
// `string_view` and a different string C-style string `s`.
|
||||
constexpr int compare(size_type pos1, size_type count1,
|
||||
absl::Nonnull<const char*> s) const {
|
||||
const char* absl_nonnull s) const {
|
||||
return substr(pos1, count1).compare(string_view(s));
|
||||
}
|
||||
|
||||
// Overload of `string_view::compare()` for comparing a substring of the
|
||||
// `string_view` and a substring of a different C-style string `s`.
|
||||
constexpr int compare(size_type pos1, size_type count1,
|
||||
absl::Nonnull<const char*> s, size_type count2) const {
|
||||
const char* absl_nonnull s, size_type count2) const {
|
||||
return substr(pos1, count1).compare(string_view(s, count2));
|
||||
}
|
||||
|
||||
@@ -463,14 +463,14 @@ class ABSL_ATTRIBUTE_VIEW string_view {
|
||||
|
||||
// Overload of `string_view::find()` for finding a substring of a different
|
||||
// C-style string `s` within the `string_view`.
|
||||
size_type find(absl::Nonnull<const char*> s, size_type pos,
|
||||
size_type find(const char* absl_nonnull s, size_type pos,
|
||||
size_type count) const {
|
||||
return find(string_view(s, count), pos);
|
||||
}
|
||||
|
||||
// Overload of `string_view::find()` for finding a different C-style string
|
||||
// `s` within the `string_view`.
|
||||
size_type find(absl::Nonnull<const char *> s, size_type pos = 0) const {
|
||||
size_type find(const char* absl_nonnull s, size_type pos = 0) const {
|
||||
return find(string_view(s), pos);
|
||||
}
|
||||
|
||||
@@ -487,14 +487,14 @@ class ABSL_ATTRIBUTE_VIEW string_view {
|
||||
|
||||
// Overload of `string_view::rfind()` for finding a substring of a different
|
||||
// C-style string `s` within the `string_view`.
|
||||
size_type rfind(absl::Nonnull<const char*> s, size_type pos,
|
||||
size_type rfind(const char* absl_nonnull s, size_type pos,
|
||||
size_type count) const {
|
||||
return rfind(string_view(s, count), pos);
|
||||
}
|
||||
|
||||
// Overload of `string_view::rfind()` for finding a different C-style string
|
||||
// `s` within the `string_view`.
|
||||
size_type rfind(absl::Nonnull<const char*> s, size_type pos = npos) const {
|
||||
size_type rfind(const char* absl_nonnull s, size_type pos = npos) const {
|
||||
return rfind(string_view(s), pos);
|
||||
}
|
||||
|
||||
@@ -513,15 +513,14 @@ class ABSL_ATTRIBUTE_VIEW string_view {
|
||||
|
||||
// Overload of `string_view::find_first_of()` for finding a substring of a
|
||||
// different C-style string `s` within the `string_view`.
|
||||
size_type find_first_of(absl::Nonnull<const char*> s, size_type pos,
|
||||
size_type find_first_of(const char* absl_nonnull s, size_type pos,
|
||||
size_type count) const {
|
||||
return find_first_of(string_view(s, count), pos);
|
||||
}
|
||||
|
||||
// Overload of `string_view::find_first_of()` for finding a different C-style
|
||||
// string `s` within the `string_view`.
|
||||
size_type find_first_of(absl::Nonnull<const char*> s,
|
||||
size_type pos = 0) const {
|
||||
size_type find_first_of(const char* absl_nonnull s, size_type pos = 0) const {
|
||||
return find_first_of(string_view(s), pos);
|
||||
}
|
||||
|
||||
@@ -540,14 +539,14 @@ class ABSL_ATTRIBUTE_VIEW string_view {
|
||||
|
||||
// Overload of `string_view::find_last_of()` for finding a substring of a
|
||||
// different C-style string `s` within the `string_view`.
|
||||
size_type find_last_of(absl::Nonnull<const char*> s, size_type pos,
|
||||
size_type find_last_of(const char* absl_nonnull s, size_type pos,
|
||||
size_type count) const {
|
||||
return find_last_of(string_view(s, count), pos);
|
||||
}
|
||||
|
||||
// Overload of `string_view::find_last_of()` for finding a different C-style
|
||||
// string `s` within the `string_view`.
|
||||
size_type find_last_of(absl::Nonnull<const char*> s,
|
||||
size_type find_last_of(const char* absl_nonnull s,
|
||||
size_type pos = npos) const {
|
||||
return find_last_of(string_view(s), pos);
|
||||
}
|
||||
@@ -565,14 +564,14 @@ class ABSL_ATTRIBUTE_VIEW string_view {
|
||||
|
||||
// Overload of `string_view::find_first_not_of()` for finding a substring of a
|
||||
// different C-style string `s` within the `string_view`.
|
||||
size_type find_first_not_of(absl::Nonnull<const char*> s, size_type pos,
|
||||
size_type find_first_not_of(const char* absl_nonnull s, size_type pos,
|
||||
size_type count) const {
|
||||
return find_first_not_of(string_view(s, count), pos);
|
||||
}
|
||||
|
||||
// Overload of `string_view::find_first_not_of()` for finding a different
|
||||
// C-style string `s` within the `string_view`.
|
||||
size_type find_first_not_of(absl::Nonnull<const char*> s,
|
||||
size_type find_first_not_of(const char* absl_nonnull s,
|
||||
size_type pos = 0) const {
|
||||
return find_first_not_of(string_view(s), pos);
|
||||
}
|
||||
@@ -591,14 +590,14 @@ class ABSL_ATTRIBUTE_VIEW string_view {
|
||||
|
||||
// Overload of `string_view::find_last_not_of()` for finding a substring of a
|
||||
// different C-style string `s` within the `string_view`.
|
||||
size_type find_last_not_of(absl::Nonnull<const char*> s, size_type pos,
|
||||
size_type find_last_not_of(const char* absl_nonnull s, size_type pos,
|
||||
size_type count) const {
|
||||
return find_last_not_of(string_view(s, count), pos);
|
||||
}
|
||||
|
||||
// Overload of `string_view::find_last_not_of()` for finding a different
|
||||
// C-style string `s` within the `string_view`.
|
||||
size_type find_last_not_of(absl::Nonnull<const char*> s,
|
||||
size_type find_last_not_of(const char* absl_nonnull s,
|
||||
size_type pos = npos) const {
|
||||
return find_last_not_of(string_view(s), pos);
|
||||
}
|
||||
@@ -659,7 +658,7 @@ class ABSL_ATTRIBUTE_VIEW string_view {
|
||||
// The constructor from std::string delegates to this constructor.
|
||||
// See the comment on that constructor for the rationale.
|
||||
struct SkipCheckLengthTag {};
|
||||
string_view(absl::Nullable<const char*> data, size_type len,
|
||||
string_view(const char* absl_nullable data, size_type len,
|
||||
SkipCheckLengthTag) noexcept
|
||||
: ptr_(data), length_(len) {}
|
||||
|
||||
@@ -671,7 +670,7 @@ class ABSL_ATTRIBUTE_VIEW string_view {
|
||||
return len;
|
||||
}
|
||||
|
||||
static constexpr size_type StrlenInternal(absl::Nonnull<const char*> str) {
|
||||
static constexpr size_type StrlenInternal(const char* absl_nonnull str) {
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
// MSVC 2017+ can evaluate this at compile-time.
|
||||
const char* begin = str;
|
||||
@@ -696,7 +695,7 @@ class ABSL_ATTRIBUTE_VIEW string_view {
|
||||
: (compare_result < 0 ? -1 : 1);
|
||||
}
|
||||
|
||||
absl::Nullable<const char*> ptr_;
|
||||
const char* absl_nullable ptr_;
|
||||
size_type length_;
|
||||
};
|
||||
|
||||
@@ -757,7 +756,7 @@ inline string_view ClippedSubstr(string_view s, size_t pos,
|
||||
// Creates an `absl::string_view` from a pointer `p` even if it's null-valued.
|
||||
// This function should be used where an `absl::string_view` can be created from
|
||||
// a possibly-null pointer.
|
||||
constexpr string_view NullSafeStringView(absl::Nullable<const char*> p) {
|
||||
constexpr string_view NullSafeStringView(const char* absl_nullable p) {
|
||||
return p ? string_view(p) : string_view();
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ ABSL_NAMESPACE_BEGIN
|
||||
// absl::string_view input("abc");
|
||||
// EXPECT_TRUE(absl::ConsumePrefix(&input, "a"));
|
||||
// EXPECT_EQ(input, "bc");
|
||||
inline constexpr bool ConsumePrefix(absl::Nonnull<absl::string_view*> str,
|
||||
inline constexpr bool ConsumePrefix(absl::string_view* absl_nonnull str,
|
||||
absl::string_view expected) {
|
||||
if (!absl::StartsWith(*str, expected)) return false;
|
||||
str->remove_prefix(expected.size());
|
||||
@@ -62,7 +62,7 @@ inline constexpr bool ConsumePrefix(absl::Nonnull<absl::string_view*> str,
|
||||
// absl::string_view input("abcdef");
|
||||
// EXPECT_TRUE(absl::ConsumeSuffix(&input, "def"));
|
||||
// EXPECT_EQ(input, "abc");
|
||||
inline constexpr bool ConsumeSuffix(absl::Nonnull<absl::string_view*> str,
|
||||
inline constexpr bool ConsumeSuffix(absl::string_view* absl_nonnull str,
|
||||
absl::string_view expected) {
|
||||
if (!absl::EndsWith(*str, expected)) return false;
|
||||
str->remove_suffix(expected.size());
|
||||
|
||||
@@ -35,9 +35,10 @@ namespace absl {
|
||||
ABSL_NAMESPACE_BEGIN
|
||||
namespace substitute_internal {
|
||||
|
||||
void SubstituteAndAppendArray(
|
||||
absl::Nonnull<std::string*> output, absl::string_view format,
|
||||
absl::Nullable<const absl::string_view*> args_array, size_t num_args) {
|
||||
void SubstituteAndAppendArray(std::string* absl_nonnull output,
|
||||
absl::string_view format,
|
||||
const absl::string_view* absl_nullable args_array,
|
||||
size_t num_args) {
|
||||
// Determine total size needed.
|
||||
size_t size = 0;
|
||||
for (size_t i = 0; i < format.size(); i++) {
|
||||
@@ -109,7 +110,7 @@ void SubstituteAndAppendArray(
|
||||
assert(target == output->data() + output->size());
|
||||
}
|
||||
|
||||
Arg::Arg(absl::Nullable<const void*> value) {
|
||||
Arg::Arg(const void* absl_nullable value) {
|
||||
static_assert(sizeof(scratch_) >= sizeof(value) * 2 + 2,
|
||||
"fix sizeof(scratch_)");
|
||||
if (value == nullptr) {
|
||||
|
||||
@@ -106,7 +106,7 @@ class Arg {
|
||||
// Overloads for string-y things
|
||||
//
|
||||
// Explicitly overload `const char*` so the compiler doesn't cast to `bool`.
|
||||
Arg(absl::Nullable<const char*> value) // NOLINT(google-explicit-constructor)
|
||||
Arg(const char* absl_nullable value) // NOLINT(google-explicit-constructor)
|
||||
: piece_(absl::NullSafeStringView(value)) {}
|
||||
template <typename Allocator>
|
||||
Arg( // NOLINT
|
||||
@@ -199,7 +199,7 @@ class Arg {
|
||||
// `void*` values, with the exception of `char*`, are printed as
|
||||
// "0x<hex value>". However, in the case of `nullptr`, "NULL" is printed.
|
||||
Arg( // NOLINT(google-explicit-constructor)
|
||||
absl::Nullable<const void*> value);
|
||||
const void* absl_nullable value);
|
||||
|
||||
// Normal enums are already handled by the integer formatters.
|
||||
// This overload matches only scoped enums.
|
||||
@@ -222,12 +222,13 @@ class Arg {
|
||||
|
||||
// Internal helper function. Don't call this from outside this implementation.
|
||||
// This interface may change without notice.
|
||||
void SubstituteAndAppendArray(
|
||||
absl::Nonnull<std::string*> output, absl::string_view format,
|
||||
absl::Nullable<const absl::string_view*> args_array, size_t num_args);
|
||||
void SubstituteAndAppendArray(std::string* absl_nonnull output,
|
||||
absl::string_view format,
|
||||
const absl::string_view* absl_nullable args_array,
|
||||
size_t num_args);
|
||||
|
||||
#if defined(ABSL_BAD_CALL_IF)
|
||||
constexpr int CalculateOneBit(absl::Nonnull<const char*> format) {
|
||||
constexpr int CalculateOneBit(const char* absl_nonnull format) {
|
||||
// Returns:
|
||||
// * 2^N for '$N' when N is in [0-9]
|
||||
// * 0 for correct '$' escaping: '$$'.
|
||||
@@ -236,11 +237,11 @@ constexpr int CalculateOneBit(absl::Nonnull<const char*> format) {
|
||||
: (1 << (*format - '0'));
|
||||
}
|
||||
|
||||
constexpr const char* SkipNumber(absl::Nonnull<const char*> format) {
|
||||
constexpr const char* SkipNumber(const char* absl_nonnull format) {
|
||||
return !*format ? format : (format + 1);
|
||||
}
|
||||
|
||||
constexpr int PlaceholderBitmask(absl::Nonnull<const char*> format) {
|
||||
constexpr int PlaceholderBitmask(const char* absl_nonnull format) {
|
||||
return !*format
|
||||
? 0
|
||||
: *format != '$' ? PlaceholderBitmask(format + 1)
|
||||
@@ -273,12 +274,12 @@ constexpr int PlaceholderBitmask(absl::Nonnull<const char*> format) {
|
||||
// absl::SubstituteAndAppend(boilerplate, format, args...);
|
||||
// }
|
||||
//
|
||||
inline void SubstituteAndAppend(absl::Nonnull<std::string*> output,
|
||||
inline void SubstituteAndAppend(std::string* absl_nonnull output,
|
||||
absl::string_view format) {
|
||||
substitute_internal::SubstituteAndAppendArray(output, format, nullptr, 0);
|
||||
}
|
||||
|
||||
inline void SubstituteAndAppend(absl::Nonnull<std::string*> output,
|
||||
inline void SubstituteAndAppend(std::string* absl_nonnull output,
|
||||
absl::string_view format,
|
||||
const substitute_internal::Arg& a0) {
|
||||
const absl::string_view args[] = {a0.piece()};
|
||||
@@ -286,7 +287,7 @@ inline void SubstituteAndAppend(absl::Nonnull<std::string*> output,
|
||||
ABSL_ARRAYSIZE(args));
|
||||
}
|
||||
|
||||
inline void SubstituteAndAppend(absl::Nonnull<std::string*> output,
|
||||
inline void SubstituteAndAppend(std::string* absl_nonnull output,
|
||||
absl::string_view format,
|
||||
const substitute_internal::Arg& a0,
|
||||
const substitute_internal::Arg& a1) {
|
||||
@@ -295,7 +296,7 @@ inline void SubstituteAndAppend(absl::Nonnull<std::string*> output,
|
||||
ABSL_ARRAYSIZE(args));
|
||||
}
|
||||
|
||||
inline void SubstituteAndAppend(absl::Nonnull<std::string*> output,
|
||||
inline void SubstituteAndAppend(std::string* absl_nonnull output,
|
||||
absl::string_view format,
|
||||
const substitute_internal::Arg& a0,
|
||||
const substitute_internal::Arg& a1,
|
||||
@@ -305,7 +306,7 @@ inline void SubstituteAndAppend(absl::Nonnull<std::string*> output,
|
||||
ABSL_ARRAYSIZE(args));
|
||||
}
|
||||
|
||||
inline void SubstituteAndAppend(absl::Nonnull<std::string*> output,
|
||||
inline void SubstituteAndAppend(std::string* absl_nonnull output,
|
||||
absl::string_view format,
|
||||
const substitute_internal::Arg& a0,
|
||||
const substitute_internal::Arg& a1,
|
||||
@@ -317,7 +318,7 @@ inline void SubstituteAndAppend(absl::Nonnull<std::string*> output,
|
||||
ABSL_ARRAYSIZE(args));
|
||||
}
|
||||
|
||||
inline void SubstituteAndAppend(absl::Nonnull<std::string*> output,
|
||||
inline void SubstituteAndAppend(std::string* absl_nonnull output,
|
||||
absl::string_view format,
|
||||
const substitute_internal::Arg& a0,
|
||||
const substitute_internal::Arg& a1,
|
||||
@@ -331,7 +332,7 @@ inline void SubstituteAndAppend(absl::Nonnull<std::string*> output,
|
||||
}
|
||||
|
||||
inline void SubstituteAndAppend(
|
||||
absl::Nonnull<std::string*> output, absl::string_view format,
|
||||
std::string* absl_nonnull output, absl::string_view format,
|
||||
const substitute_internal::Arg& a0, const substitute_internal::Arg& a1,
|
||||
const substitute_internal::Arg& a2, const substitute_internal::Arg& a3,
|
||||
const substitute_internal::Arg& a4, const substitute_internal::Arg& a5) {
|
||||
@@ -342,7 +343,7 @@ inline void SubstituteAndAppend(
|
||||
}
|
||||
|
||||
inline void SubstituteAndAppend(
|
||||
absl::Nonnull<std::string*> output, absl::string_view format,
|
||||
std::string* absl_nonnull output, absl::string_view format,
|
||||
const substitute_internal::Arg& a0, const substitute_internal::Arg& a1,
|
||||
const substitute_internal::Arg& a2, const substitute_internal::Arg& a3,
|
||||
const substitute_internal::Arg& a4, const substitute_internal::Arg& a5,
|
||||
@@ -355,7 +356,7 @@ inline void SubstituteAndAppend(
|
||||
}
|
||||
|
||||
inline void SubstituteAndAppend(
|
||||
absl::Nonnull<std::string*> output, absl::string_view format,
|
||||
std::string* absl_nonnull output, absl::string_view format,
|
||||
const substitute_internal::Arg& a0, const substitute_internal::Arg& a1,
|
||||
const substitute_internal::Arg& a2, const substitute_internal::Arg& a3,
|
||||
const substitute_internal::Arg& a4, const substitute_internal::Arg& a5,
|
||||
@@ -368,7 +369,7 @@ inline void SubstituteAndAppend(
|
||||
}
|
||||
|
||||
inline void SubstituteAndAppend(
|
||||
absl::Nonnull<std::string*> output, absl::string_view format,
|
||||
std::string* absl_nonnull output, absl::string_view format,
|
||||
const substitute_internal::Arg& a0, const substitute_internal::Arg& a1,
|
||||
const substitute_internal::Arg& a2, const substitute_internal::Arg& a3,
|
||||
const substitute_internal::Arg& a4, const substitute_internal::Arg& a5,
|
||||
@@ -382,7 +383,7 @@ inline void SubstituteAndAppend(
|
||||
}
|
||||
|
||||
inline void SubstituteAndAppend(
|
||||
absl::Nonnull<std::string*> output, absl::string_view format,
|
||||
std::string* absl_nonnull output, absl::string_view format,
|
||||
const substitute_internal::Arg& a0, const substitute_internal::Arg& a1,
|
||||
const substitute_internal::Arg& a2, const substitute_internal::Arg& a3,
|
||||
const substitute_internal::Arg& a4, const substitute_internal::Arg& a5,
|
||||
@@ -398,16 +399,16 @@ inline void SubstituteAndAppend(
|
||||
#if defined(ABSL_BAD_CALL_IF)
|
||||
// This body of functions catches cases where the number of placeholders
|
||||
// doesn't match the number of data arguments.
|
||||
void SubstituteAndAppend(absl::Nonnull<std::string*> output,
|
||||
absl::Nonnull<const char*> format)
|
||||
void SubstituteAndAppend(std::string* absl_nonnull output,
|
||||
const char* absl_nonnull format)
|
||||
ABSL_BAD_CALL_IF(
|
||||
substitute_internal::PlaceholderBitmask(format) != 0,
|
||||
"There were no substitution arguments "
|
||||
"but this format string either has a $[0-9] in it or contains "
|
||||
"an unescaped $ character (use $$ instead)");
|
||||
|
||||
void SubstituteAndAppend(absl::Nonnull<std::string*> output,
|
||||
absl::Nonnull<const char*> format,
|
||||
void SubstituteAndAppend(std::string* absl_nonnull output,
|
||||
const char* absl_nonnull format,
|
||||
const substitute_internal::Arg& a0)
|
||||
ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 1,
|
||||
"There was 1 substitution argument given, but "
|
||||
@@ -415,8 +416,8 @@ void SubstituteAndAppend(absl::Nonnull<std::string*> output,
|
||||
"one of $1-$9, or contains an unescaped $ character (use "
|
||||
"$$ instead)");
|
||||
|
||||
void SubstituteAndAppend(absl::Nonnull<std::string*> output,
|
||||
absl::Nonnull<const char*> format,
|
||||
void SubstituteAndAppend(std::string* absl_nonnull output,
|
||||
const char* absl_nonnull format,
|
||||
const substitute_internal::Arg& a0,
|
||||
const substitute_internal::Arg& a1)
|
||||
ABSL_BAD_CALL_IF(
|
||||
@@ -425,8 +426,8 @@ void SubstituteAndAppend(absl::Nonnull<std::string*> output,
|
||||
"missing its $0/$1, contains one of $2-$9, or contains an "
|
||||
"unescaped $ character (use $$ instead)");
|
||||
|
||||
void SubstituteAndAppend(absl::Nonnull<std::string*> output,
|
||||
absl::Nonnull<const char*> format,
|
||||
void SubstituteAndAppend(std::string* absl_nonnull output,
|
||||
const char* absl_nonnull format,
|
||||
const substitute_internal::Arg& a0,
|
||||
const substitute_internal::Arg& a1,
|
||||
const substitute_internal::Arg& a2)
|
||||
@@ -436,8 +437,8 @@ void SubstituteAndAppend(absl::Nonnull<std::string*> output,
|
||||
"this format string is missing its $0/$1/$2, contains one of "
|
||||
"$3-$9, or contains an unescaped $ character (use $$ instead)");
|
||||
|
||||
void SubstituteAndAppend(absl::Nonnull<std::string*> output,
|
||||
absl::Nonnull<const char*> format,
|
||||
void SubstituteAndAppend(std::string* absl_nonnull output,
|
||||
const char* absl_nonnull format,
|
||||
const substitute_internal::Arg& a0,
|
||||
const substitute_internal::Arg& a1,
|
||||
const substitute_internal::Arg& a2,
|
||||
@@ -448,8 +449,8 @@ void SubstituteAndAppend(absl::Nonnull<std::string*> output,
|
||||
"this format string is missing its $0-$3, contains one of "
|
||||
"$4-$9, or contains an unescaped $ character (use $$ instead)");
|
||||
|
||||
void SubstituteAndAppend(absl::Nonnull<std::string*> output,
|
||||
absl::Nonnull<const char*> format,
|
||||
void SubstituteAndAppend(std::string* absl_nonnull output,
|
||||
const char* absl_nonnull format,
|
||||
const substitute_internal::Arg& a0,
|
||||
const substitute_internal::Arg& a1,
|
||||
const substitute_internal::Arg& a2,
|
||||
@@ -462,7 +463,7 @@ void SubstituteAndAppend(absl::Nonnull<std::string*> output,
|
||||
"$5-$9, or contains an unescaped $ character (use $$ instead)");
|
||||
|
||||
void SubstituteAndAppend(
|
||||
absl::Nonnull<std::string*> output, absl::Nonnull<const char*> format,
|
||||
std::string* absl_nonnull output, const char* absl_nonnull format,
|
||||
const substitute_internal::Arg& a0, const substitute_internal::Arg& a1,
|
||||
const substitute_internal::Arg& a2, const substitute_internal::Arg& a3,
|
||||
const substitute_internal::Arg& a4, const substitute_internal::Arg& a5)
|
||||
@@ -473,7 +474,7 @@ void SubstituteAndAppend(
|
||||
"$6-$9, or contains an unescaped $ character (use $$ instead)");
|
||||
|
||||
void SubstituteAndAppend(
|
||||
absl::Nonnull<std::string*> output, absl::Nonnull<const char*> format,
|
||||
std::string* absl_nonnull output, const char* absl_nonnull format,
|
||||
const substitute_internal::Arg& a0, const substitute_internal::Arg& a1,
|
||||
const substitute_internal::Arg& a2, const substitute_internal::Arg& a3,
|
||||
const substitute_internal::Arg& a4, const substitute_internal::Arg& a5,
|
||||
@@ -485,7 +486,7 @@ void SubstituteAndAppend(
|
||||
"$7-$9, or contains an unescaped $ character (use $$ instead)");
|
||||
|
||||
void SubstituteAndAppend(
|
||||
absl::Nonnull<std::string*> output, absl::Nonnull<const char*> format,
|
||||
std::string* absl_nonnull output, const char* absl_nonnull format,
|
||||
const substitute_internal::Arg& a0, const substitute_internal::Arg& a1,
|
||||
const substitute_internal::Arg& a2, const substitute_internal::Arg& a3,
|
||||
const substitute_internal::Arg& a4, const substitute_internal::Arg& a5,
|
||||
@@ -497,7 +498,7 @@ void SubstituteAndAppend(
|
||||
"$8-$9, or contains an unescaped $ character (use $$ instead)");
|
||||
|
||||
void SubstituteAndAppend(
|
||||
absl::Nonnull<std::string*> output, absl::Nonnull<const char*> format,
|
||||
std::string* absl_nonnull output, const char* absl_nonnull format,
|
||||
const substitute_internal::Arg& a0, const substitute_internal::Arg& a1,
|
||||
const substitute_internal::Arg& a2, const substitute_internal::Arg& a3,
|
||||
const substitute_internal::Arg& a4, const substitute_internal::Arg& a5,
|
||||
@@ -510,7 +511,7 @@ void SubstituteAndAppend(
|
||||
"contains an unescaped $ character (use $$ instead)");
|
||||
|
||||
void SubstituteAndAppend(
|
||||
absl::Nonnull<std::string*> output, absl::Nonnull<const char*> format,
|
||||
std::string* absl_nonnull output, const char* absl_nonnull format,
|
||||
const substitute_internal::Arg& a0, const substitute_internal::Arg& a1,
|
||||
const substitute_internal::Arg& a2, const substitute_internal::Arg& a3,
|
||||
const substitute_internal::Arg& a4, const substitute_internal::Arg& a5,
|
||||
@@ -643,13 +644,13 @@ void SubstituteAndAppend(
|
||||
#if defined(ABSL_BAD_CALL_IF)
|
||||
// This body of functions catches cases where the number of placeholders
|
||||
// doesn't match the number of data arguments.
|
||||
std::string Substitute(absl::Nonnull<const char*> format)
|
||||
std::string Substitute(const char* absl_nonnull format)
|
||||
ABSL_BAD_CALL_IF(substitute_internal::PlaceholderBitmask(format) != 0,
|
||||
"There were no substitution arguments "
|
||||
"but this format string either has a $[0-9] in it or "
|
||||
"contains an unescaped $ character (use $$ instead)");
|
||||
|
||||
std::string Substitute(absl::Nonnull<const char*> format,
|
||||
std::string Substitute(const char* absl_nonnull format,
|
||||
const substitute_internal::Arg& a0)
|
||||
ABSL_BAD_CALL_IF(
|
||||
substitute_internal::PlaceholderBitmask(format) != 1,
|
||||
@@ -657,7 +658,7 @@ std::string Substitute(absl::Nonnull<const char*> format,
|
||||
"this format string is missing its $0, contains one of $1-$9, "
|
||||
"or contains an unescaped $ character (use $$ instead)");
|
||||
|
||||
std::string Substitute(absl::Nonnull<const char*> format,
|
||||
std::string Substitute(const char* absl_nonnull format,
|
||||
const substitute_internal::Arg& a0,
|
||||
const substitute_internal::Arg& a1)
|
||||
ABSL_BAD_CALL_IF(
|
||||
@@ -666,7 +667,7 @@ std::string Substitute(absl::Nonnull<const char*> format,
|
||||
"this format string is missing its $0/$1, contains one of "
|
||||
"$2-$9, or contains an unescaped $ character (use $$ instead)");
|
||||
|
||||
std::string Substitute(absl::Nonnull<const char*> format,
|
||||
std::string Substitute(const char* absl_nonnull format,
|
||||
const substitute_internal::Arg& a0,
|
||||
const substitute_internal::Arg& a1,
|
||||
const substitute_internal::Arg& a2)
|
||||
@@ -676,7 +677,7 @@ std::string Substitute(absl::Nonnull<const char*> format,
|
||||
"this format string is missing its $0/$1/$2, contains one of "
|
||||
"$3-$9, or contains an unescaped $ character (use $$ instead)");
|
||||
|
||||
std::string Substitute(absl::Nonnull<const char*> format,
|
||||
std::string Substitute(const char* absl_nonnull format,
|
||||
const substitute_internal::Arg& a0,
|
||||
const substitute_internal::Arg& a1,
|
||||
const substitute_internal::Arg& a2,
|
||||
@@ -687,7 +688,7 @@ std::string Substitute(absl::Nonnull<const char*> format,
|
||||
"this format string is missing its $0-$3, contains one of "
|
||||
"$4-$9, or contains an unescaped $ character (use $$ instead)");
|
||||
|
||||
std::string Substitute(absl::Nonnull<const char*> format,
|
||||
std::string Substitute(const char* absl_nonnull format,
|
||||
const substitute_internal::Arg& a0,
|
||||
const substitute_internal::Arg& a1,
|
||||
const substitute_internal::Arg& a2,
|
||||
@@ -699,7 +700,7 @@ std::string Substitute(absl::Nonnull<const char*> format,
|
||||
"this format string is missing its $0-$4, contains one of "
|
||||
"$5-$9, or contains an unescaped $ character (use $$ instead)");
|
||||
|
||||
std::string Substitute(absl::Nonnull<const char*> format,
|
||||
std::string Substitute(const char* absl_nonnull format,
|
||||
const substitute_internal::Arg& a0,
|
||||
const substitute_internal::Arg& a1,
|
||||
const substitute_internal::Arg& a2,
|
||||
@@ -713,7 +714,7 @@ std::string Substitute(absl::Nonnull<const char*> format,
|
||||
"$6-$9, or contains an unescaped $ character (use $$ instead)");
|
||||
|
||||
std::string Substitute(
|
||||
absl::Nonnull<const char*> format, const substitute_internal::Arg& a0,
|
||||
const char* absl_nonnull format, const substitute_internal::Arg& a0,
|
||||
const substitute_internal::Arg& a1, const substitute_internal::Arg& a2,
|
||||
const substitute_internal::Arg& a3, const substitute_internal::Arg& a4,
|
||||
const substitute_internal::Arg& a5, const substitute_internal::Arg& a6)
|
||||
@@ -724,7 +725,7 @@ std::string Substitute(
|
||||
"$7-$9, or contains an unescaped $ character (use $$ instead)");
|
||||
|
||||
std::string Substitute(
|
||||
absl::Nonnull<const char*> format, const substitute_internal::Arg& a0,
|
||||
const char* absl_nonnull format, const substitute_internal::Arg& a0,
|
||||
const substitute_internal::Arg& a1, const substitute_internal::Arg& a2,
|
||||
const substitute_internal::Arg& a3, const substitute_internal::Arg& a4,
|
||||
const substitute_internal::Arg& a5, const substitute_internal::Arg& a6,
|
||||
@@ -736,7 +737,7 @@ std::string Substitute(
|
||||
"$8-$9, or contains an unescaped $ character (use $$ instead)");
|
||||
|
||||
std::string Substitute(
|
||||
absl::Nonnull<const char*> format, const substitute_internal::Arg& a0,
|
||||
const char* absl_nonnull format, const substitute_internal::Arg& a0,
|
||||
const substitute_internal::Arg& a1, const substitute_internal::Arg& a2,
|
||||
const substitute_internal::Arg& a3, const substitute_internal::Arg& a4,
|
||||
const substitute_internal::Arg& a5, const substitute_internal::Arg& a6,
|
||||
@@ -748,7 +749,7 @@ std::string Substitute(
|
||||
"contains an unescaped $ character (use $$ instead)");
|
||||
|
||||
std::string Substitute(
|
||||
absl::Nonnull<const char*> format, const substitute_internal::Arg& a0,
|
||||
const char* absl_nonnull format, const substitute_internal::Arg& a0,
|
||||
const substitute_internal::Arg& a1, const substitute_internal::Arg& a2,
|
||||
const substitute_internal::Arg& a3, const substitute_internal::Arg& a4,
|
||||
const substitute_internal::Arg& a5, const substitute_internal::Arg& a6,
|
||||
|
||||
@@ -724,12 +724,12 @@ ABSL_INTERNAL_CONSTEXPR_SINCE_CXX20 bool operator>=(Span<T> a, const U& b) {
|
||||
// }
|
||||
//
|
||||
template <int&... ExplicitArgumentBarrier, typename T>
|
||||
constexpr Span<T> MakeSpan(absl::Nullable<T*> ptr, size_t size) noexcept {
|
||||
constexpr Span<T> MakeSpan(T* absl_nullable ptr, size_t size) noexcept {
|
||||
return Span<T>(ptr, size);
|
||||
}
|
||||
|
||||
template <int&... ExplicitArgumentBarrier, typename T>
|
||||
Span<T> MakeSpan(absl::Nullable<T*> begin, absl::Nullable<T*> end) noexcept {
|
||||
Span<T> MakeSpan(T* absl_nullable begin, T* absl_nullable end) noexcept {
|
||||
ABSL_HARDENING_ASSERT(begin <= end);
|
||||
return Span<T>(begin, static_cast<size_t>(end - begin));
|
||||
}
|
||||
@@ -770,14 +770,14 @@ constexpr Span<T> MakeSpan(T (&array)[N]) noexcept {
|
||||
// ProcessInts(absl::MakeConstSpan(std::vector<int>{ 0, 0, 0 }));
|
||||
//
|
||||
template <int&... ExplicitArgumentBarrier, typename T>
|
||||
constexpr Span<const T> MakeConstSpan(absl::Nullable<T*> ptr,
|
||||
constexpr Span<const T> MakeConstSpan(T* absl_nullable ptr,
|
||||
size_t size) noexcept {
|
||||
return Span<const T>(ptr, size);
|
||||
}
|
||||
|
||||
template <int&... ExplicitArgumentBarrier, typename T>
|
||||
Span<const T> MakeConstSpan(absl::Nullable<T*> begin,
|
||||
absl::Nullable<T*> end) noexcept {
|
||||
Span<const T> MakeConstSpan(T* absl_nullable begin,
|
||||
T* absl_nullable end) noexcept {
|
||||
ABSL_HARDENING_ASSERT(begin <= end);
|
||||
return Span<const T>(begin, end - begin);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user