summaryrefslogtreecommitdiffstats
path: root/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_helpers.cc
diff options
context:
space:
mode:
authormikhnenko <[email protected]>2024-06-25 08:50:35 +0300
committermikhnenko <[email protected]>2024-06-25 09:00:27 +0300
commit509c9fc9e7b9c3b8be7307d72a4c966e5f9aa194 (patch)
tree4b8a6a44009906ac852e59efa0bc78bb12043a5b /contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_helpers.cc
parent7688f2313619a39a60ef3c2734d8efbc49a0a6db (diff)
Update protobuf to 3.20.2 and pyprotobuf to 3.20.3
Если это pull-request что-то сломал, то: - если это тест с канонизацией и еще нет pr с переканонизацией, то переканонизируйте пожалуйста сами - проверьте, что тест не флапает - приходите в [DEVTOOLSSUPPORT](https://st.yandex-team.ru/createTicket?queue=DEVTOOLSSUPPORT) - там вам обязательно помогут 987be5ed151f827f7f292f32420470b04b71a91d
Diffstat (limited to 'contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_helpers.cc')
-rw-r--r--contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_helpers.cc32
1 files changed, 26 insertions, 6 deletions
diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_helpers.cc b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_helpers.cc
index 5191a7e7309..f726d0fc9b5 100644
--- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_helpers.cc
+++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_helpers.cc
@@ -44,10 +44,10 @@
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/logging.h>
-#include <google/protobuf/compiler/cpp/cpp_options.h>
+#include <google/protobuf/descriptor.h>
#include <google/protobuf/compiler/cpp/cpp_names.h>
+#include <google/protobuf/compiler/cpp/cpp_options.h>
#include <google/protobuf/descriptor.pb.h>
-#include <google/protobuf/descriptor.h>
#include <google/protobuf/compiler/scc.h>
#include <google/protobuf/io/printer.h>
#include <google/protobuf/io/zero_copy_stream.h>
@@ -233,6 +233,18 @@ void SetCommonVars(const Options& options,
(*variables)["string"] = "TProtoStringType";
}
+void SetCommonMessageDataVariables(
+ std::map<TProtoStringType, TProtoStringType>* variables) {
+ (*variables)["any_metadata"] = "_any_metadata_";
+ (*variables)["cached_size"] = "_cached_size_";
+ (*variables)["extensions"] = "_extensions_";
+ (*variables)["has_bits"] = "_has_bits_";
+ (*variables)["inlined_string_donated_array"] = "_inlined_string_donated_";
+ (*variables)["oneof_case"] = "_oneof_case_";
+ (*variables)["tracker"] = "_tracker_";
+ (*variables)["weak_field_map"] = "_weak_field_map_";
+}
+
void SetUnknownFieldsVariable(const Descriptor* descriptor,
const Options& options,
std::map<TProtoStringType, TProtoStringType>* variables) {
@@ -457,6 +469,14 @@ TProtoStringType FieldName(const FieldDescriptor* field) {
return result;
}
+TProtoStringType FieldMemberName(const FieldDescriptor* field) {
+ if (field->real_containing_oneof() == nullptr) {
+ return StrCat(FieldName(field), "_");
+ }
+ return StrCat(field->containing_oneof()->name(), "_.", FieldName(field),
+ "_");
+}
+
TProtoStringType OneofCaseConstantName(const FieldDescriptor* field) {
GOOGLE_DCHECK(field->containing_oneof());
TProtoStringType field_name = UnderscoresToCamelCase(field->name(), true);
@@ -1151,7 +1171,6 @@ bool IsImplicitWeakField(const FieldDescriptor* field, const Options& options,
return UsingImplicitWeakFields(field->file(), options) &&
field->type() == FieldDescriptor::TYPE_MESSAGE &&
!field->is_required() && !field->is_map() && !field->is_extension() &&
- !field->real_containing_oneof() &&
!IsWellKnownMessage(field->message_type()->file()) &&
field->message_type()->file()->name() !=
"net/proto2/proto/descriptor.proto" &&
@@ -1268,7 +1287,7 @@ bool GetBootstrapBasename(const Options& options, const TProtoStringType& basena
std::unordered_map<TProtoStringType, TProtoStringType> bootstrap_mapping{
{"net/proto2/proto/descriptor",
- "net/proto2/internal/descriptor"},
+ "third_party/protobuf/descriptor"},
{"net/proto2/compiler/proto/plugin",
"net/proto2/compiler/proto/plugin"},
{"net/proto2/compiler/proto/profile",
@@ -1301,7 +1320,7 @@ bool MaybeBootstrap(const Options& options, GeneratorContext* generator_context,
*basename = bootstrap_basename;
return false;
} else {
- TProtoStringType forward_to_basename = bootstrap_basename;
+ const TProtoStringType& forward_to_basename = bootstrap_basename;
// Generate forwarding headers and empty .pb.cc.
{
@@ -1490,8 +1509,9 @@ FileOptions_OptimizeMode GetOptimizeFor(const FileDescriptor* file,
return FileOptions::SPEED;
}
-bool EnableMessageOwnedArena(const Descriptor* desc) {
+bool EnableMessageOwnedArena(const Descriptor* desc, const Options& options) {
(void)desc;
+ (void)options;
return false;
}