Skip to content

Move gltf protos to ::imp::gltf::imp_proto namespace. #22602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions src/google/protobuf/compiler/cpp/message.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1247,6 +1247,16 @@ void MessageGenerator::GenerateFieldClear(const FieldDescriptor* field,
)cc");
}

void MessageGenerator::GenerateVerifyHasBitConsistency(
io::Printer* p, absl::string_view prefix) {
p->Emit({{"prefix", prefix}},
R"cc(
if constexpr (::_pbi::DebugHardenVerifyHasBitConsistency()) {
$prefix$VerifyHasBitConsistency();
}
)cc");
}

namespace {

class AccessorVerifier {
Expand Down Expand Up @@ -2996,6 +3006,8 @@ void MessageGenerator::GenerateSharedDestructorCode(io::Printer* p) {
};
p->Emit(
{
{"has_bit_consistency",
[&] { GenerateVerifyHasBitConsistency(p, "this_."); }},
{"field_dtors", [&] { emit_field_dtors(/* split_fields= */ false); }},
{"split_field_dtors",
[&] {
Expand Down Expand Up @@ -3037,6 +3049,7 @@ void MessageGenerator::GenerateSharedDestructorCode(io::Printer* p) {
R"cc(
inline void $classname$::SharedDtor(MessageLite& self) {
$classname$& this_ = static_cast<$classname$&>(self);
$has_bit_consistency$;
this_._internal_metadata_.Delete<$unknown_fields_type$>();
$DCHK$(this_.GetArena() == nullptr);
$WeakDescriptorSelfPin$;
Expand Down Expand Up @@ -4295,6 +4308,7 @@ void MessageGenerator::GenerateClassSpecificMergeImpl(io::Printer* p) {
" auto* const _this = static_cast<$classname$*>(&to_msg);\n"
" auto& from = static_cast<const $classname$&>(from_msg);\n");
format.Indent();
GenerateVerifyHasBitConsistency(p, "from.");
if (RequiresArena(GeneratorFunction::kMergeFrom)) {
p->Emit(R"cc(
$pb$::Arena* arena = _this->GetArena();
Expand Down Expand Up @@ -4509,9 +4523,8 @@ void MessageGenerator::GenerateClassSpecificMergeImpl(io::Printer* p) {
}

format(
"_this->_internal_metadata_.MergeFrom<$unknown_fields_type$>(from._"
"internal_"
"metadata_);\n");
"_this->_internal_metadata_.MergeFrom<$unknown_fields_type$>("
"from._internal_metadata_);\n");

format.Outdent();
format("}\n");
Expand Down Expand Up @@ -4716,6 +4729,8 @@ void MessageGenerator::GenerateSerializeWithCachedSizesToArray(io::Printer* p) {

p->Emit(
{
{"has_bit_consistency",
[&] { GenerateVerifyHasBitConsistency(p, "this_."); }},
{"ndebug", [&] { GenerateSerializeWithCachedSizesBody(p); }},
{"debug", [&] { GenerateSerializeWithCachedSizesBodyShuffled(p); }},
{"ifdef",
Expand Down Expand Up @@ -4746,6 +4761,7 @@ void MessageGenerator::GenerateSerializeWithCachedSizesToArray(io::Printer* p) {
const $classname$& this_ = *this;
#endif // PROTOBUF_CUSTOM_VTABLE
$annotate_serialize$;
$has_bit_consistency$;
// @@protoc_insertion_point(serialize_to_array_start:$full_name$)
$ifdef$;
// @@protoc_insertion_point(serialize_to_array_end:$full_name$)
Expand Down
2 changes: 2 additions & 0 deletions src/google/protobuf/compiler/cpp/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ class MessageGenerator {
// Generates the clear_foo() method for a field.
void GenerateFieldClear(const FieldDescriptor* field, bool is_inline,
io::Printer* p);
void GenerateVerifyHasBitConsistency(io::Printer* p,
absl::string_view prefix);

// Returns true if any of the fields needs an `arena` variable containing
// the current message's arena, reducing `GetArena()` call churn.
Expand Down
9 changes: 9 additions & 0 deletions src/google/protobuf/compiler/java/java_features.pb.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions src/google/protobuf/compiler/plugin.pb.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/google/protobuf/cpp_features.pb.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading