Skip to content

Commit 21a6a26

Browse files
Remove unused headers, include missing headers, match args, etc.
PiperOrigin-RevId: 508138311
1 parent 0ed65fd commit 21a6a26

File tree

3 files changed

+20
-19
lines changed

3 files changed

+20
-19
lines changed

src/google/protobuf/extension_set.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434

3535
#include "google/protobuf/extension_set.h"
3636

37+
#include <string>
3738
#include <tuple>
39+
#include <type_traits>
3840
#include <utility>
3941

4042
#include "google/protobuf/stubs/common.h"
@@ -43,7 +45,6 @@
4345
#include "absl/hash/hash.h"
4446
#include "google/protobuf/extension_set_inl.h"
4547
#include "google/protobuf/io/coded_stream.h"
46-
#include "google/protobuf/io/zero_copy_stream_impl_lite.h"
4748
#include "google/protobuf/message_lite.h"
4849
#include "google/protobuf/metadata_lite.h"
4950
#include "google/protobuf/parse_context.h"

src/google/protobuf/extension_set.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,10 +540,10 @@ class PROTOBUF_EXPORT ExtensionSet {
540540
// Interface of a lazily parsed singular message extension.
541541
class PROTOBUF_EXPORT LazyMessageExtension {
542542
public:
543-
LazyMessageExtension() {}
543+
LazyMessageExtension() = default;
544544
LazyMessageExtension(const LazyMessageExtension&) = delete;
545545
LazyMessageExtension& operator=(const LazyMessageExtension&) = delete;
546-
virtual ~LazyMessageExtension() {}
546+
virtual ~LazyMessageExtension() = default;
547547

548548
virtual LazyMessageExtension* New(Arena* arena) const = 0;
549549
virtual const MessageLite& GetMessage(const MessageLite& prototype,

src/google/protobuf/extension_set_heavy.cc

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@
3535
// Contains methods defined in extension_set.h which cannot be part of the
3636
// lite library because they use descriptors or reflection.
3737

38+
#include <vector>
39+
3840
#include "google/protobuf/arena.h"
39-
#include "absl/base/casts.h"
4041
#include "google/protobuf/descriptor.h"
4142
#include "google/protobuf/descriptor.pb.h"
4243
#include "google/protobuf/extension_set.h"
@@ -48,7 +49,6 @@
4849
#include "google/protobuf/port.h"
4950
#include "google/protobuf/repeated_field.h"
5051
#include "google/protobuf/unknown_field_set.h"
51-
#include "google/protobuf/wire_format.h"
5252
#include "google/protobuf/wire_format_lite.h"
5353

5454

@@ -66,8 +66,8 @@ class DescriptorPoolExtensionFinder {
6666
public:
6767
DescriptorPoolExtensionFinder(const DescriptorPool* pool,
6868
MessageFactory* factory,
69-
const Descriptor* containing_type)
70-
: pool_(pool), factory_(factory), containing_type_(containing_type) {}
69+
const Descriptor* extendee)
70+
: pool_(pool), factory_(factory), containing_type_(extendee) {}
7171

7272
bool Find(int number, ExtensionInfo* output);
7373

@@ -78,9 +78,9 @@ class DescriptorPoolExtensionFinder {
7878
};
7979

8080
void ExtensionSet::AppendToList(
81-
const Descriptor* containing_type, const DescriptorPool* pool,
81+
const Descriptor* extendee, const DescriptorPool* pool,
8282
std::vector<const FieldDescriptor*>* output) const {
83-
ForEach([containing_type, pool, &output](int number, const Extension& ext) {
83+
ForEach([extendee, pool, &output](int number, const Extension& ext) {
8484
bool has = false;
8585
if (ext.is_repeated) {
8686
has = ext.GetSize() > 0;
@@ -95,7 +95,7 @@ void ExtensionSet::AppendToList(
9595
// AppendToList() is called.
9696

9797
if (ext.descriptor == nullptr) {
98-
output->push_back(pool->FindExtensionByNumber(containing_type, number));
98+
output->push_back(pool->FindExtensionByNumber(extendee, number));
9999
} else {
100100
output->push_back(ext.descriptor);
101101
}
@@ -304,19 +304,19 @@ bool DescriptorPoolExtensionFinder::Find(int number, ExtensionInfo* output) {
304304

305305

306306
bool ExtensionSet::FindExtension(int wire_type, uint32_t field,
307-
const Message* containing_type,
307+
const Message* extendee,
308308
const internal::ParseContext* ctx,
309309
ExtensionInfo* extension,
310310
bool* was_packed_on_wire) {
311311
if (ctx->data().pool == nullptr) {
312-
GeneratedExtensionFinder finder(containing_type);
312+
GeneratedExtensionFinder finder(extendee);
313313
if (!FindExtensionInfoFromFieldNumber(wire_type, field, &finder, extension,
314314
was_packed_on_wire)) {
315315
return false;
316316
}
317317
} else {
318318
DescriptorPoolExtensionFinder finder(ctx->data().pool, ctx->data().factory,
319-
containing_type->GetDescriptor());
319+
extendee->GetDescriptor());
320320
if (!FindExtensionInfoFromFieldNumber(wire_type, field, &finder, extension,
321321
was_packed_on_wire)) {
322322
return false;
@@ -326,13 +326,13 @@ bool ExtensionSet::FindExtension(int wire_type, uint32_t field,
326326
}
327327

328328
const char* ExtensionSet::ParseField(uint64_t tag, const char* ptr,
329-
const Message* containing_type,
329+
const Message* extendee,
330330
internal::InternalMetadata* metadata,
331331
internal::ParseContext* ctx) {
332332
int number = tag >> 3;
333333
bool was_packed_on_wire;
334334
ExtensionInfo extension;
335-
if (!FindExtension(tag & 7, number, containing_type, ctx, &extension,
335+
if (!FindExtension(tag & 7, number, extendee, ctx, &extension,
336336
&was_packed_on_wire)) {
337337
return UnknownFieldParse(
338338
tag, metadata->mutable_unknown_fields<UnknownFieldSet>(), ptr, ctx);
@@ -342,15 +342,15 @@ const char* ExtensionSet::ParseField(uint64_t tag, const char* ptr,
342342
}
343343

344344
const char* ExtensionSet::ParseFieldMaybeLazily(
345-
uint64_t tag, const char* ptr, const Message* containing_type,
345+
uint64_t tag, const char* ptr, const Message* extendee,
346346
internal::InternalMetadata* metadata, internal::ParseContext* ctx) {
347-
return ParseField(tag, ptr, containing_type, metadata, ctx);
347+
return ParseField(tag, ptr, extendee, metadata, ctx);
348348
}
349349

350350
const char* ExtensionSet::ParseMessageSetItem(
351-
const char* ptr, const Message* containing_type,
351+
const char* ptr, const Message* extendee,
352352
internal::InternalMetadata* metadata, internal::ParseContext* ctx) {
353-
return ParseMessageSetItemTmpl<Message, UnknownFieldSet>(ptr, containing_type,
353+
return ParseMessageSetItemTmpl<Message, UnknownFieldSet>(ptr, extendee,
354354
metadata, ctx);
355355
}
356356

0 commit comments

Comments
 (0)