From b8e7192a731a8ece54b11f2caf87c32209559525 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Fri, 14 Apr 2023 14:14:35 -0700 Subject: [PATCH] Update usage disclaimer on FieldOptions.ctype FieldOptions.ctype is public and CORD support is implemented for [ctype=CORD] on "bytes" fields. Include a public comment for CORD about use and supported types. PiperOrigin-RevId: 524383969 --- src/google/protobuf/descriptor.proto | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/google/protobuf/descriptor.proto b/src/google/protobuf/descriptor.proto index 094cce443fb6..fb97bacfd796 100644 --- a/src/google/protobuf/descriptor.proto +++ b/src/google/protobuf/descriptor.proto @@ -569,13 +569,21 @@ message MessageOptions { message FieldOptions { // The ctype option instructs the C++ code generator to use a different // representation of the field than it normally would. See the specific - // options below. This option is not yet implemented in the open source - // release -- sorry, we'll try to include it in a future version! + // options below. This option is only implemented to support use of + // [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + // type "bytes" in the open source release -- sorry, we'll try to include + // other types in a future version! optional CType ctype = 1 [default = STRING]; enum CType { // Default mode. STRING = 0; + // The option [ctype=CORD] may be applied to a non-repeated field of type + // "bytes". It indicates that in C++, the data should be stored in a Cord + // instead of a string. For very large strings, this may reduce memory + // fragmentation. It may also allow better performance when parsing from a + // Cord, or when parsing with aliasing enabled, as the parsed Cord may then + // alias the original buffer. CORD = 1; STRING_PIECE = 2;