@@ -210,6 +210,43 @@ FileDescriptorProto StripSourceRetentionOptions(const FileDescriptor& file,
210
210
return file_proto;
211
211
}
212
212
213
+ DescriptorProto StripSourceRetentionOptions (const Descriptor& message) {
214
+ DescriptorProto message_proto;
215
+ message.CopyTo (&message_proto);
216
+ ConvertToDynamicMessageAndStripOptions (message_proto,
217
+ *message.file ()->pool ());
218
+ return message_proto;
219
+ }
220
+
221
+ DescriptorProto::ExtensionRange StripSourceRetentionOptions (
222
+ const Descriptor& message, const Descriptor::ExtensionRange& range) {
223
+ DescriptorProto::ExtensionRange range_proto;
224
+ range.CopyTo (&range_proto);
225
+ ConvertToDynamicMessageAndStripOptions (range_proto, *message.file ()->pool ());
226
+ return range_proto;
227
+ }
228
+
229
+ EnumDescriptorProto StripSourceRetentionOptions (const EnumDescriptor& enm) {
230
+ EnumDescriptorProto enm_proto;
231
+ enm.CopyTo (&enm_proto);
232
+ ConvertToDynamicMessageAndStripOptions (enm_proto, *enm.file ()->pool ());
233
+ return enm_proto;
234
+ }
235
+
236
+ FieldDescriptorProto StripSourceRetentionOptions (const FieldDescriptor& field) {
237
+ FieldDescriptorProto field_proto;
238
+ field.CopyTo (&field_proto);
239
+ ConvertToDynamicMessageAndStripOptions (field_proto, *field.file ()->pool ());
240
+ return field_proto;
241
+ }
242
+
243
+ OneofDescriptorProto StripSourceRetentionOptions (const OneofDescriptor& oneof) {
244
+ OneofDescriptorProto oneof_proto;
245
+ oneof.CopyTo (&oneof_proto);
246
+ ConvertToDynamicMessageAndStripOptions (oneof_proto, *oneof.file ()->pool ());
247
+ return oneof_proto;
248
+ }
249
+
213
250
EnumOptions StripLocalSourceRetentionOptions (const EnumDescriptor& descriptor) {
214
251
return StripLocalOptions (descriptor);
215
252
}
@@ -232,6 +269,14 @@ MessageOptions StripLocalSourceRetentionOptions(const Descriptor& descriptor) {
232
269
return StripLocalOptions (descriptor);
233
270
}
234
271
272
+ ExtensionRangeOptions StripLocalSourceRetentionOptions (
273
+ const Descriptor& descriptor, const Descriptor::ExtensionRange& range) {
274
+ if (range.options_ == nullptr ) return ExtensionRangeOptions{};
275
+ ExtensionRangeOptions options = *range.options_ ;
276
+ ConvertToDynamicMessageAndStripOptions (options, GetPool (descriptor));
277
+ return options;
278
+ }
279
+
235
280
MethodOptions StripLocalSourceRetentionOptions (
236
281
const MethodDescriptor& descriptor) {
237
282
return StripLocalOptions (descriptor);
0 commit comments