Introduce CreateMessage w/ default-init msg inside hpb::interop::upb

PiperOrigin-RevId: 676071677
pull/18361/head
Hong Shin 5 months ago committed by Copybara-Service
parent a037f28ff8
commit aa5818d2aa
  1. 12
      hpb/backend/upb/interop.h

@ -95,6 +95,18 @@ typename T::Proxy MakeHandle(upb_Message* msg, upb_Arena* arena) {
return typename T::Proxy(msg, arena);
}
/**
* Creates a message in the given arena and returns a handle to it.
*
* The supplied arena must outlive the hpb handle.
* All messages reachable from from the upb message must
* outlive the hpb handle.
*/
template <typename T>
typename T::Proxy CreateMessage(upb_Arena* arena) {
return hpb::internal::PrivateAccess::CreateMessage<T>(arena);
}
inline absl::string_view FromUpbStringView(upb_StringView str) {
return absl::string_view(str.data, str.size);
}

Loading…
Cancel
Save