From c01c2e3859b7bb2ba12f2e91c7e9fbf083b27389 Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Fri, 12 May 2023 16:25:08 -0700 Subject: [PATCH] Internal changes PiperOrigin-RevId: 531631350 --- src/google/protobuf/descriptor.cc | 9 ++++++--- src/google/protobuf/descriptor.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc index 8e0b163078..b260a77fa3 100644 --- a/src/google/protobuf/descriptor.cc +++ b/src/google/protobuf/descriptor.cc @@ -6183,9 +6183,12 @@ void DescriptorBuilder::BuildOneof(const OneofDescriptorProto& proto, result->fields_ = nullptr; // Copy options. - result->options_ = - AllocateOptions(proto, result, OneofDescriptorProto::kOptionsFieldNumber, - "google.protobuf.OneofOptions", alloc); + { + OneofOptions* options = AllocateOptions( + proto, result, OneofDescriptorProto::kOptionsFieldNumber, + "google.protobuf.OneofOptions", alloc); + result->options_ = options; // Set to default_instance later if necessary. + } AddSymbol(result->full_name(), parent, result->name(), proto, Symbol(result)); } diff --git a/src/google/protobuf/descriptor.h b/src/google/protobuf/descriptor.h index 95204c7c09..42d8ab34b1 100644 --- a/src/google/protobuf/descriptor.h +++ b/src/google/protobuf/descriptor.h @@ -1109,6 +1109,7 @@ class PROTOBUF_EXPORT OneofDescriptor : private internal::SymbolBase { const OneofOptions& options() const; + // See Descriptor::CopyTo(). void CopyTo(OneofDescriptorProto* proto) const;