Automated rollback of commit 9a3c096b0c.

PiperOrigin-RevId: 687291129
pull/18895/head
Protobuf Team Bot 1 month ago committed by Copybara-Service
parent 79e6042935
commit 007c93fa9c
  1. 4
      hpb/extension.h
  2. 6
      hpb/internal/internal.h
  3. 9
      hpb_generator/gen_extensions.cc

@ -61,14 +61,14 @@ class ExtensionIdentifier : public ExtensionMiniTableProvider {
using Extension = ExtensionType;
using Extendee = ExtendeeType;
private:
constexpr explicit ExtensionIdentifier(
const upb_MiniTableExtension* mini_table_ext)
: ExtensionMiniTableProvider(mini_table_ext) {}
private:
constexpr uint32_t number() const {
return upb_MiniTableExtension_Number(mini_table_ext());
}
friend struct PrivateAccess;
};

@ -9,7 +9,6 @@
#define GOOGLE_PROTOBUF_HPB_INTERNAL_INTERNAL_H__
#include <cstdint>
#include <utility>
#include "upb/mem/arena.h"
#include "upb/message/message.h"
@ -38,11 +37,6 @@ struct PrivateAccess {
return typename T::Proxy(upb_Message_New(T::minitable(), arena), arena);
}
template <typename T, typename... Args>
static auto InvokeConstructor(Args&&... args) {
return T(std::forward<Args>(args)...);
}
template <typename ExtensionId>
static constexpr uint32_t GetExtensionNumber(const ExtensionId& id) {
return id.number();

@ -9,6 +9,7 @@
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/hpb/context.h"
#include "google/protobuf/compiler/hpb/gen_utils.h"
#include "google/protobuf/compiler/hpb/names.h"
#include "upb_generator/c/names.h"
@ -68,18 +69,14 @@ void WriteExtensionIdentifier(const protobuf::FieldDescriptor* ext,
if (ext->extension_scope()) {
ctx.EmitLegacy(
R"cc(
const hpb::internal::ExtensionIdentifier<$0, $3> $4::$2 =
hpb::internal::PrivateAccess::InvokeConstructor<
hpb::internal::ExtensionIdentifier<$0, $3>>(&$1);
const hpb::internal::ExtensionIdentifier<$0, $3> $4::$2(&$1);
)cc",
ContainingTypeName(ext), mini_table_name, ext->name(),
CppTypeParameterName(ext), ClassName(ext->extension_scope()));
} else {
ctx.EmitLegacy(
R"cc(
const hpb::internal::ExtensionIdentifier<$0, $3> $2 =
hpb::internal::PrivateAccess::InvokeConstructor<
hpb::internal::ExtensionIdentifier<$0, $3>>(&$1);
const hpb::internal::ExtensionIdentifier<$0, $3> $2(&$1);
)cc",
ContainingTypeName(ext), mini_table_name, ext->name(),
CppTypeParameterName(ext));

Loading…
Cancel
Save