Remove custom HasPreservingUnknownEnumSemantics method.

C++ descriptor now provides is_closed() on EnumDescriptor, use that instead.

PiperOrigin-RevId: 485307512
pull/10861/head
Protobuf Team Bot 2 years ago committed by Copybara-Service
parent 1c46a3374b
commit 72b22edea2
  1. 2
      src/google/protobuf/compiler/objectivec/enum.cc
  2. 6
      src/google/protobuf/compiler/objectivec/enum_field.cc
  3. 4
      src/google/protobuf/compiler/objectivec/helpers.h

@ -126,7 +126,7 @@ void EnumGenerator::GenerateHeader(io::Printer* printer) {
name_);
printer->Indent();
if (HasPreservingUnknownEnumSemantics(descriptor_->file())) {
if (!descriptor_->is_closed()) {
// Include the unknown value.
printer->Print(
// clang-format off

@ -76,7 +76,7 @@ EnumFieldGenerator::EnumFieldGenerator(const FieldDescriptor* descriptor)
void EnumFieldGenerator::GenerateCFunctionDeclarations(
io::Printer* printer) const {
if (!HasPreservingUnknownEnumSemantics(descriptor_->file())) {
if (descriptor_->enum_type()->is_closed()) {
return;
}
@ -100,7 +100,9 @@ void EnumFieldGenerator::GenerateCFunctionDeclarations(
void EnumFieldGenerator::GenerateCFunctionImplementations(
io::Printer* printer) const {
if (!HasPreservingUnknownEnumSemantics(descriptor_->file())) return;
if (descriptor_->enum_type()->is_closed()) {
return;
}
// clang-format off
printer->Print(

@ -44,10 +44,6 @@ namespace protobuf {
namespace compiler {
namespace objectivec {
inline bool HasPreservingUnknownEnumSemantics(const FileDescriptor* file) {
return file->syntax() == FileDescriptor::SYNTAX_PROTO3;
}
// Escape C++ trigraphs by escaping question marks to "\?".
std::string EscapeTrigraphs(absl::string_view to_escape);

Loading…
Cancel
Save