From 21a6a26d6736dfc2bf8e638e5054a3dc5f7fc2a5 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Wed, 8 Feb 2023 11:36:27 -0800 Subject: [PATCH] Remove unused headers, include missing headers, match args, etc. PiperOrigin-RevId: 508138311 --- src/google/protobuf/extension_set.cc | 3 +- src/google/protobuf/extension_set.h | 4 +-- src/google/protobuf/extension_set_heavy.cc | 32 +++++++++++----------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/google/protobuf/extension_set.cc b/src/google/protobuf/extension_set.cc index 9885e15d0c39..674cb5528b20 100644 --- a/src/google/protobuf/extension_set.cc +++ b/src/google/protobuf/extension_set.cc @@ -34,7 +34,9 @@ #include "google/protobuf/extension_set.h" +#include #include +#include #include #include "google/protobuf/stubs/common.h" @@ -43,7 +45,6 @@ #include "absl/hash/hash.h" #include "google/protobuf/extension_set_inl.h" #include "google/protobuf/io/coded_stream.h" -#include "google/protobuf/io/zero_copy_stream_impl_lite.h" #include "google/protobuf/message_lite.h" #include "google/protobuf/metadata_lite.h" #include "google/protobuf/parse_context.h" diff --git a/src/google/protobuf/extension_set.h b/src/google/protobuf/extension_set.h index cb9670f0e2c2..d5ef61a7e803 100644 --- a/src/google/protobuf/extension_set.h +++ b/src/google/protobuf/extension_set.h @@ -540,10 +540,10 @@ class PROTOBUF_EXPORT ExtensionSet { // Interface of a lazily parsed singular message extension. class PROTOBUF_EXPORT LazyMessageExtension { public: - LazyMessageExtension() {} + LazyMessageExtension() = default; LazyMessageExtension(const LazyMessageExtension&) = delete; LazyMessageExtension& operator=(const LazyMessageExtension&) = delete; - virtual ~LazyMessageExtension() {} + virtual ~LazyMessageExtension() = default; virtual LazyMessageExtension* New(Arena* arena) const = 0; virtual const MessageLite& GetMessage(const MessageLite& prototype, diff --git a/src/google/protobuf/extension_set_heavy.cc b/src/google/protobuf/extension_set_heavy.cc index 32c2b86ac122..cdc4cc34ee27 100644 --- a/src/google/protobuf/extension_set_heavy.cc +++ b/src/google/protobuf/extension_set_heavy.cc @@ -35,8 +35,9 @@ // Contains methods defined in extension_set.h which cannot be part of the // lite library because they use descriptors or reflection. +#include + #include "google/protobuf/arena.h" -#include "absl/base/casts.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/descriptor.pb.h" #include "google/protobuf/extension_set.h" @@ -48,7 +49,6 @@ #include "google/protobuf/port.h" #include "google/protobuf/repeated_field.h" #include "google/protobuf/unknown_field_set.h" -#include "google/protobuf/wire_format.h" #include "google/protobuf/wire_format_lite.h" @@ -66,8 +66,8 @@ class DescriptorPoolExtensionFinder { public: DescriptorPoolExtensionFinder(const DescriptorPool* pool, MessageFactory* factory, - const Descriptor* containing_type) - : pool_(pool), factory_(factory), containing_type_(containing_type) {} + const Descriptor* extendee) + : pool_(pool), factory_(factory), containing_type_(extendee) {} bool Find(int number, ExtensionInfo* output); @@ -78,9 +78,9 @@ class DescriptorPoolExtensionFinder { }; void ExtensionSet::AppendToList( - const Descriptor* containing_type, const DescriptorPool* pool, + const Descriptor* extendee, const DescriptorPool* pool, std::vector* output) const { - ForEach([containing_type, pool, &output](int number, const Extension& ext) { + ForEach([extendee, pool, &output](int number, const Extension& ext) { bool has = false; if (ext.is_repeated) { has = ext.GetSize() > 0; @@ -95,7 +95,7 @@ void ExtensionSet::AppendToList( // AppendToList() is called. if (ext.descriptor == nullptr) { - output->push_back(pool->FindExtensionByNumber(containing_type, number)); + output->push_back(pool->FindExtensionByNumber(extendee, number)); } else { output->push_back(ext.descriptor); } @@ -304,19 +304,19 @@ bool DescriptorPoolExtensionFinder::Find(int number, ExtensionInfo* output) { bool ExtensionSet::FindExtension(int wire_type, uint32_t field, - const Message* containing_type, + const Message* extendee, const internal::ParseContext* ctx, ExtensionInfo* extension, bool* was_packed_on_wire) { if (ctx->data().pool == nullptr) { - GeneratedExtensionFinder finder(containing_type); + GeneratedExtensionFinder finder(extendee); if (!FindExtensionInfoFromFieldNumber(wire_type, field, &finder, extension, was_packed_on_wire)) { return false; } } else { DescriptorPoolExtensionFinder finder(ctx->data().pool, ctx->data().factory, - containing_type->GetDescriptor()); + extendee->GetDescriptor()); if (!FindExtensionInfoFromFieldNumber(wire_type, field, &finder, extension, was_packed_on_wire)) { return false; @@ -326,13 +326,13 @@ bool ExtensionSet::FindExtension(int wire_type, uint32_t field, } const char* ExtensionSet::ParseField(uint64_t tag, const char* ptr, - const Message* containing_type, + const Message* extendee, internal::InternalMetadata* metadata, internal::ParseContext* ctx) { int number = tag >> 3; bool was_packed_on_wire; ExtensionInfo extension; - if (!FindExtension(tag & 7, number, containing_type, ctx, &extension, + if (!FindExtension(tag & 7, number, extendee, ctx, &extension, &was_packed_on_wire)) { return UnknownFieldParse( tag, metadata->mutable_unknown_fields(), ptr, ctx); @@ -342,15 +342,15 @@ const char* ExtensionSet::ParseField(uint64_t tag, const char* ptr, } const char* ExtensionSet::ParseFieldMaybeLazily( - uint64_t tag, const char* ptr, const Message* containing_type, + uint64_t tag, const char* ptr, const Message* extendee, internal::InternalMetadata* metadata, internal::ParseContext* ctx) { - return ParseField(tag, ptr, containing_type, metadata, ctx); + return ParseField(tag, ptr, extendee, metadata, ctx); } const char* ExtensionSet::ParseMessageSetItem( - const char* ptr, const Message* containing_type, + const char* ptr, const Message* extendee, internal::InternalMetadata* metadata, internal::ParseContext* ctx) { - return ParseMessageSetItemTmpl(ptr, containing_type, + return ParseMessageSetItemTmpl(ptr, extendee, metadata, ctx); }