Remove Arena::CreateMessage.

It has equivalent performance to Arena::Create.

PiperOrigin-RevId: 660086722
pull/17737/head
Chris Kennelly 4 months ago committed by Copybara-Service
parent 090edb7a77
commit c7a723bbb5
  1. 5
      src/google/protobuf/arena.h
  2. 4
      src/google/protobuf/port_def.inc
  3. 1
      src/google/protobuf/port_undef.inc

@ -176,8 +176,8 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
inline ~Arena() = default; inline ~Arena() = default;
// Deprecated. Use Create<T> instead. TODO: depreate OSS version #ifndef PROTOBUF_FUTURE_REMOVE_CREATEMESSAGE
// once internal migration to Arena::Create is done. // Deprecated. Use Create<T> instead.
template <typename T, typename... Args> template <typename T, typename... Args>
ABSL_DEPRECATED("Use Create") ABSL_DEPRECATED("Use Create")
static T* CreateMessage(Arena* arena, Args&&... args) { static T* CreateMessage(Arena* arena, Args&&... args) {
@ -187,6 +187,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final {
"CreateMessage can only construct types that are ArenaConstructable"); "CreateMessage can only construct types that are ArenaConstructable");
return Create<Type>(arena, std::forward<Args>(args)...); return Create<Type>(arena, std::forward<Args>(args)...);
} }
#endif // !PROTOBUF_FUTURE_REMOVE_CREATEMESSAGE
// Allocates an object type T if the arena passed in is not nullptr; // Allocates an object type T if the arena passed in is not nullptr;
// otherwise, returns a heap-allocated object. // otherwise, returns a heap-allocated object.

@ -143,6 +143,10 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3),
// Owner: shaod@, gberg@ // Owner: shaod@, gberg@
#define PROTOBUF_FUTURE_DESCRIPTOR_EXTENSION_DECL 1 #define PROTOBUF_FUTURE_DESCRIPTOR_EXTENSION_DECL 1
// Removes Arena::CreateMessage, as Arena::Create is equivalent
// Owner: ckennelly@, mkruskal@
#define PROTOBUF_FUTURE_REMOVE_CREATEMESSAGE 1
#endif #endif
#ifdef PROTOBUF_FUTURE_STRING_VIEW_RETURN_TYPE #ifdef PROTOBUF_FUTURE_STRING_VIEW_RETURN_TYPE

@ -84,6 +84,7 @@
#undef PROTOBUF_FUTURE_BREAKING_CHANGES #undef PROTOBUF_FUTURE_BREAKING_CHANGES
#undef PROTOBUF_FUTURE_DESCRIPTOR_EXTENSION_DECL #undef PROTOBUF_FUTURE_DESCRIPTOR_EXTENSION_DECL
#undef PROTOBUF_FUTURE_STRING_VIEW_RETURN_TYPE #undef PROTOBUF_FUTURE_STRING_VIEW_RETURN_TYPE
#undef PROTOBUF_FUTURE_REMOVE_CREATEMESSAGE
#endif #endif
// Restore macros that may have been #undef'd in port_def.inc. // Restore macros that may have been #undef'd in port_def.inc.

Loading…
Cancel
Save