From bc9da2b17705276bf0f14699ba754d92add58bac Mon Sep 17 00:00:00 2001 From: Hong Shin Date: Tue, 10 Dec 2024 09:29:21 -0800 Subject: [PATCH] hpb: Disambiguate betwixt mutable and agnostic PtrOrRaw (mutable or const) PiperOrigin-RevId: 704738982 --- hpb/backend/upb/upb.h | 3 +-- hpb/hpb.h | 2 +- hpb/internal/template_help.h | 3 +++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hpb/backend/upb/upb.h b/hpb/backend/upb/upb.h index 3e35f0dd2b..95ae7c2056 100644 --- a/hpb/backend/upb/upb.h +++ b/hpb/backend/upb/upb.h @@ -9,14 +9,13 @@ #define GOOGLE_PROTOBUF_HPB_BACKEND_UPB_UPB_H__ #include "google/protobuf/hpb/backend/upb/interop.h" -#include "google/protobuf/hpb/internal/internal.h" #include "google/protobuf/hpb/internal/template_help.h" #include "google/protobuf/hpb/ptr.h" namespace hpb::internal::backend::upb { template -void ClearMessage(hpb::internal::PtrOrRaw message) { +void ClearMessage(hpb::internal::PtrOrRawMutable message) { auto ptr = Ptr(message); auto minitable = hpb::interop::upb::GetMiniTable(ptr); upb_Message_Clear(hpb::interop::upb::GetMessage(ptr), minitable); diff --git a/hpb/hpb.h b/hpb/hpb.h index 0703a4c968..f3807a197f 100644 --- a/hpb/hpb.h +++ b/hpb/hpb.h @@ -79,7 +79,7 @@ void DeepCopy(const T* source_message, T* target_message) { } template -void ClearMessage(hpb::internal::PtrOrRaw message) { +void ClearMessage(hpb::internal::PtrOrRawMutable message) { backend::ClearMessage(message); } diff --git a/hpb/internal/template_help.h b/hpb/internal/template_help.h index a67c5f27f6..f6f8757692 100644 --- a/hpb/internal/template_help.h +++ b/hpb/internal/template_help.h @@ -33,6 +33,9 @@ using RemovePtrT = typename RemovePtr::type; template , typename = std::enable_if_t>> +using PtrOrRawMutable = T; + +template > using PtrOrRaw = T; template