Remove unused headers, include missing headers, match args, etc.

PiperOrigin-RevId: 508138311
pull/11856/head
Protobuf Team Bot 2 years ago committed by Copybara-Service
parent 0ed65fd08f
commit 21a6a26d67
  1. 3
      src/google/protobuf/extension_set.cc
  2. 4
      src/google/protobuf/extension_set.h
  3. 32
      src/google/protobuf/extension_set_heavy.cc

@ -34,7 +34,9 @@
#include "google/protobuf/extension_set.h"
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#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"

@ -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,

@ -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 <vector>
#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<const FieldDescriptor*>* 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<UnknownFieldSet>(), 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<Message, UnknownFieldSet>(ptr, containing_type,
return ParseMessageSetItemTmpl<Message, UnknownFieldSet>(ptr, extendee,
metadata, ctx);
}

Loading…
Cancel
Save