Internal changes

PiperOrigin-RevId: 587872282
pull/14964/head
Mike Kruskal 1 year ago committed by Copybara-Service
parent 53d3e93b6c
commit 5ce86a675e
  1. 1
      src/google/protobuf/compiler/BUILD.bazel
  2. 6
      src/google/protobuf/compiler/command_line_interface.cc
  3. 1
      src/google/protobuf/compiler/java/helpers.h
  4. 11
      src/google/protobuf/compiler/java/message_lite.cc
  5. 4
      src/google/protobuf/compiler/mock_code_generator.cc
  6. 1
      src/google/protobuf/compiler/objectivec/BUILD.bazel
  7. 11
      src/google/protobuf/compiler/objectivec/file.cc

@ -279,7 +279,6 @@ cc_library(
deps = [
":code_generator",
"//src/google/protobuf:cc_test_protos",
"//src/google/protobuf:descriptor_legacy",
"//src/google/protobuf:descriptor_visitor",
"//src/google/protobuf/io",
"//src/google/protobuf/stubs",

@ -992,8 +992,7 @@ bool ContainsProto3Optional(const Descriptor* desc) {
}
bool ContainsProto3Optional(const FileDescriptor* file) {
if (FileDescriptorLegacy(file).syntax() ==
FileDescriptorLegacy::Syntax::SYNTAX_PROTO3) {
if (file->edition() == Edition::EDITION_PROTO3) {
for (int i = 0; i < file->message_type_count(); i++) {
if (ContainsProto3Optional(file->message_type(i))) {
return true;
@ -1601,8 +1600,7 @@ bool CommandLineInterface::ParseInputFiles(
if (!experimental_editions_ &&
!absl::StartsWith(parsed_file->name(), "google/protobuf/") &&
!absl::StartsWith(parsed_file->name(), "upb/")) {
if (FileDescriptorLegacy(parsed_file).syntax() ==
FileDescriptorLegacy::Syntax::SYNTAX_EDITIONS) {
if (parsed_file->edition() >= Edition::EDITION_2023) {
std::cerr
<< parsed_file->name()
<< ": This file uses editions, but --experimental_editions has not "

@ -22,7 +22,6 @@
#include "google/protobuf/compiler/java/options.h"
#include "google/protobuf/descriptor.h"
#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/descriptor_legacy.h"
#include "google/protobuf/io/printer.h"
// Must be last.

@ -473,18 +473,13 @@ void ImmutableMessageLiteGenerator::GenerateDynamicMethodNewBuildMessageInfo(
std::vector<uint16_t> chars;
int flags = 0;
if (FileDescriptorLegacy(descriptor_->file()).syntax() ==
FileDescriptorLegacy::Syntax::SYNTAX_PROTO2) {
if (!context_->options().strip_nonfunctional_codegen) {
flags |= 0x1;
}
}
if (descriptor_->options().message_set_wire_format()) {
flags |= 0x2;
}
if (FileDescriptorLegacy(descriptor_->file()).syntax() ==
FileDescriptorLegacy::Syntax::SYNTAX_EDITIONS) {
if (!context_->options().strip_nonfunctional_codegen) {
if (descriptor_->file()->edition() == Edition::EDITION_PROTO2) {
flags |= 0x1;
} else if (descriptor_->file()->edition() >= Edition::EDITION_2023) {
flags |= 0x4;
}
}

@ -34,7 +34,6 @@
#include "absl/strings/substitute.h"
#include "google/protobuf/compiler/plugin.pb.h"
#include "google/protobuf/descriptor.h"
#include "google/protobuf/descriptor_legacy.h"
#include "google/protobuf/descriptor_visitor.h"
#include "google/protobuf/io/printer.h"
#include "google/protobuf/io/zero_copy_stream.h"
@ -216,8 +215,7 @@ bool MockCodeGenerator::Generate(const FileDescriptor* file,
maximum_edition_ = Edition::EDITION_PROTO2;
}
if (FileDescriptorLegacy(file).syntax() ==
FileDescriptorLegacy::SYNTAX_EDITIONS &&
if (file->edition() >= Edition::EDITION_2023 &&
(suppressed_features_ & CodeGenerator::FEATURE_SUPPORTS_EDITIONS) == 0) {
internal::VisitDescriptors(*file, [&](const auto& descriptor) {
const FeatureSet& features = GetResolvedSourceFeatures(descriptor);

@ -95,7 +95,6 @@ cc_library(
deps = [
":line_consumer",
":names",
"//src/google/protobuf:descriptor_legacy",
"//src/google/protobuf:protobuf_nowkt",
"//src/google/protobuf/compiler:code_generator",
"@com_google_absl//absl/container:btree",

@ -31,7 +31,6 @@
#include "google/protobuf/compiler/objectivec/options.h"
#include "google/protobuf/descriptor.h"
#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/descriptor_legacy.h"
#include "google/protobuf/io/printer.h"
namespace google {
@ -742,17 +741,17 @@ void FileGenerator::EmitFileDescription(io::Printer* p) const {
// mode.
syntax = "GPBFileSyntaxUnknown";
} else {
switch (FileDescriptorLegacy(file_).syntax()) {
case FileDescriptorLegacy::Syntax::SYNTAX_UNKNOWN:
switch (file_->edition()) {
case Edition::EDITION_UNKNOWN:
syntax = "GPBFileSyntaxUnknown";
break;
case FileDescriptorLegacy::Syntax::SYNTAX_PROTO2:
case Edition::EDITION_PROTO2:
syntax = "GPBFileSyntaxProto2";
break;
case FileDescriptorLegacy::Syntax::SYNTAX_PROTO3:
case Edition::EDITION_PROTO3:
syntax = "GPBFileSyntaxProto3";
break;
case FileDescriptorLegacy::Syntax::SYNTAX_EDITIONS:
default:
syntax = "GPBFileSyntaxProtoEditions";
break;
}

Loading…
Cancel
Save