Update CHANGES.txt (#9897)
This commit is contained in:
parent
b37b613436
commit
5eafa23c98
@ -14,6 +14,7 @@ Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
|
||||
* Refactor generated message class layout
|
||||
* Optimize tokenizer ParseInteger by removing division
|
||||
* Reserve exactly the right amount of capacity in ExtensionSet::MergeFrom
|
||||
* Parse FLT_MAX correctly when represented in JSON
|
||||
|
||||
Compiler
|
||||
* Protoc outputs the list of suggested field numbers when invalid field
|
||||
|
@ -151,7 +151,7 @@ public class ProtoCaliperBenchmark {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("IgnoredPureGetter")
|
||||
@Benchmark
|
||||
void serializeToByteArray(int reps) throws IOException {
|
||||
if (sampleMessageList.size() == 0) {
|
||||
|
@ -123,7 +123,7 @@ if(protobuf_HAVE_LD_VERSION_SCRIPT)
|
||||
endif()
|
||||
target_link_libraries(libprotoc PRIVATE libprotobuf)
|
||||
target_include_directories(libprotoc
|
||||
PRIVATE ${ABSL_ROOT_DIR}
|
||||
PRIVATE ${ABSL_ROOT_DIR}
|
||||
)
|
||||
if(protobuf_BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(libprotoc
|
||||
|
@ -32,6 +32,7 @@ package com.google.protobuf;
|
||||
|
||||
import static com.google.protobuf.MessageSchema.getMutableUnknownFields;
|
||||
|
||||
import com.google.protobuf.GeneratedMessageLite.ExtensionDescriptor;
|
||||
import com.google.protobuf.Internal.ProtobufList;
|
||||
import java.io.IOException;
|
||||
|
||||
@ -759,7 +760,9 @@ final class ArrayDecoders {
|
||||
return decodeUnknownField(
|
||||
tag, data, position, limit, getMutableUnknownFields(message), registers);
|
||||
} else {
|
||||
((GeneratedMessageLite.ExtendableMessage<?, ?>) message).ensureExtensionsAreMutable();
|
||||
// TODO(b/230609037): remove the unused variable
|
||||
FieldSet<ExtensionDescriptor> unused =
|
||||
((GeneratedMessageLite.ExtendableMessage<?, ?>) message).ensureExtensionsAreMutable();
|
||||
return decodeExtension(
|
||||
tag, data, position, limit, (GeneratedMessageLite.ExtendableMessage) message,
|
||||
extension, unknownFieldSchema, registers);
|
||||
|
@ -247,6 +247,7 @@ public abstract class GeneratedMessageLite<
|
||||
protected abstract Object dynamicMethod(MethodToInvoke method, Object arg0, Object arg1);
|
||||
|
||||
/** Same as {@link #dynamicMethod(MethodToInvoke, Object, Object)} with {@code null} padding. */
|
||||
@CanIgnoreReturnValue
|
||||
protected Object dynamicMethod(MethodToInvoke method, Object arg0) {
|
||||
return dynamicMethod(method, arg0, null);
|
||||
}
|
||||
@ -571,7 +572,8 @@ public abstract class GeneratedMessageLite<
|
||||
return parseUnknownField(tag, input);
|
||||
}
|
||||
|
||||
ensureExtensionsAreMutable();
|
||||
// TODO(b/230609037): remove the unused variable
|
||||
FieldSet<ExtensionDescriptor> unused = ensureExtensionsAreMutable();
|
||||
|
||||
if (packed) {
|
||||
int length = input.readRawVarint32();
|
||||
@ -764,7 +766,8 @@ public abstract class GeneratedMessageLite<
|
||||
throws IOException {
|
||||
int fieldNumber = typeId;
|
||||
int tag = WireFormat.makeTag(typeId, WireFormat.WIRETYPE_LENGTH_DELIMITED);
|
||||
parseExtension(input, extensionRegistry, extension, tag, fieldNumber);
|
||||
// TODO(b/230609037): remove the unused variable
|
||||
boolean unused = parseExtension(input, extensionRegistry, extension, tag, fieldNumber);
|
||||
}
|
||||
|
||||
private void mergeMessageSetExtensionFromBytes(
|
||||
@ -787,6 +790,7 @@ public abstract class GeneratedMessageLite<
|
||||
.setField(extension.descriptor, extension.singularToFieldSetType(value));
|
||||
}
|
||||
|
||||
@CanIgnoreReturnValue
|
||||
FieldSet<ExtensionDescriptor> ensureExtensionsAreMutable() {
|
||||
if (extensions.isImmutable()) {
|
||||
extensions = extensions.clone();
|
||||
@ -1424,8 +1428,10 @@ public abstract class GeneratedMessageLite<
|
||||
}
|
||||
boolean isInitialized = Protobuf.getInstance().schemaFor(message).isInitialized(message);
|
||||
if (shouldMemoize) {
|
||||
message.dynamicMethod(
|
||||
MethodToInvoke.SET_MEMOIZED_IS_INITIALIZED, isInitialized ? message : null);
|
||||
// TODO(b/230609037): remove the unused variable
|
||||
Object unused =
|
||||
message.dynamicMethod(
|
||||
MethodToInvoke.SET_MEMOIZED_IS_INITIALIZED, isInitialized ? message : null);
|
||||
}
|
||||
return isInitialized;
|
||||
}
|
||||
|
@ -1850,6 +1850,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage
|
||||
}
|
||||
|
||||
/** Calls invoke and throws a RuntimeException if it fails. */
|
||||
@CanIgnoreReturnValue
|
||||
private static Object invokeOrDie(
|
||||
final Method method, final Object object, final Object... params) {
|
||||
try {
|
||||
@ -2130,7 +2131,8 @@ public abstract class GeneratedMessageV3 extends AbstractMessage
|
||||
}
|
||||
|
||||
public void clear(final Builder builder) {
|
||||
invokeOrDie(clearMethod, builder);
|
||||
// TODO(b/230609037): remove the unused variable
|
||||
Object unused = invokeOrDie(clearMethod, builder);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2213,7 +2215,8 @@ public abstract class GeneratedMessageV3 extends AbstractMessage
|
||||
|
||||
@Override
|
||||
public void set(final GeneratedMessageV3.Builder<?> builder, final Object value) {
|
||||
invokeOrDie(setMethod, builder, value);
|
||||
// TODO(b/230609037): remove the unused variable
|
||||
Object unused = invokeOrDie(setMethod, builder, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -2228,7 +2231,8 @@ public abstract class GeneratedMessageV3 extends AbstractMessage
|
||||
|
||||
@Override
|
||||
public void clear(final GeneratedMessageV3.Builder<?> builder) {
|
||||
invokeOrDie(clearMethod, builder);
|
||||
// TODO(b/230609037): remove the unused variable
|
||||
Object unused = invokeOrDie(clearMethod, builder);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2444,13 +2448,15 @@ public abstract class GeneratedMessageV3 extends AbstractMessage
|
||||
@Override
|
||||
public void setRepeated(
|
||||
final GeneratedMessageV3.Builder<?> builder, final int index, final Object value) {
|
||||
invokeOrDie(setRepeatedMethod, builder, index, value);
|
||||
// TODO(b/230609037): remove the unused variable
|
||||
Object unused = invokeOrDie(setRepeatedMethod, builder, index, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRepeated(
|
||||
final GeneratedMessageV3.Builder<?> builder, final Object value) {
|
||||
invokeOrDie(addRepeatedMethod, builder, value);
|
||||
// TODO(b/230609037): remove the unused variable
|
||||
Object unused = invokeOrDie(addRepeatedMethod, builder, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -2465,7 +2471,8 @@ public abstract class GeneratedMessageV3 extends AbstractMessage
|
||||
|
||||
@Override
|
||||
public void clear(final GeneratedMessageV3.Builder<?> builder) {
|
||||
invokeOrDie(clearMethod, builder);
|
||||
// TODO(b/230609037): remove the unused variable
|
||||
Object unused = invokeOrDie(clearMethod, builder);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2788,8 +2795,9 @@ public abstract class GeneratedMessageV3 extends AbstractMessage
|
||||
@Override
|
||||
public void set(final Builder builder, final Object value) {
|
||||
if (supportUnknownEnumValue) {
|
||||
invokeOrDie(setValueMethod, builder,
|
||||
((EnumValueDescriptor) value).getNumber());
|
||||
// TODO(b/230609037): remove the unused variable
|
||||
Object unused =
|
||||
invokeOrDie(setValueMethod, builder, ((EnumValueDescriptor) value).getNumber());
|
||||
return;
|
||||
}
|
||||
super.set(builder, invokeOrDie(valueOfMethod, null, value));
|
||||
@ -2875,8 +2883,13 @@ public abstract class GeneratedMessageV3 extends AbstractMessage
|
||||
@Override
|
||||
public void setRepeated(final Builder builder, final int index, final Object value) {
|
||||
if (supportUnknownEnumValue) {
|
||||
invokeOrDie(setRepeatedValueMethod, builder, index,
|
||||
((EnumValueDescriptor) value).getNumber());
|
||||
// TODO(b/230609037): remove the unused variable
|
||||
Object unused =
|
||||
invokeOrDie(
|
||||
setRepeatedValueMethod,
|
||||
builder,
|
||||
index,
|
||||
((EnumValueDescriptor) value).getNumber());
|
||||
return;
|
||||
}
|
||||
super.setRepeated(builder, index, invokeOrDie(valueOfMethod, null, value));
|
||||
@ -2884,8 +2897,10 @@ public abstract class GeneratedMessageV3 extends AbstractMessage
|
||||
@Override
|
||||
public void addRepeated(final Builder builder, final Object value) {
|
||||
if (supportUnknownEnumValue) {
|
||||
invokeOrDie(addRepeatedValueMethod, builder,
|
||||
((EnumValueDescriptor) value).getNumber());
|
||||
// TODO(b/230609037): remove the unused variable
|
||||
Object unused =
|
||||
invokeOrDie(
|
||||
addRepeatedValueMethod, builder, ((EnumValueDescriptor) value).getNumber());
|
||||
return;
|
||||
}
|
||||
super.addRepeated(builder, invokeOrDie(valueOfMethod, null, value));
|
||||
@ -2939,7 +2954,8 @@ public abstract class GeneratedMessageV3 extends AbstractMessage
|
||||
@Override
|
||||
public void set(GeneratedMessageV3.Builder builder, Object value) {
|
||||
if (value instanceof ByteString) {
|
||||
invokeOrDie(setBytesMethodBuilder, builder, value);
|
||||
// TODO(b/230609037): remove the unused variable
|
||||
Object unused = invokeOrDie(setBytesMethodBuilder, builder, value);
|
||||
} else {
|
||||
super.set(builder, value);
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.RandomAccess;
|
||||
|
||||
/**
|
||||
* {@code RepeatedFieldBuilder} implements a structure that a protocol message uses to hold a
|
||||
@ -572,7 +573,7 @@ public class RepeatedFieldBuilder<
|
||||
MType extends GeneratedMessage,
|
||||
BType extends GeneratedMessage.Builder,
|
||||
IType extends MessageOrBuilder>
|
||||
extends AbstractList<MType> implements List<MType> {
|
||||
extends AbstractList<MType> implements List<MType>, RandomAccess {
|
||||
|
||||
RepeatedFieldBuilder<MType, BType, IType> builder;
|
||||
|
||||
@ -606,7 +607,7 @@ public class RepeatedFieldBuilder<
|
||||
MType extends GeneratedMessage,
|
||||
BType extends GeneratedMessage.Builder,
|
||||
IType extends MessageOrBuilder>
|
||||
extends AbstractList<BType> implements List<BType> {
|
||||
extends AbstractList<BType> implements List<BType>, RandomAccess {
|
||||
|
||||
RepeatedFieldBuilder<MType, BType, IType> builder;
|
||||
|
||||
@ -640,7 +641,7 @@ public class RepeatedFieldBuilder<
|
||||
MType extends GeneratedMessage,
|
||||
BType extends GeneratedMessage.Builder,
|
||||
IType extends MessageOrBuilder>
|
||||
extends AbstractList<IType> implements List<IType> {
|
||||
extends AbstractList<IType> implements List<IType>, RandomAccess {
|
||||
|
||||
RepeatedFieldBuilder<MType, BType, IType> builder;
|
||||
|
||||
|
@ -37,6 +37,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.RandomAccess;
|
||||
|
||||
/**
|
||||
* {@code RepeatedFieldBuilderV3} implements a structure that a protocol message uses to hold a
|
||||
@ -572,7 +573,7 @@ public class RepeatedFieldBuilderV3<
|
||||
MType extends AbstractMessage,
|
||||
BType extends AbstractMessage.Builder,
|
||||
IType extends MessageOrBuilder>
|
||||
extends AbstractList<MType> implements List<MType> {
|
||||
extends AbstractList<MType> implements List<MType>, RandomAccess {
|
||||
|
||||
RepeatedFieldBuilderV3<MType, BType, IType> builder;
|
||||
|
||||
@ -606,7 +607,7 @@ public class RepeatedFieldBuilderV3<
|
||||
MType extends AbstractMessage,
|
||||
BType extends AbstractMessage.Builder,
|
||||
IType extends MessageOrBuilder>
|
||||
extends AbstractList<BType> implements List<BType> {
|
||||
extends AbstractList<BType> implements List<BType>, RandomAccess {
|
||||
|
||||
RepeatedFieldBuilderV3<MType, BType, IType> builder;
|
||||
|
||||
@ -640,7 +641,7 @@ public class RepeatedFieldBuilderV3<
|
||||
MType extends AbstractMessage,
|
||||
BType extends AbstractMessage.Builder,
|
||||
IType extends MessageOrBuilder>
|
||||
extends AbstractList<IType> implements List<IType> {
|
||||
extends AbstractList<IType> implements List<IType>, RandomAccess {
|
||||
|
||||
RepeatedFieldBuilderV3<MType, BType, IType> builder;
|
||||
|
||||
|
@ -52,7 +52,7 @@ public final class CachedFieldSizeTest {
|
||||
|
||||
// Serialize once to cache all field sizes. This will use the experimental runtime because
|
||||
// the proto has optimize_for = CODE_SIZE.
|
||||
message.toByteArray();
|
||||
byte[] unused = message.toByteArray();
|
||||
// Serialize individual submessages. This will use the generated implementation. If the
|
||||
// experimental runtime hasn't set the correct cached size, this will throw an exception.
|
||||
byte[] data2 = message.getProto2Child().toByteArray();
|
||||
|
@ -573,7 +573,7 @@ public class CodedInputStreamTest {
|
||||
// returning our big serialized message 'count' times.
|
||||
InputStream is = new RepeatingInputStream(serializedMessage, count);
|
||||
// Parse should succeed!
|
||||
TestAllTypes.parseFrom(is);
|
||||
TestAllTypes unused = TestAllTypes.parseFrom(is);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -112,7 +112,7 @@ public class LazyStringEndToEndTest {
|
||||
assertThat(proto.getRepeatedString(1)).isSameInstanceAs(c);
|
||||
|
||||
// Ensure serialization keeps strings cached.
|
||||
proto.toByteString();
|
||||
ByteString unused = proto.toByteString();
|
||||
|
||||
// And now the string should stay cached.
|
||||
assertThat(proto.getOptionalString()).isSameInstanceAs(a);
|
||||
|
@ -131,7 +131,8 @@ public class LiteTest {
|
||||
output.flush();
|
||||
// This tests a bug we had once with removal right at the boundary of the array. It would throw
|
||||
// at runtime so no need to assert.
|
||||
TestAllTypesLite.parseFrom(new ByteArrayInputStream(byteStream.toByteArray()));
|
||||
TestAllTypesLite unused =
|
||||
TestAllTypesLite.parseFrom(new ByteArrayInputStream(byteStream.toByteArray()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -115,6 +115,7 @@ Any::Any(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
Any::Any(const Any& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
Any* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.type_url_){}
|
||||
, decltype(_impl_.value_){}
|
||||
@ -127,16 +128,16 @@ Any::Any(const Any& from)
|
||||
_impl_.type_url_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_type_url().empty()) {
|
||||
_impl_.type_url_.Set(from._internal_type_url(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.type_url_.Set(from._internal_type_url(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
_impl_.value_.InitDefault();
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
_impl_.value_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_value().empty()) {
|
||||
_impl_.value_.Set(from._internal_value(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.value_.Set(from._internal_value(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
// @@protoc_insertion_point(copy_constructor:google.protobuf.Any)
|
||||
}
|
||||
@ -301,26 +302,22 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Any::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Any::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void Any::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<Any *>(to)->MergeFrom(
|
||||
static_cast<const Any &>(from));
|
||||
}
|
||||
|
||||
|
||||
void Any::MergeFrom(const Any& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Any)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void Any::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<Any*>(&to_msg);
|
||||
auto& from = static_cast<const Any&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Any)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
if (!from._internal_type_url().empty()) {
|
||||
_internal_set_type_url(from._internal_type_url());
|
||||
_this->_internal_set_type_url(from._internal_type_url());
|
||||
}
|
||||
if (!from._internal_value().empty()) {
|
||||
_internal_set_value(from._internal_value());
|
||||
_this->_internal_set_value(from._internal_value());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void Any::CopyFrom(const Any& from) {
|
||||
|
@ -171,9 +171,11 @@ class PROTOBUF_EXPORT Any final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const Any& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const Any& from);
|
||||
void MergeFrom( const Any& from) {
|
||||
Any::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
@ -196,6 +196,7 @@ Api::Api(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
Api::Api(const Api& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
Api* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.methods_){from._impl_.methods_}
|
||||
, decltype(_impl_.options_){from._impl_.options_}
|
||||
@ -212,21 +213,21 @@ Api::Api(const Api& from)
|
||||
_impl_.name_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_name().empty()) {
|
||||
_impl_.name_.Set(from._internal_name(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.name_.Set(from._internal_name(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
_impl_.version_.InitDefault();
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
_impl_.version_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_version().empty()) {
|
||||
_impl_.version_.Set(from._internal_version(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.version_.Set(from._internal_version(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
if (from._internal_has_source_context()) {
|
||||
_impl_.source_context_ = new ::PROTOBUF_NAMESPACE_ID::SourceContext(*from._impl_.source_context_);
|
||||
_this->_impl_.source_context_ = new ::PROTOBUF_NAMESPACE_ID::SourceContext(*from._impl_.source_context_);
|
||||
}
|
||||
_impl_.syntax_ = from._impl_.syntax_;
|
||||
_this->_impl_.syntax_ = from._impl_.syntax_;
|
||||
// @@protoc_insertion_point(copy_constructor:google.protobuf.Api)
|
||||
}
|
||||
|
||||
@ -538,35 +539,32 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Api::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Api::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void Api::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<Api *>(to)->MergeFrom(
|
||||
static_cast<const Api &>(from));
|
||||
}
|
||||
|
||||
|
||||
void Api::MergeFrom(const Api& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Api)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void Api::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<Api*>(&to_msg);
|
||||
auto& from = static_cast<const Api&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Api)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
_impl_.methods_.MergeFrom(from._impl_.methods_);
|
||||
_impl_.options_.MergeFrom(from._impl_.options_);
|
||||
_impl_.mixins_.MergeFrom(from._impl_.mixins_);
|
||||
_this->_impl_.methods_.MergeFrom(from._impl_.methods_);
|
||||
_this->_impl_.options_.MergeFrom(from._impl_.options_);
|
||||
_this->_impl_.mixins_.MergeFrom(from._impl_.mixins_);
|
||||
if (!from._internal_name().empty()) {
|
||||
_internal_set_name(from._internal_name());
|
||||
_this->_internal_set_name(from._internal_name());
|
||||
}
|
||||
if (!from._internal_version().empty()) {
|
||||
_internal_set_version(from._internal_version());
|
||||
_this->_internal_set_version(from._internal_version());
|
||||
}
|
||||
if (from._internal_has_source_context()) {
|
||||
_internal_mutable_source_context()->::PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom(from._internal_source_context());
|
||||
_this->_internal_mutable_source_context()->::PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom(
|
||||
from._internal_source_context());
|
||||
}
|
||||
if (from._internal_syntax() != 0) {
|
||||
_internal_set_syntax(from._internal_syntax());
|
||||
_this->_internal_set_syntax(from._internal_syntax());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void Api::CopyFrom(const Api& from) {
|
||||
@ -627,6 +625,7 @@ Method::Method(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
Method::Method(const Method& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
Method* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.options_){from._impl_.options_}
|
||||
, decltype(_impl_.name_){}
|
||||
@ -643,24 +642,24 @@ Method::Method(const Method& from)
|
||||
_impl_.name_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_name().empty()) {
|
||||
_impl_.name_.Set(from._internal_name(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.name_.Set(from._internal_name(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
_impl_.request_type_url_.InitDefault();
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
_impl_.request_type_url_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_request_type_url().empty()) {
|
||||
_impl_.request_type_url_.Set(from._internal_request_type_url(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.request_type_url_.Set(from._internal_request_type_url(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
_impl_.response_type_url_.InitDefault();
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
_impl_.response_type_url_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_response_type_url().empty()) {
|
||||
_impl_.response_type_url_.Set(from._internal_response_type_url(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.response_type_url_.Set(from._internal_response_type_url(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
::memcpy(&_impl_.request_streaming_, &from._impl_.request_streaming_,
|
||||
static_cast<size_t>(reinterpret_cast<char*>(&_impl_.syntax_) -
|
||||
@ -962,39 +961,35 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Method::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Method::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void Method::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<Method *>(to)->MergeFrom(
|
||||
static_cast<const Method &>(from));
|
||||
}
|
||||
|
||||
|
||||
void Method::MergeFrom(const Method& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Method)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void Method::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<Method*>(&to_msg);
|
||||
auto& from = static_cast<const Method&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Method)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
_impl_.options_.MergeFrom(from._impl_.options_);
|
||||
_this->_impl_.options_.MergeFrom(from._impl_.options_);
|
||||
if (!from._internal_name().empty()) {
|
||||
_internal_set_name(from._internal_name());
|
||||
_this->_internal_set_name(from._internal_name());
|
||||
}
|
||||
if (!from._internal_request_type_url().empty()) {
|
||||
_internal_set_request_type_url(from._internal_request_type_url());
|
||||
_this->_internal_set_request_type_url(from._internal_request_type_url());
|
||||
}
|
||||
if (!from._internal_response_type_url().empty()) {
|
||||
_internal_set_response_type_url(from._internal_response_type_url());
|
||||
_this->_internal_set_response_type_url(from._internal_response_type_url());
|
||||
}
|
||||
if (from._internal_request_streaming() != 0) {
|
||||
_internal_set_request_streaming(from._internal_request_streaming());
|
||||
_this->_internal_set_request_streaming(from._internal_request_streaming());
|
||||
}
|
||||
if (from._internal_response_streaming() != 0) {
|
||||
_internal_set_response_streaming(from._internal_response_streaming());
|
||||
_this->_internal_set_response_streaming(from._internal_response_streaming());
|
||||
}
|
||||
if (from._internal_syntax() != 0) {
|
||||
_internal_set_syntax(from._internal_syntax());
|
||||
_this->_internal_set_syntax(from._internal_syntax());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void Method::CopyFrom(const Method& from) {
|
||||
@ -1054,6 +1049,7 @@ Mixin::Mixin(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
Mixin::Mixin(const Mixin& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
Mixin* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.name_){}
|
||||
, decltype(_impl_.root_){}
|
||||
@ -1065,16 +1061,16 @@ Mixin::Mixin(const Mixin& from)
|
||||
_impl_.name_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_name().empty()) {
|
||||
_impl_.name_.Set(from._internal_name(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.name_.Set(from._internal_name(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
_impl_.root_.InitDefault();
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
_impl_.root_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_root().empty()) {
|
||||
_impl_.root_.Set(from._internal_root(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.root_.Set(from._internal_root(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
// @@protoc_insertion_point(copy_constructor:google.protobuf.Mixin)
|
||||
}
|
||||
@ -1242,26 +1238,22 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Mixin::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Mixin::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void Mixin::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<Mixin *>(to)->MergeFrom(
|
||||
static_cast<const Mixin &>(from));
|
||||
}
|
||||
|
||||
|
||||
void Mixin::MergeFrom(const Mixin& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Mixin)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void Mixin::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<Mixin*>(&to_msg);
|
||||
auto& from = static_cast<const Mixin&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Mixin)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
if (!from._internal_name().empty()) {
|
||||
_internal_set_name(from._internal_name());
|
||||
_this->_internal_set_name(from._internal_name());
|
||||
}
|
||||
if (!from._internal_root().empty()) {
|
||||
_internal_set_root(from._internal_root());
|
||||
_this->_internal_set_root(from._internal_root());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void Mixin::CopyFrom(const Mixin& from) {
|
||||
|
@ -146,9 +146,11 @@ class PROTOBUF_EXPORT Api final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const Api& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const Api& from);
|
||||
void MergeFrom( const Api& from) {
|
||||
Api::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -404,9 +406,11 @@ class PROTOBUF_EXPORT Method final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const Method& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const Method& from);
|
||||
void MergeFrom( const Method& from) {
|
||||
Method::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -640,9 +644,11 @@ class PROTOBUF_EXPORT Mixin final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const Mixin& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const Mixin& from);
|
||||
void MergeFrom( const Mixin& from) {
|
||||
Mixin::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
@ -123,7 +123,7 @@ void EnumFieldGenerator::GenerateClearingCode(io::Printer* printer) const {
|
||||
|
||||
void EnumFieldGenerator::GenerateMergingCode(io::Printer* printer) const {
|
||||
Formatter format(printer, variables_);
|
||||
format("_internal_set_$name$(from._internal_$name$());\n");
|
||||
format("_this->_internal_set_$name$(from._internal_$name$());\n");
|
||||
}
|
||||
|
||||
void EnumFieldGenerator::GenerateSwappingCode(io::Printer* printer) const {
|
||||
@ -134,7 +134,7 @@ void EnumFieldGenerator::GenerateSwappingCode(io::Printer* printer) const {
|
||||
void EnumFieldGenerator::GenerateCopyConstructorCode(
|
||||
io::Printer* printer) const {
|
||||
Formatter format(printer, variables_);
|
||||
format("$field$ = from.$field$;\n");
|
||||
format("_this->$field$ = from.$field$;\n");
|
||||
}
|
||||
|
||||
void EnumFieldGenerator::GenerateSerializeWithCachedSizesToArray(
|
||||
@ -329,7 +329,7 @@ void RepeatedEnumFieldGenerator::GenerateClearingCode(
|
||||
void RepeatedEnumFieldGenerator::GenerateMergingCode(
|
||||
io::Printer* printer) const {
|
||||
Formatter format(printer, variables_);
|
||||
format("$field$.MergeFrom(from.$field$);\n");
|
||||
format("_this->$field$.MergeFrom(from.$field$);\n");
|
||||
}
|
||||
|
||||
void RepeatedEnumFieldGenerator::GenerateSwappingCode(
|
||||
|
@ -252,13 +252,6 @@ void SetCommonFieldVariables(const FieldDescriptor* descriptor,
|
||||
|
||||
(*variables)["set_hasbit"] = "";
|
||||
(*variables)["clear_hasbit"] = "";
|
||||
if (HasHasbit(descriptor)) {
|
||||
(*variables)["set_hasbit_io"] =
|
||||
StrCat("_Internal::set_has_", FieldName(descriptor), "(&",
|
||||
(*variables)["has_bits"], ");");
|
||||
} else {
|
||||
(*variables)["set_hasbit_io"] = "";
|
||||
}
|
||||
|
||||
AddAccessorAnnotations(descriptor, options, variables);
|
||||
|
||||
|
@ -153,7 +153,7 @@ void MapFieldGenerator::GenerateClearingCode(io::Printer* printer) const {
|
||||
|
||||
void MapFieldGenerator::GenerateMergingCode(io::Printer* printer) const {
|
||||
Formatter format(printer, variables_);
|
||||
format("$field$.MergeFrom(from.$field$);\n");
|
||||
format("_this->$field$.MergeFrom(from.$field$);\n");
|
||||
}
|
||||
|
||||
void MapFieldGenerator::GenerateSwappingCode(io::Printer* printer) const {
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include <google/protobuf/map_entry_lite.h>
|
||||
#include <google/protobuf/wire_format.h>
|
||||
#include <google/protobuf/stubs/strutil.h>
|
||||
#include <google/protobuf/stubs/stringprintf.h>
|
||||
#include <google/protobuf/stubs/substitute.h>
|
||||
#include <google/protobuf/compiler/cpp/enum.h>
|
||||
#include <google/protobuf/compiler/cpp/extension.h>
|
||||
@ -645,7 +646,7 @@ MessageGenerator::MessageGenerator(
|
||||
MaySetAnnotationVariable(options, "bytesize", injector_template,
|
||||
"OnByteSize(this);\n", &variables_);
|
||||
MaySetAnnotationVariable(options, "mergefrom", injector_template,
|
||||
"OnMergeFrom(this, &from);\n", &variables_);
|
||||
"OnMergeFrom(_this, &from);\n", &variables_);
|
||||
}
|
||||
|
||||
GenerateExtensionAnnotations(descriptor_, options_, &variables_);
|
||||
@ -1621,27 +1622,28 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
|
||||
// argument is a generic Message instance, and only define the
|
||||
// custom MergeFrom and CopyFrom instances when the source of the
|
||||
// merge/copy is known to be the same class as the destination.
|
||||
// TODO(jorg): Define MergeFrom in terms of MergeImpl, rather than
|
||||
// the other way around, to save even more code size.
|
||||
"using $superclass$::CopyFrom;\n"
|
||||
"void CopyFrom(const $classname$& from);\n"
|
||||
""
|
||||
"using $superclass$::MergeFrom;\n"
|
||||
"void MergeFrom(const $classname$& from);\n"
|
||||
"void MergeFrom("
|
||||
" const $classname$& from) {\n"
|
||||
" $classname$::MergeImpl(*this, from);\n"
|
||||
"}\n"
|
||||
"private:\n"
|
||||
"static void MergeImpl(::$proto_ns$::Message* to, const "
|
||||
"::$proto_ns$::Message& from);\n"
|
||||
"static void MergeImpl(::$proto_ns$::Message& to_msg, const "
|
||||
"::$proto_ns$::Message& from_msg);\n"
|
||||
"public:\n");
|
||||
} else {
|
||||
format(
|
||||
"using $superclass$::CopyFrom;\n"
|
||||
"inline void CopyFrom(const $classname$& from) {\n"
|
||||
" $superclass$::CopyImpl(this, from);\n"
|
||||
" $superclass$::CopyImpl(*this, from);\n"
|
||||
"}\n"
|
||||
""
|
||||
"using $superclass$::MergeFrom;\n"
|
||||
"void MergeFrom(const $classname$& from) {\n"
|
||||
" $superclass$::MergeImpl(this, from);\n"
|
||||
" $superclass$::MergeImpl(*this, from);\n"
|
||||
"}\n"
|
||||
"public:\n");
|
||||
}
|
||||
@ -2142,7 +2144,7 @@ void MessageGenerator::GenerateClassMethods(io::Printer* printer) {
|
||||
GenerateMergeFrom(printer);
|
||||
format("\n");
|
||||
|
||||
GenerateClassSpecificMergeFrom(printer);
|
||||
GenerateClassSpecificMergeImpl(printer);
|
||||
format("\n");
|
||||
|
||||
GenerateCopyFrom(printer);
|
||||
@ -2644,6 +2646,7 @@ void MessageGenerator::GenerateStructors(io::Printer* printer) {
|
||||
"$classname$::$classname$(const $classname$& from)\n"
|
||||
" : $superclass$() {\n");
|
||||
format.Indent();
|
||||
format("$classname$* const _this = this; (void)_this;\n");
|
||||
|
||||
if (HasImplData(descriptor_, options_)) {
|
||||
const char* field_sep = " ";
|
||||
@ -3151,12 +3154,6 @@ void MessageGenerator::GenerateMergeFrom(io::Printer* printer) {
|
||||
"};\n"
|
||||
"const ::$proto_ns$::Message::ClassData*"
|
||||
"$classname$::GetClassData() const { return &_class_data_; }\n"
|
||||
"\n"
|
||||
"void $classname$::MergeImpl(::$proto_ns$::Message* to,\n"
|
||||
" const ::$proto_ns$::Message& from) {\n"
|
||||
" static_cast<$classname$ *>(to)->MergeFrom(\n"
|
||||
" static_cast<const $classname$ &>(from));\n"
|
||||
"}\n"
|
||||
"\n");
|
||||
} else {
|
||||
// Generate CheckTypeAndMergeFrom().
|
||||
@ -3183,17 +3180,29 @@ void MessageGenerator::GenerateMergeFrom(io::Printer* printer) {
|
||||
}
|
||||
}
|
||||
|
||||
void MessageGenerator::GenerateClassSpecificMergeFrom(io::Printer* printer) {
|
||||
void MessageGenerator::GenerateClassSpecificMergeImpl(io::Printer* printer) {
|
||||
if (HasSimpleBaseClass(descriptor_, options_)) return;
|
||||
// Generate the class-specific MergeFrom, which avoids the GOOGLE_CHECK and cast.
|
||||
Formatter format(printer, variables_);
|
||||
if (!HasDescriptorMethods(descriptor_->file(), options_)) {
|
||||
// For messages that don't inherit from Message, just implement MergeFrom
|
||||
// directly.
|
||||
format(
|
||||
"void $classname$::MergeFrom(const $classname$& from) {\n"
|
||||
" $classname$* const _this = this;\n");
|
||||
} else {
|
||||
format(
|
||||
"void $classname$::MergeImpl(::$proto_ns$::Message& to_msg, const "
|
||||
"::$proto_ns$::Message& from_msg) {\n"
|
||||
" auto* const _this = static_cast<$classname$*>(&to_msg);\n"
|
||||
" auto& from = static_cast<const $classname$&>(from_msg);\n");
|
||||
}
|
||||
format.Indent();
|
||||
format(
|
||||
"void $classname$::MergeFrom(const $classname$& from) {\n"
|
||||
"$annotate_mergefrom$"
|
||||
"// @@protoc_insertion_point(class_specific_merge_from_start:"
|
||||
"$full_name$)\n"
|
||||
" $DCHK$_NE(&from, this);\n");
|
||||
format.Indent();
|
||||
"$full_name$)\n");
|
||||
format("$DCHK$_NE(&from, _this);\n");
|
||||
|
||||
format(
|
||||
"$uint32$ cached_has_bits = 0;\n"
|
||||
@ -3295,7 +3304,8 @@ void MessageGenerator::GenerateClassSpecificMergeFrom(io::Printer* printer) {
|
||||
if (deferred_has_bit_changes) {
|
||||
// Flush the has bits for the primitives we deferred.
|
||||
GOOGLE_CHECK_LE(0, cached_has_word_index);
|
||||
format("$has_bits$[$1$] |= cached_has_bits;\n", cached_has_word_index);
|
||||
format("_this->$has_bits$[$1$] |= cached_has_bits;\n",
|
||||
cached_has_word_index);
|
||||
}
|
||||
|
||||
format.Outdent();
|
||||
@ -3332,7 +3342,7 @@ void MessageGenerator::GenerateClassSpecificMergeFrom(io::Printer* printer) {
|
||||
}
|
||||
if (num_weak_fields_) {
|
||||
format(
|
||||
"$weak_field_map$.MergeFrom(from.$weak_field_map$);"
|
||||
"_this->$weak_field_map$.MergeFrom(from.$weak_field_map$);"
|
||||
"\n");
|
||||
}
|
||||
|
||||
@ -3340,12 +3350,13 @@ void MessageGenerator::GenerateClassSpecificMergeFrom(io::Printer* printer) {
|
||||
// the opportunity for tail calls.
|
||||
if (descriptor_->extension_range_count() > 0) {
|
||||
format(
|
||||
"$extensions$.MergeFrom(internal_default_instance(), "
|
||||
"_this->$extensions$.MergeFrom(internal_default_instance(), "
|
||||
"from.$extensions$);\n");
|
||||
}
|
||||
|
||||
format(
|
||||
"_internal_metadata_.MergeFrom<$unknown_fields_type$>(from._internal_"
|
||||
"_this->_internal_metadata_.MergeFrom<$unknown_fields_type$>(from._"
|
||||
"internal_"
|
||||
"metadata_);\n");
|
||||
|
||||
format.Outdent();
|
||||
@ -3388,7 +3399,7 @@ void MessageGenerator::GenerateCopyFrom(io::Printer* printer) {
|
||||
// has changed after Clear.
|
||||
format("#ifndef NDEBUG\n");
|
||||
if (HasDescriptorMethods(descriptor_->file(), options_)) {
|
||||
format("FailIfCopyFromDescendant(this, from);\n");
|
||||
format("FailIfCopyFromDescendant(*this, from);\n");
|
||||
} else {
|
||||
format("size_t from_size = from.ByteSizeLong();\n");
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ class MessageGenerator {
|
||||
void GenerateSerializeWithCachedSizesBodyShuffled(io::Printer* printer);
|
||||
void GenerateByteSize(io::Printer* printer);
|
||||
void GenerateMergeFrom(io::Printer* printer);
|
||||
void GenerateClassSpecificMergeFrom(io::Printer* printer);
|
||||
void GenerateClassSpecificMergeImpl(io::Printer* printer);
|
||||
void GenerateCopyFrom(io::Printer* printer);
|
||||
void GenerateSwap(io::Printer* printer);
|
||||
void GenerateIsInitialized(io::Printer* printer);
|
||||
|
@ -406,12 +406,12 @@ void MessageFieldGenerator::GenerateMergingCode(io::Printer* printer) const {
|
||||
Formatter format(printer, variables_);
|
||||
if (implicit_weak_field_) {
|
||||
format(
|
||||
"_Internal::mutable_$name$(this)->CheckTypeAndMergeFrom(\n"
|
||||
"_Internal::mutable_$name$(_this)->CheckTypeAndMergeFrom(\n"
|
||||
" _Internal::$name$(&from));\n");
|
||||
} else {
|
||||
format(
|
||||
"_internal_mutable_$name$()->$type$::MergeFrom(from._internal_$name$())"
|
||||
";\n");
|
||||
"_this->_internal_mutable_$name$()->$type$::MergeFrom(\n"
|
||||
" from._internal_$name$());\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -444,7 +444,7 @@ void MessageFieldGenerator::GenerateCopyConstructorCode(
|
||||
Formatter format(printer, variables_);
|
||||
format(
|
||||
"if (from._internal_has_$name$()) {\n"
|
||||
" $field$ = new $type$(*from.$field$);\n"
|
||||
" _this->$field$ = new $type$(*from.$field$);\n"
|
||||
"}\n");
|
||||
}
|
||||
|
||||
@ -831,7 +831,7 @@ void RepeatedMessageFieldGenerator::GenerateMergingCode(
|
||||
GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_));
|
||||
|
||||
Formatter format(printer, variables_);
|
||||
format("$field$.MergeFrom(from.$field$);\n");
|
||||
format("_this->$field$.MergeFrom(from.$field$);\n");
|
||||
}
|
||||
|
||||
void RepeatedMessageFieldGenerator::GenerateSwappingCode(
|
||||
|
@ -178,7 +178,7 @@ void PrimitiveFieldGenerator::GenerateClearingCode(io::Printer* printer) const {
|
||||
|
||||
void PrimitiveFieldGenerator::GenerateMergingCode(io::Printer* printer) const {
|
||||
Formatter format(printer, variables_);
|
||||
format("_internal_set_$name$(from._internal_$name$());\n");
|
||||
format("_this->_internal_set_$name$(from._internal_$name$());\n");
|
||||
}
|
||||
|
||||
void PrimitiveFieldGenerator::GenerateSwappingCode(io::Printer* printer) const {
|
||||
@ -189,7 +189,7 @@ void PrimitiveFieldGenerator::GenerateSwappingCode(io::Printer* printer) const {
|
||||
void PrimitiveFieldGenerator::GenerateCopyConstructorCode(
|
||||
io::Printer* printer) const {
|
||||
Formatter format(printer, variables_);
|
||||
format("$field$ = from.$field$;\n");
|
||||
format("_this->$field$ = from.$field$;\n");
|
||||
}
|
||||
|
||||
void PrimitiveFieldGenerator::GenerateSerializeWithCachedSizesToArray(
|
||||
@ -404,7 +404,7 @@ void RepeatedPrimitiveFieldGenerator::GenerateClearingCode(
|
||||
void RepeatedPrimitiveFieldGenerator::GenerateMergingCode(
|
||||
io::Printer* printer) const {
|
||||
Formatter format(printer, variables_);
|
||||
format("$field$.MergeFrom(from.$field$);\n");
|
||||
format("_this->$field$.MergeFrom(from.$field$);\n");
|
||||
}
|
||||
|
||||
void RepeatedPrimitiveFieldGenerator::GenerateSwappingCode(
|
||||
|
@ -403,7 +403,7 @@ void StringFieldGenerator::GenerateMessageClearingCode(
|
||||
void StringFieldGenerator::GenerateMergingCode(io::Printer* printer) const {
|
||||
Formatter format(printer, variables_);
|
||||
// TODO(gpike): improve this
|
||||
format("_internal_set_$name$(from._internal_$name$());\n");
|
||||
format("_this->_internal_set_$name$(from._internal_$name$());\n");
|
||||
}
|
||||
|
||||
void StringFieldGenerator::GenerateSwappingCode(io::Printer* printer) const {
|
||||
@ -445,7 +445,7 @@ void StringFieldGenerator::GenerateCopyConstructorCode(
|
||||
Formatter format(printer, variables_);
|
||||
GenerateConstructorCode(printer);
|
||||
if (inlined_) {
|
||||
format("new (&$field$) ::_pbi::InlinedStringField();\n");
|
||||
format("new (&_this->$field$) ::_pbi::InlinedStringField();\n");
|
||||
}
|
||||
|
||||
if (HasHasbit(descriptor_)) {
|
||||
@ -458,13 +458,13 @@ void StringFieldGenerator::GenerateCopyConstructorCode(
|
||||
|
||||
if (!inlined_) {
|
||||
format(
|
||||
"$field$.Set(from._internal_$name$(), \n"
|
||||
" GetArenaForAllocation());\n");
|
||||
"_this->$field$.Set(from._internal_$name$(), \n"
|
||||
" _this->GetArenaForAllocation());\n");
|
||||
} else {
|
||||
format(
|
||||
"$field$.Set(from._internal_$name$(),\n"
|
||||
" GetArenaForAllocation(), _internal_$name$_donated(), "
|
||||
"&$donating_states_word$, $mask_for_undonate$, this);\n");
|
||||
"_this->$field$.Set(from._internal_$name$(),\n"
|
||||
" _this->GetArenaForAllocation(), _this->_internal_$name$_donated(), "
|
||||
"&_this->$donating_states_word$, $mask_for_undonate$, _this);\n");
|
||||
}
|
||||
|
||||
format.Outdent();
|
||||
@ -874,7 +874,7 @@ void RepeatedStringFieldGenerator::GenerateClearingCode(
|
||||
void RepeatedStringFieldGenerator::GenerateMergingCode(
|
||||
io::Printer* printer) const {
|
||||
Formatter format(printer, variables_);
|
||||
format("$field$.MergeFrom(from.$field$);\n");
|
||||
format("_this->$field$.MergeFrom(from.$field$);\n");
|
||||
}
|
||||
|
||||
void RepeatedStringFieldGenerator::GenerateSwappingCode(
|
||||
|
@ -35,9 +35,6 @@
|
||||
#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_LITE_H__
|
||||
#define GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_LITE_H__
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/compiler/java/field.h>
|
||||
#include <google/protobuf/compiler/java/message.h>
|
||||
|
||||
|
@ -256,6 +256,7 @@ Version::Version(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
Version::Version(const Version& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
Version* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_._has_bits_){from._impl_._has_bits_}
|
||||
, /*decltype(_impl_._cached_size_)*/{}
|
||||
@ -270,8 +271,8 @@ Version::Version(const Version& from)
|
||||
_impl_.suffix_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (from._internal_has_suffix()) {
|
||||
_impl_.suffix_.Set(from._internal_suffix(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.suffix_.Set(from._internal_suffix(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
::memcpy(&_impl_.major_, &from._impl_.major_,
|
||||
static_cast<size_t>(reinterpret_cast<char*>(&_impl_.patch_) -
|
||||
@ -489,36 +490,32 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Version::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Version::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void Version::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<Version *>(to)->MergeFrom(
|
||||
static_cast<const Version &>(from));
|
||||
}
|
||||
|
||||
|
||||
void Version::MergeFrom(const Version& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.Version)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void Version::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<Version*>(&to_msg);
|
||||
auto& from = static_cast<const Version&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.Version)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
cached_has_bits = from._impl_._has_bits_[0];
|
||||
if (cached_has_bits & 0x0000000fu) {
|
||||
if (cached_has_bits & 0x00000001u) {
|
||||
_internal_set_suffix(from._internal_suffix());
|
||||
_this->_internal_set_suffix(from._internal_suffix());
|
||||
}
|
||||
if (cached_has_bits & 0x00000002u) {
|
||||
_impl_.major_ = from._impl_.major_;
|
||||
_this->_impl_.major_ = from._impl_.major_;
|
||||
}
|
||||
if (cached_has_bits & 0x00000004u) {
|
||||
_impl_.minor_ = from._impl_.minor_;
|
||||
_this->_impl_.minor_ = from._impl_.minor_;
|
||||
}
|
||||
if (cached_has_bits & 0x00000008u) {
|
||||
_impl_.patch_ = from._impl_.patch_;
|
||||
_this->_impl_.patch_ = from._impl_.patch_;
|
||||
}
|
||||
_impl_._has_bits_[0] |= cached_has_bits;
|
||||
_this->_impl_._has_bits_[0] |= cached_has_bits;
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void Version::CopyFrom(const Version& from) {
|
||||
@ -585,6 +582,7 @@ CodeGeneratorRequest::CodeGeneratorRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena
|
||||
}
|
||||
CodeGeneratorRequest::CodeGeneratorRequest(const CodeGeneratorRequest& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
CodeGeneratorRequest* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_._has_bits_){from._impl_._has_bits_}
|
||||
, /*decltype(_impl_._cached_size_)*/{}
|
||||
@ -599,11 +597,11 @@ CodeGeneratorRequest::CodeGeneratorRequest(const CodeGeneratorRequest& from)
|
||||
_impl_.parameter_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (from._internal_has_parameter()) {
|
||||
_impl_.parameter_.Set(from._internal_parameter(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.parameter_.Set(from._internal_parameter(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
if (from._internal_has_compiler_version()) {
|
||||
_impl_.compiler_version_ = new ::PROTOBUF_NAMESPACE_ID::compiler::Version(*from._impl_.compiler_version_);
|
||||
_this->_impl_.compiler_version_ = new ::PROTOBUF_NAMESPACE_ID::compiler::Version(*from._impl_.compiler_version_);
|
||||
}
|
||||
// @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorRequest)
|
||||
}
|
||||
@ -849,31 +847,28 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData CodeGeneratorRequest::_class_d
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*CodeGeneratorRequest::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void CodeGeneratorRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<CodeGeneratorRequest *>(to)->MergeFrom(
|
||||
static_cast<const CodeGeneratorRequest &>(from));
|
||||
}
|
||||
|
||||
|
||||
void CodeGeneratorRequest::MergeFrom(const CodeGeneratorRequest& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorRequest)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void CodeGeneratorRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<CodeGeneratorRequest*>(&to_msg);
|
||||
auto& from = static_cast<const CodeGeneratorRequest&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorRequest)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
_impl_.file_to_generate_.MergeFrom(from._impl_.file_to_generate_);
|
||||
_impl_.proto_file_.MergeFrom(from._impl_.proto_file_);
|
||||
_this->_impl_.file_to_generate_.MergeFrom(from._impl_.file_to_generate_);
|
||||
_this->_impl_.proto_file_.MergeFrom(from._impl_.proto_file_);
|
||||
cached_has_bits = from._impl_._has_bits_[0];
|
||||
if (cached_has_bits & 0x00000003u) {
|
||||
if (cached_has_bits & 0x00000001u) {
|
||||
_internal_set_parameter(from._internal_parameter());
|
||||
_this->_internal_set_parameter(from._internal_parameter());
|
||||
}
|
||||
if (cached_has_bits & 0x00000002u) {
|
||||
_internal_mutable_compiler_version()->::PROTOBUF_NAMESPACE_ID::compiler::Version::MergeFrom(from._internal_compiler_version());
|
||||
_this->_internal_mutable_compiler_version()->::PROTOBUF_NAMESPACE_ID::compiler::Version::MergeFrom(
|
||||
from._internal_compiler_version());
|
||||
}
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void CodeGeneratorRequest::CopyFrom(const CodeGeneratorRequest& from) {
|
||||
@ -946,6 +941,7 @@ CodeGeneratorResponse_File::CodeGeneratorResponse_File(::PROTOBUF_NAMESPACE_ID::
|
||||
}
|
||||
CodeGeneratorResponse_File::CodeGeneratorResponse_File(const CodeGeneratorResponse_File& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
CodeGeneratorResponse_File* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_._has_bits_){from._impl_._has_bits_}
|
||||
, /*decltype(_impl_._cached_size_)*/{}
|
||||
@ -960,27 +956,27 @@ CodeGeneratorResponse_File::CodeGeneratorResponse_File(const CodeGeneratorRespon
|
||||
_impl_.name_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (from._internal_has_name()) {
|
||||
_impl_.name_.Set(from._internal_name(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.name_.Set(from._internal_name(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
_impl_.insertion_point_.InitDefault();
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
_impl_.insertion_point_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (from._internal_has_insertion_point()) {
|
||||
_impl_.insertion_point_.Set(from._internal_insertion_point(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.insertion_point_.Set(from._internal_insertion_point(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
_impl_.content_.InitDefault();
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
_impl_.content_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (from._internal_has_content()) {
|
||||
_impl_.content_.Set(from._internal_content(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.content_.Set(from._internal_content(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
if (from._internal_has_generated_code_info()) {
|
||||
_impl_.generated_code_info_ = new ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo(*from._impl_.generated_code_info_);
|
||||
_this->_impl_.generated_code_info_ = new ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo(*from._impl_.generated_code_info_);
|
||||
}
|
||||
// @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorResponse.File)
|
||||
}
|
||||
@ -1233,35 +1229,32 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData CodeGeneratorResponse_File::_c
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*CodeGeneratorResponse_File::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void CodeGeneratorResponse_File::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<CodeGeneratorResponse_File *>(to)->MergeFrom(
|
||||
static_cast<const CodeGeneratorResponse_File &>(from));
|
||||
}
|
||||
|
||||
|
||||
void CodeGeneratorResponse_File::MergeFrom(const CodeGeneratorResponse_File& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorResponse.File)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void CodeGeneratorResponse_File::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<CodeGeneratorResponse_File*>(&to_msg);
|
||||
auto& from = static_cast<const CodeGeneratorResponse_File&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorResponse.File)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
cached_has_bits = from._impl_._has_bits_[0];
|
||||
if (cached_has_bits & 0x0000000fu) {
|
||||
if (cached_has_bits & 0x00000001u) {
|
||||
_internal_set_name(from._internal_name());
|
||||
_this->_internal_set_name(from._internal_name());
|
||||
}
|
||||
if (cached_has_bits & 0x00000002u) {
|
||||
_internal_set_insertion_point(from._internal_insertion_point());
|
||||
_this->_internal_set_insertion_point(from._internal_insertion_point());
|
||||
}
|
||||
if (cached_has_bits & 0x00000004u) {
|
||||
_internal_set_content(from._internal_content());
|
||||
_this->_internal_set_content(from._internal_content());
|
||||
}
|
||||
if (cached_has_bits & 0x00000008u) {
|
||||
_internal_mutable_generated_code_info()->::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo::MergeFrom(from._internal_generated_code_info());
|
||||
_this->_internal_mutable_generated_code_info()->::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo::MergeFrom(
|
||||
from._internal_generated_code_info());
|
||||
}
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void CodeGeneratorResponse_File::CopyFrom(const CodeGeneratorResponse_File& from) {
|
||||
@ -1323,6 +1316,7 @@ CodeGeneratorResponse::CodeGeneratorResponse(::PROTOBUF_NAMESPACE_ID::Arena* are
|
||||
}
|
||||
CodeGeneratorResponse::CodeGeneratorResponse(const CodeGeneratorResponse& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
CodeGeneratorResponse* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_._has_bits_){from._impl_._has_bits_}
|
||||
, /*decltype(_impl_._cached_size_)*/{}
|
||||
@ -1336,10 +1330,10 @@ CodeGeneratorResponse::CodeGeneratorResponse(const CodeGeneratorResponse& from)
|
||||
_impl_.error_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (from._internal_has_error()) {
|
||||
_impl_.error_.Set(from._internal_error(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.error_.Set(from._internal_error(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
_impl_.supported_features_ = from._impl_.supported_features_;
|
||||
_this->_impl_.supported_features_ = from._impl_.supported_features_;
|
||||
// @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorResponse)
|
||||
}
|
||||
|
||||
@ -1538,31 +1532,27 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData CodeGeneratorResponse::_class_
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*CodeGeneratorResponse::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void CodeGeneratorResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<CodeGeneratorResponse *>(to)->MergeFrom(
|
||||
static_cast<const CodeGeneratorResponse &>(from));
|
||||
}
|
||||
|
||||
|
||||
void CodeGeneratorResponse::MergeFrom(const CodeGeneratorResponse& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorResponse)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void CodeGeneratorResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<CodeGeneratorResponse*>(&to_msg);
|
||||
auto& from = static_cast<const CodeGeneratorResponse&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorResponse)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
_impl_.file_.MergeFrom(from._impl_.file_);
|
||||
_this->_impl_.file_.MergeFrom(from._impl_.file_);
|
||||
cached_has_bits = from._impl_._has_bits_[0];
|
||||
if (cached_has_bits & 0x00000003u) {
|
||||
if (cached_has_bits & 0x00000001u) {
|
||||
_internal_set_error(from._internal_error());
|
||||
_this->_internal_set_error(from._internal_error());
|
||||
}
|
||||
if (cached_has_bits & 0x00000002u) {
|
||||
_impl_.supported_features_ = from._impl_.supported_features_;
|
||||
_this->_impl_.supported_features_ = from._impl_.supported_features_;
|
||||
}
|
||||
_impl_._has_bits_[0] |= cached_has_bits;
|
||||
_this->_impl_._has_bits_[0] |= cached_has_bits;
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void CodeGeneratorResponse::CopyFrom(const CodeGeneratorResponse& from) {
|
||||
|
@ -189,9 +189,11 @@ class PROTOC_EXPORT Version final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const Version& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const Version& from);
|
||||
void MergeFrom( const Version& from) {
|
||||
Version::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -397,9 +399,11 @@ class PROTOC_EXPORT CodeGeneratorRequest final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const CodeGeneratorRequest& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const CodeGeneratorRequest& from);
|
||||
void MergeFrom( const CodeGeneratorRequest& from) {
|
||||
CodeGeneratorRequest::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -626,9 +630,11 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const CodeGeneratorResponse_File& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const CodeGeneratorResponse_File& from);
|
||||
void MergeFrom( const CodeGeneratorResponse_File& from) {
|
||||
CodeGeneratorResponse_File::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -849,9 +855,11 @@ class PROTOC_EXPORT CodeGeneratorResponse final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const CodeGeneratorResponse& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const CodeGeneratorResponse& from);
|
||||
void MergeFrom( const CodeGeneratorResponse& from) {
|
||||
CodeGeneratorResponse::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
@ -167,7 +167,11 @@ bool Subprocess::Communicate(const Message& input, Message* output,
|
||||
|
||||
GOOGLE_CHECK(child_handle_ != nullptr) << "Must call Start() first.";
|
||||
|
||||
std::string input_data = input.SerializeAsString();
|
||||
std::string input_data;
|
||||
if (!input.SerializeToString(&input_data)) {
|
||||
*error = "Failed to serialize request.";
|
||||
return false;
|
||||
}
|
||||
std::string output_data;
|
||||
|
||||
int input_pos = 0;
|
||||
@ -369,7 +373,11 @@ bool Subprocess::Communicate(const Message& input, Message* output,
|
||||
// Make sure SIGPIPE is disabled so that if the child dies it doesn't kill us.
|
||||
SignalHandler* old_pipe_handler = signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
std::string input_data = input.SerializeAsString();
|
||||
std::string input_data;
|
||||
if (!input.SerializeToString(&input_data)) {
|
||||
*error = "Failed to serialize request.";
|
||||
return false;
|
||||
}
|
||||
std::string output_data;
|
||||
|
||||
int input_pos = 0;
|
||||
|
@ -3709,11 +3709,12 @@ class DescriptorBuilder {
|
||||
void RequestHintOnFieldNumbers(
|
||||
const Message& reason,
|
||||
DescriptorPool::ErrorCollector::ErrorLocation reason_location,
|
||||
int fields_count = 1) {
|
||||
constexpr int kMaxSuggestions = 3;
|
||||
int range_start = 0, int range_end = 1) {
|
||||
auto fit = [](int value) {
|
||||
return std::min(std::max(value, 0), FieldDescriptor::kMaxNumber);
|
||||
};
|
||||
fields_to_suggest =
|
||||
std::min(kMaxSuggestions,
|
||||
fields_to_suggest + std::min(kMaxSuggestions, fields_count));
|
||||
fit(fields_to_suggest + fit(fit(range_end) - fit(range_start)));
|
||||
if (first_reason) return;
|
||||
first_reason = &reason;
|
||||
first_reason_location = reason_location;
|
||||
@ -5825,8 +5826,8 @@ void DescriptorBuilder::BuildExtensionRange(
|
||||
result->end = proto.end();
|
||||
if (result->start <= 0) {
|
||||
message_hints_[parent].RequestHintOnFieldNumbers(
|
||||
proto, DescriptorPool::ErrorCollector::NUMBER,
|
||||
std::max(0, result->end - result->start));
|
||||
proto, DescriptorPool::ErrorCollector::NUMBER, result->start,
|
||||
result->end);
|
||||
AddError(parent->full_name(), proto, DescriptorPool::ErrorCollector::NUMBER,
|
||||
"Extension numbers must be positive integers.");
|
||||
}
|
||||
@ -5865,8 +5866,8 @@ void DescriptorBuilder::BuildReservedRange(
|
||||
result->end = proto.end();
|
||||
if (result->start <= 0) {
|
||||
message_hints_[parent].RequestHintOnFieldNumbers(
|
||||
proto, DescriptorPool::ErrorCollector::NUMBER,
|
||||
std::max(0, result->end - result->start));
|
||||
proto, DescriptorPool::ErrorCollector::NUMBER, result->start,
|
||||
result->end);
|
||||
AddError(parent->full_name(), proto, DescriptorPool::ErrorCollector::NUMBER,
|
||||
"Reserved numbers must be positive integers.");
|
||||
}
|
||||
@ -6709,7 +6710,8 @@ void DescriptorBuilder::SuggestFieldNumbers(FileDescriptor* file,
|
||||
const Descriptor* message = &file->message_types_[message_index];
|
||||
auto* hints = FindOrNull(message_hints_, message);
|
||||
if (!hints) continue;
|
||||
int fields_to_suggest = hints->fields_to_suggest;
|
||||
constexpr int kMaxSuggestions = 3;
|
||||
int fields_to_suggest = std::min(kMaxSuggestions, hints->fields_to_suggest);
|
||||
if (fields_to_suggest <= 0) continue;
|
||||
struct Range {
|
||||
int from;
|
||||
@ -6717,18 +6719,18 @@ void DescriptorBuilder::SuggestFieldNumbers(FileDescriptor* file,
|
||||
};
|
||||
std::vector<Range> used_ordinals;
|
||||
auto add_ordinal = [&](int ordinal) {
|
||||
if (ordinal <= 0 || ordinal > FieldDescriptor::kMaxNumber) return;
|
||||
if (!used_ordinals.empty() &&
|
||||
used_ordinals.back().to < FieldDescriptor::kMaxNumber &&
|
||||
ordinal == used_ordinals.back().to + 1) {
|
||||
used_ordinals.back().to = ordinal;
|
||||
ordinal == used_ordinals.back().to) {
|
||||
used_ordinals.back().to = ordinal + 1;
|
||||
} else {
|
||||
used_ordinals.push_back({ordinal, ordinal});
|
||||
used_ordinals.push_back({ordinal, ordinal + 1});
|
||||
}
|
||||
};
|
||||
auto add_range = [&](int from, int to) {
|
||||
from = std::max(0, std::min(FieldDescriptor::kMaxNumber, from));
|
||||
to = std::max(0, std::min(FieldDescriptor::kMaxNumber, to));
|
||||
if (from > to) return;
|
||||
from = std::max(0, std::min(FieldDescriptor::kMaxNumber + 1, from));
|
||||
to = std::max(0, std::min(FieldDescriptor::kMaxNumber + 1, to));
|
||||
if (from >= to) return;
|
||||
used_ordinals.push_back({from, to});
|
||||
};
|
||||
for (int i = 0; i < message->field_count(); i++) {
|
||||
@ -6739,14 +6741,14 @@ void DescriptorBuilder::SuggestFieldNumbers(FileDescriptor* file,
|
||||
}
|
||||
for (int i = 0; i < message->reserved_range_count(); i++) {
|
||||
auto range = message->reserved_range(i);
|
||||
add_range(range->start, range->end - 1);
|
||||
add_range(range->start, range->end);
|
||||
}
|
||||
for (int i = 0; i < message->extension_range_count(); i++) {
|
||||
auto range = message->extension_range(i);
|
||||
add_range(range->start, range->end - 1);
|
||||
add_range(range->start, range->end);
|
||||
}
|
||||
used_ordinals.push_back(
|
||||
{FieldDescriptor::kMaxNumber, std::numeric_limits<int>::max()});
|
||||
{FieldDescriptor::kMaxNumber, FieldDescriptor::kMaxNumber + 1});
|
||||
used_ordinals.push_back({FieldDescriptor::kFirstReservedNumber,
|
||||
FieldDescriptor::kLastReservedNumber});
|
||||
std::sort(used_ordinals.begin(), used_ordinals.end(),
|
||||
@ -6764,7 +6766,7 @@ void DescriptorBuilder::SuggestFieldNumbers(FileDescriptor* file,
|
||||
fields_to_suggest--;
|
||||
}
|
||||
if (fields_to_suggest == 0) break;
|
||||
current_ordinal = std::max(current_ordinal, current_range.to + 1);
|
||||
current_ordinal = std::max(current_ordinal, current_range.to);
|
||||
}
|
||||
if (hints->first_reason) {
|
||||
AddError(message->full_name(), *hints->first_reason,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -407,9 +407,11 @@ class PROTOBUF_EXPORT FileDescriptorSet final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const FileDescriptorSet& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const FileDescriptorSet& from);
|
||||
void MergeFrom( const FileDescriptorSet& from) {
|
||||
FileDescriptorSet::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -569,9 +571,11 @@ class PROTOBUF_EXPORT FileDescriptorProto final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const FileDescriptorProto& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const FileDescriptorProto& from);
|
||||
void MergeFrom( const FileDescriptorProto& from) {
|
||||
FileDescriptorProto::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -966,9 +970,11 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const DescriptorProto_ExtensionRange& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const DescriptorProto_ExtensionRange& from);
|
||||
void MergeFrom( const DescriptorProto_ExtensionRange& from) {
|
||||
DescriptorProto_ExtensionRange::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -1159,9 +1165,11 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const DescriptorProto_ReservedRange& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const DescriptorProto_ReservedRange& from);
|
||||
void MergeFrom( const DescriptorProto_ReservedRange& from) {
|
||||
DescriptorProto_ReservedRange::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -1332,9 +1340,11 @@ class PROTOBUF_EXPORT DescriptorProto final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const DescriptorProto& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const DescriptorProto& from);
|
||||
void MergeFrom( const DescriptorProto& from) {
|
||||
DescriptorProto::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -1684,9 +1694,11 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const ExtensionRangeOptions& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const ExtensionRangeOptions& from);
|
||||
void MergeFrom( const ExtensionRangeOptions& from) {
|
||||
ExtensionRangeOptions::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -2038,9 +2050,11 @@ class PROTOBUF_EXPORT FieldDescriptorProto final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const FieldDescriptorProto& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const FieldDescriptorProto& from);
|
||||
void MergeFrom( const FieldDescriptorProto& from) {
|
||||
FieldDescriptorProto::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -2470,9 +2484,11 @@ class PROTOBUF_EXPORT OneofDescriptorProto final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const OneofDescriptorProto& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const OneofDescriptorProto& from);
|
||||
void MergeFrom( const OneofDescriptorProto& from) {
|
||||
OneofDescriptorProto::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -2653,9 +2669,11 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const EnumDescriptorProto_EnumReservedRange& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const EnumDescriptorProto_EnumReservedRange& from);
|
||||
void MergeFrom( const EnumDescriptorProto_EnumReservedRange& from) {
|
||||
EnumDescriptorProto_EnumReservedRange::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -2826,9 +2844,11 @@ class PROTOBUF_EXPORT EnumDescriptorProto final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const EnumDescriptorProto& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const EnumDescriptorProto& from);
|
||||
void MergeFrom( const EnumDescriptorProto& from) {
|
||||
EnumDescriptorProto::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -3077,9 +3097,11 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const EnumValueDescriptorProto& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const EnumValueDescriptorProto& from);
|
||||
void MergeFrom( const EnumValueDescriptorProto& from) {
|
||||
EnumValueDescriptorProto::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -3275,9 +3297,11 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const ServiceDescriptorProto& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const ServiceDescriptorProto& from);
|
||||
void MergeFrom( const ServiceDescriptorProto& from) {
|
||||
ServiceDescriptorProto::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -3478,9 +3502,11 @@ class PROTOBUF_EXPORT MethodDescriptorProto final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const MethodDescriptorProto& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const MethodDescriptorProto& from);
|
||||
void MergeFrom( const MethodDescriptorProto& from) {
|
||||
MethodDescriptorProto::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -3731,9 +3757,11 @@ class PROTOBUF_EXPORT FileOptions final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const FileOptions& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const FileOptions& from);
|
||||
void MergeFrom( const FileOptions& from) {
|
||||
FileOptions::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -4468,9 +4496,11 @@ class PROTOBUF_EXPORT MessageOptions final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const MessageOptions& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const MessageOptions& from);
|
||||
void MergeFrom( const MessageOptions& from) {
|
||||
MessageOptions::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -4883,9 +4913,11 @@ class PROTOBUF_EXPORT FieldOptions final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const FieldOptions& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const FieldOptions& from);
|
||||
void MergeFrom( const FieldOptions& from) {
|
||||
FieldOptions::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -5407,9 +5439,11 @@ class PROTOBUF_EXPORT OneofOptions final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const OneofOptions& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const OneofOptions& from);
|
||||
void MergeFrom( const OneofOptions& from) {
|
||||
OneofOptions::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -5761,9 +5795,11 @@ class PROTOBUF_EXPORT EnumOptions final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const EnumOptions& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const EnumOptions& from);
|
||||
void MergeFrom( const EnumOptions& from) {
|
||||
EnumOptions::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -6146,9 +6182,11 @@ class PROTOBUF_EXPORT EnumValueOptions final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const EnumValueOptions& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const EnumValueOptions& from);
|
||||
void MergeFrom( const EnumValueOptions& from) {
|
||||
EnumValueOptions::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -6516,9 +6554,11 @@ class PROTOBUF_EXPORT ServiceOptions final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const ServiceOptions& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const ServiceOptions& from);
|
||||
void MergeFrom( const ServiceOptions& from) {
|
||||
ServiceOptions::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -6886,9 +6926,11 @@ class PROTOBUF_EXPORT MethodOptions final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const MethodOptions& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const MethodOptions& from);
|
||||
void MergeFrom( const MethodOptions& from) {
|
||||
MethodOptions::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -7303,9 +7345,11 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const UninterpretedOption_NamePart& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const UninterpretedOption_NamePart& from);
|
||||
void MergeFrom( const UninterpretedOption_NamePart& from) {
|
||||
UninterpretedOption_NamePart::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -7484,9 +7528,11 @@ class PROTOBUF_EXPORT UninterpretedOption final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const UninterpretedOption& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const UninterpretedOption& from);
|
||||
void MergeFrom( const UninterpretedOption& from) {
|
||||
UninterpretedOption::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -7754,9 +7800,11 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const SourceCodeInfo_Location& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const SourceCodeInfo_Location& from);
|
||||
void MergeFrom( const SourceCodeInfo_Location& from) {
|
||||
SourceCodeInfo_Location::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -8013,9 +8061,11 @@ class PROTOBUF_EXPORT SourceCodeInfo final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const SourceCodeInfo& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const SourceCodeInfo& from);
|
||||
void MergeFrom( const SourceCodeInfo& from) {
|
||||
SourceCodeInfo::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -8177,9 +8227,11 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const GeneratedCodeInfo_Annotation& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const GeneratedCodeInfo_Annotation& from);
|
||||
void MergeFrom( const GeneratedCodeInfo_Annotation& from) {
|
||||
GeneratedCodeInfo_Annotation::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -8395,9 +8447,11 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const GeneratedCodeInfo& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const GeneratedCodeInfo& from);
|
||||
void MergeFrom( const GeneratedCodeInfo& from) {
|
||||
GeneratedCodeInfo::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
@ -4721,8 +4721,7 @@ TEST_F(ValidationErrorTest, NegativeExtensionRangeNumber) {
|
||||
" extension_range { start: -10 end: -1 }"
|
||||
"}",
|
||||
|
||||
"foo.proto: Foo: NUMBER: Extension numbers must be positive integers.\n"
|
||||
"foo.proto: Foo: NUMBER: Suggested field numbers for Foo: 1, 2, 3\n");
|
||||
"foo.proto: Foo: NUMBER: Extension numbers must be positive integers.\n");
|
||||
}
|
||||
|
||||
TEST_F(ValidationErrorTest, HugeExtensionRangeNumber) {
|
||||
|
@ -97,6 +97,7 @@ Duration::Duration(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
Duration::Duration(const Duration& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
Duration* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.seconds_){}
|
||||
, decltype(_impl_.nanos_){}
|
||||
@ -247,26 +248,22 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Duration::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Duration::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void Duration::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<Duration *>(to)->MergeFrom(
|
||||
static_cast<const Duration &>(from));
|
||||
}
|
||||
|
||||
|
||||
void Duration::MergeFrom(const Duration& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Duration)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void Duration::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<Duration*>(&to_msg);
|
||||
auto& from = static_cast<const Duration&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Duration)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
if (from._internal_seconds() != 0) {
|
||||
_internal_set_seconds(from._internal_seconds());
|
||||
_this->_internal_set_seconds(from._internal_seconds());
|
||||
}
|
||||
if (from._internal_nanos() != 0) {
|
||||
_internal_set_nanos(from._internal_nanos());
|
||||
_this->_internal_set_nanos(from._internal_nanos());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void Duration::CopyFrom(const Duration& from) {
|
||||
|
@ -136,9 +136,11 @@ class PROTOBUF_EXPORT Duration final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const Duration& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const Duration& from);
|
||||
void MergeFrom( const Duration& from) {
|
||||
Duration::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
@ -90,6 +90,7 @@ Empty::Empty(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
Empty::Empty(const Empty& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase() {
|
||||
Empty* const _this = this; (void)_this;
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
// @@protoc_insertion_point(copy_constructor:google.protobuf.Empty)
|
||||
}
|
||||
|
@ -135,11 +135,11 @@ class PROTOBUF_EXPORT Empty final :
|
||||
}
|
||||
using ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::CopyFrom;
|
||||
inline void CopyFrom(const Empty& from) {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::CopyImpl(this, from);
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::CopyImpl(*this, from);
|
||||
}
|
||||
using ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::MergeFrom;
|
||||
void MergeFrom(const Empty& from) {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::MergeImpl(this, from);
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::MergeImpl(*this, from);
|
||||
}
|
||||
public:
|
||||
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#include <google/protobuf/dynamic_message.h>
|
||||
#include <google/protobuf/extension_set.h>
|
||||
#include <google/protobuf/text_format.h>
|
||||
#include <google/protobuf/wire_format.h>
|
||||
#include <google/protobuf/testing/googletest.h>
|
||||
#include <gtest/gtest.h>
|
||||
@ -1285,6 +1286,8 @@ TEST(ExtensionSetTest, DynamicExtensions) {
|
||||
}
|
||||
|
||||
// Can we print it?
|
||||
std::string message_text;
|
||||
TextFormat::PrintToString(message, &message_text);
|
||||
EXPECT_EQ(
|
||||
"[dynamic_extensions.scalar_extension]: 123\n"
|
||||
"[dynamic_extensions.enum_extension]: FOREIGN_BAR\n"
|
||||
@ -1303,7 +1306,7 @@ TEST(ExtensionSetTest, DynamicExtensions) {
|
||||
"[dynamic_extensions.packed_extension]: -78\n"
|
||||
"2002: 12345\n"
|
||||
"54321: \"unknown\"\n",
|
||||
message.DebugString());
|
||||
message_text);
|
||||
|
||||
// Can we serialize it?
|
||||
EXPECT_TRUE(
|
||||
|
@ -95,6 +95,7 @@ FieldMask::FieldMask(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
FieldMask::FieldMask(const FieldMask& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
FieldMask* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.paths_){from._impl_.paths_}
|
||||
, /*decltype(_impl_._cached_size_)*/{}};
|
||||
@ -234,21 +235,17 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData FieldMask::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*FieldMask::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void FieldMask::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<FieldMask *>(to)->MergeFrom(
|
||||
static_cast<const FieldMask &>(from));
|
||||
}
|
||||
|
||||
|
||||
void FieldMask::MergeFrom(const FieldMask& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FieldMask)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void FieldMask::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<FieldMask*>(&to_msg);
|
||||
auto& from = static_cast<const FieldMask&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FieldMask)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
_impl_.paths_.MergeFrom(from._impl_.paths_);
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_impl_.paths_.MergeFrom(from._impl_.paths_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void FieldMask::CopyFrom(const FieldMask& from) {
|
||||
|
@ -136,9 +136,11 @@ class PROTOBUF_EXPORT FieldMask final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const FieldMask& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const FieldMask& from);
|
||||
void MergeFrom( const FieldMask& from) {
|
||||
FieldMask::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
@ -98,15 +98,15 @@ failure:
|
||||
return target;
|
||||
}
|
||||
|
||||
void ZeroFieldsBase::MergeImpl(Message* to_param, const Message& from_param) {
|
||||
auto* to = static_cast<ZeroFieldsBase*>(to_param);
|
||||
void ZeroFieldsBase::MergeImpl(Message& to_param, const Message& from_param) {
|
||||
auto* to = static_cast<ZeroFieldsBase*>(&to_param);
|
||||
const auto* from = static_cast<const ZeroFieldsBase*>(&from_param);
|
||||
GOOGLE_DCHECK_NE(from, to);
|
||||
to->_internal_metadata_.MergeFrom<UnknownFieldSet>(from->_internal_metadata_);
|
||||
}
|
||||
|
||||
void ZeroFieldsBase::CopyImpl(Message* to_param, const Message& from_param) {
|
||||
auto* to = static_cast<ZeroFieldsBase*>(to_param);
|
||||
void ZeroFieldsBase::CopyImpl(Message& to_param, const Message& from_param) {
|
||||
auto* to = static_cast<ZeroFieldsBase*>(&to_param);
|
||||
const auto* from = static_cast<const ZeroFieldsBase*>(&from_param);
|
||||
if (from == to) return;
|
||||
to->_internal_metadata_.Clear<UnknownFieldSet>();
|
||||
|
@ -71,8 +71,8 @@ class PROTOBUF_EXPORT ZeroFieldsBase : public Message {
|
||||
|
||||
void SetCachedSize(int size) const final { _cached_size_.Set(size); }
|
||||
|
||||
static void MergeImpl(Message* to, const Message& from);
|
||||
static void CopyImpl(Message* to, const Message& from);
|
||||
static void MergeImpl(Message& to, const Message& from);
|
||||
static void CopyImpl(Message& to, const Message& from);
|
||||
void InternalSwap(ZeroFieldsBase* other);
|
||||
|
||||
mutable internal::CachedSize _cached_size_;
|
||||
|
@ -3111,10 +3111,10 @@ void UnknownFieldSetSerializer(const uint8_t* base, uint32_t offset,
|
||||
}
|
||||
}
|
||||
|
||||
bool IsDescendant(Message* root, const Message& message) {
|
||||
const Reflection* reflection = root->GetReflection();
|
||||
bool IsDescendant(Message& root, const Message& message) {
|
||||
const Reflection* reflection = root.GetReflection();
|
||||
std::vector<const FieldDescriptor*> fields;
|
||||
reflection->ListFieldsOmitStripped(*root, &fields);
|
||||
reflection->ListFieldsOmitStripped(root, &fields);
|
||||
|
||||
for (const auto* field : fields) {
|
||||
// Skip non-message fields.
|
||||
@ -3122,8 +3122,8 @@ bool IsDescendant(Message* root, const Message& message) {
|
||||
|
||||
// Optional messages.
|
||||
if (!field->is_repeated()) {
|
||||
Message* sub_message = reflection->MutableMessage(root, field);
|
||||
if (sub_message == &message || IsDescendant(sub_message, message)) {
|
||||
Message* sub_message = reflection->MutableMessage(&root, field);
|
||||
if (sub_message == &message || IsDescendant(*sub_message, message)) {
|
||||
return true;
|
||||
}
|
||||
continue;
|
||||
@ -3131,11 +3131,11 @@ bool IsDescendant(Message* root, const Message& message) {
|
||||
|
||||
// Repeated messages.
|
||||
if (!IsMapFieldInApi(field)) {
|
||||
int count = reflection->FieldSize(*root, field);
|
||||
int count = reflection->FieldSize(root, field);
|
||||
for (int i = 0; i < count; i++) {
|
||||
Message* sub_message =
|
||||
reflection->MutableRepeatedMessage(root, field, i);
|
||||
if (sub_message == &message || IsDescendant(sub_message, message)) {
|
||||
reflection->MutableRepeatedMessage(&root, field, i);
|
||||
if (sub_message == &message || IsDescendant(*sub_message, message)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -3149,10 +3149,10 @@ bool IsDescendant(Message* root, const Message& message) {
|
||||
// Skip map fields whose value type is not message.
|
||||
if (val_field->cpp_type() != FieldDescriptor::CPPTYPE_MESSAGE) continue;
|
||||
|
||||
MapIterator end = reflection->MapEnd(root, field);
|
||||
for (auto iter = reflection->MapBegin(root, field); iter != end; ++iter) {
|
||||
MapIterator end = reflection->MapEnd(&root, field);
|
||||
for (auto iter = reflection->MapBegin(&root, field); iter != end; ++iter) {
|
||||
Message* sub_message = iter.MutableValueRef()->MutableMessageValue();
|
||||
if (sub_message == &message || IsDescendant(sub_message, message)) {
|
||||
if (sub_message == &message || IsDescendant(*sub_message, message)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -38,9 +38,6 @@
|
||||
#ifndef GOOGLE_PROTOBUF_GENERATED_MESSAGE_REFLECTION_H__
|
||||
#define GOOGLE_PROTOBUF_GENERATED_MESSAGE_REFLECTION_H__
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <google/protobuf/stubs/casts.h>
|
||||
#include <google/protobuf/stubs/common.h>
|
||||
#include <google/protobuf/stubs/once.h>
|
||||
|
@ -1315,11 +1315,11 @@ TEST(GeneratedMessageReflection, IsDescendantMessage) {
|
||||
TestUtil::SetAllFields(&msg1);
|
||||
msg2 = msg1;
|
||||
|
||||
EXPECT_TRUE(IsDescendant(&msg1, msg1.optional_nested_message()));
|
||||
EXPECT_TRUE(IsDescendant(&msg1, msg1.repeated_foreign_message(0)));
|
||||
EXPECT_TRUE(IsDescendant(msg1, msg1.optional_nested_message()));
|
||||
EXPECT_TRUE(IsDescendant(msg1, msg1.repeated_foreign_message(0)));
|
||||
|
||||
EXPECT_FALSE(IsDescendant(&msg1, msg2.optional_nested_message()));
|
||||
EXPECT_FALSE(IsDescendant(&msg1, msg2.repeated_foreign_message(0)));
|
||||
EXPECT_FALSE(IsDescendant(msg1, msg2.optional_nested_message()));
|
||||
EXPECT_FALSE(IsDescendant(msg1, msg2.repeated_foreign_message(0)));
|
||||
}
|
||||
|
||||
TEST(GeneratedMessageReflection, IsDescendantMap) {
|
||||
@ -1328,11 +1328,11 @@ TEST(GeneratedMessageReflection, IsDescendantMap) {
|
||||
TestUtil::SetAllFields(&(*msg1.mutable_map_int32_all_types())[0]);
|
||||
msg2 = msg1;
|
||||
|
||||
EXPECT_TRUE(IsDescendant(&msg1, msg1.map_int32_foreign_message().at(0)));
|
||||
EXPECT_TRUE(IsDescendant(&msg1, msg1.map_int32_all_types().at(0)));
|
||||
EXPECT_TRUE(IsDescendant(msg1, msg1.map_int32_foreign_message().at(0)));
|
||||
EXPECT_TRUE(IsDescendant(msg1, msg1.map_int32_all_types().at(0)));
|
||||
|
||||
EXPECT_FALSE(IsDescendant(&msg1, msg2.map_int32_foreign_message().at(0)));
|
||||
EXPECT_FALSE(IsDescendant(&msg1, msg2.map_int32_all_types().at(0)));
|
||||
EXPECT_FALSE(IsDescendant(msg1, msg2.map_int32_foreign_message().at(0)));
|
||||
EXPECT_FALSE(IsDescendant(msg1, msg2.map_int32_all_types().at(0)));
|
||||
}
|
||||
|
||||
TEST(GeneratedMessageReflection, IsDescendantExtension) {
|
||||
@ -1341,15 +1341,15 @@ TEST(GeneratedMessageReflection, IsDescendantExtension) {
|
||||
msg2 = msg1;
|
||||
|
||||
EXPECT_TRUE(IsDescendant(
|
||||
&msg1, msg1.GetExtension(unittest::optional_nested_message_extension)));
|
||||
msg1, msg1.GetExtension(unittest::optional_nested_message_extension)));
|
||||
EXPECT_TRUE(IsDescendant(
|
||||
&msg1,
|
||||
msg1,
|
||||
msg1.GetExtension(unittest::repeated_foreign_message_extension, 0)));
|
||||
|
||||
EXPECT_FALSE(IsDescendant(
|
||||
&msg1, msg2.GetExtension(unittest::optional_nested_message_extension)));
|
||||
msg1, msg2.GetExtension(unittest::optional_nested_message_extension)));
|
||||
EXPECT_FALSE(IsDescendant(
|
||||
&msg1,
|
||||
msg1,
|
||||
msg2.GetExtension(unittest::repeated_foreign_message_extension, 0)));
|
||||
}
|
||||
|
||||
@ -1358,15 +1358,14 @@ TEST(GeneratedMessageReflection, IsDescendantOneof) {
|
||||
TestUtil::SetAllFields(msg1.mutable_foo_message());
|
||||
msg2 = msg1;
|
||||
|
||||
EXPECT_TRUE(IsDescendant(msg1, msg1.foo_message().optional_nested_message()));
|
||||
EXPECT_TRUE(
|
||||
IsDescendant(&msg1, msg1.foo_message().optional_nested_message()));
|
||||
EXPECT_TRUE(
|
||||
IsDescendant(&msg1, msg1.foo_message().repeated_foreign_message(0)));
|
||||
IsDescendant(msg1, msg1.foo_message().repeated_foreign_message(0)));
|
||||
|
||||
EXPECT_FALSE(
|
||||
IsDescendant(&msg1, msg2.foo_message().optional_nested_message()));
|
||||
IsDescendant(msg1, msg2.foo_message().optional_nested_message()));
|
||||
EXPECT_FALSE(
|
||||
IsDescendant(&msg1, msg2.foo_message().repeated_foreign_message(0)));
|
||||
IsDescendant(msg1, msg2.foo_message().repeated_foreign_message(0)));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -108,8 +108,6 @@
|
||||
#define GOOGLE_PROTOBUF_IO_ZERO_COPY_STREAM_H__
|
||||
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/stubs/common.h>
|
||||
|
||||
|
||||
|
@ -692,40 +692,30 @@ class Map {
|
||||
return FindHelper(k).first;
|
||||
}
|
||||
|
||||
// Insert the key into the map, if not present. In that case, the value will
|
||||
// be value initialized.
|
||||
// Inserts a new element into the container if there is no element with the
|
||||
// key in the container.
|
||||
// The new element is:
|
||||
// (1) Constructed in-place with the given args, if mapped_type is not
|
||||
// arena constructible.
|
||||
// (2) Constructed in-place with the arena and then assigned with a
|
||||
// mapped_type temporary constructed with the given args, otherwise.
|
||||
template <typename K, typename... Args>
|
||||
std::pair<iterator, bool> try_emplace(K&& k, Args&&... args) {
|
||||
return ArenaAwareTryEmplace(Arena::is_arena_constructable<mapped_type>(),
|
||||
std::forward<K>(k),
|
||||
std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
// Inserts the key into the map, if not present. In that case, the value
|
||||
// will be value initialized.
|
||||
template <typename K>
|
||||
std::pair<iterator, bool> insert(K&& k) {
|
||||
std::pair<const_iterator, size_type> p = FindHelper(k);
|
||||
// Case 1: key was already present.
|
||||
if (p.first.node_ != nullptr)
|
||||
return std::make_pair(iterator(p.first), false);
|
||||
// Case 2: insert.
|
||||
if (ResizeIfLoadIsOutOfRange(num_elements_ + 1)) {
|
||||
p = FindHelper(k);
|
||||
}
|
||||
const size_type b = p.second; // bucket number
|
||||
// If K is not key_type, make the conversion to key_type explicit.
|
||||
using TypeToInit = typename std::conditional<
|
||||
std::is_same<typename std::decay<K>::type, key_type>::value, K&&,
|
||||
key_type>::type;
|
||||
Node* node = Alloc<Node>(1);
|
||||
// Even when arena is nullptr, CreateInArenaStorage is still used to
|
||||
// ensure the arena of submessage will be consistent. Otherwise,
|
||||
// submessage may have its own arena when message-owned arena is enabled.
|
||||
Arena::CreateInArenaStorage(const_cast<Key*>(&node->kv.first),
|
||||
alloc_.arena(),
|
||||
static_cast<TypeToInit>(std::forward<K>(k)));
|
||||
Arena::CreateInArenaStorage(&node->kv.second, alloc_.arena());
|
||||
|
||||
iterator result = InsertUnique(b, node);
|
||||
++num_elements_;
|
||||
return std::make_pair(result, true);
|
||||
return try_emplace(std::forward<K>(k));
|
||||
}
|
||||
|
||||
template <typename K>
|
||||
value_type& operator[](K&& k) {
|
||||
return *insert(std::forward<K>(k)).first;
|
||||
return *try_emplace(std::forward<K>(k)).first;
|
||||
}
|
||||
|
||||
void erase(iterator it) {
|
||||
@ -767,6 +757,79 @@ class Map {
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename K, typename... Args>
|
||||
std::pair<iterator, bool> TryEmplaceInternal(K&& k, Args&&... args) {
|
||||
std::pair<const_iterator, size_type> p = FindHelper(k);
|
||||
// Case 1: key was already present.
|
||||
if (p.first.node_ != nullptr)
|
||||
return std::make_pair(iterator(p.first), false);
|
||||
// Case 2: insert.
|
||||
if (ResizeIfLoadIsOutOfRange(num_elements_ + 1)) {
|
||||
p = FindHelper(k);
|
||||
}
|
||||
const size_type b = p.second; // bucket number
|
||||
// If K is not key_type, make the conversion to key_type explicit.
|
||||
using TypeToInit = typename std::conditional<
|
||||
std::is_same<typename std::decay<K>::type, key_type>::value, K&&,
|
||||
key_type>::type;
|
||||
Node* node = Alloc<Node>(1);
|
||||
// Even when arena is nullptr, CreateInArenaStorage is still used to
|
||||
// ensure the arena of submessage will be consistent. Otherwise,
|
||||
// submessage may have its own arena when message-owned arena is enabled.
|
||||
// Note: This only works if `Key` is not arena constructible.
|
||||
Arena::CreateInArenaStorage(const_cast<Key*>(&node->kv.first),
|
||||
alloc_.arena(),
|
||||
static_cast<TypeToInit>(std::forward<K>(k)));
|
||||
// Note: if `T` is arena constructible, `Args` needs to be empty.
|
||||
Arena::CreateInArenaStorage(&node->kv.second, alloc_.arena(),
|
||||
std::forward<Args>(args)...);
|
||||
|
||||
iterator result = InsertUnique(b, node);
|
||||
++num_elements_;
|
||||
return std::make_pair(result, true);
|
||||
}
|
||||
|
||||
// A helper function to perform an assignment of `mapped_type`.
|
||||
// If the first argument is true, then it is a regular assignment.
|
||||
// Otherwise, we first create a temporary and then perform an assignment.
|
||||
template <typename V>
|
||||
static void AssignMapped(std::true_type, mapped_type& mapped, V&& v) {
|
||||
mapped = std::forward<V>(v);
|
||||
}
|
||||
template <typename... Args>
|
||||
static void AssignMapped(std::false_type, mapped_type& mapped,
|
||||
Args&&... args) {
|
||||
mapped = mapped_type(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
// Case 1: `mapped_type` is arena constructible. A temporary object is
|
||||
// created and then (if `Args` are not empty) assigned to a mapped value
|
||||
// that was created with the arena.
|
||||
template <typename K>
|
||||
std::pair<iterator, bool> ArenaAwareTryEmplace(std::true_type, K&& k) {
|
||||
// case 1.1: "default" constructed (e.g. from arena only).
|
||||
return TryEmplaceInternal(std::forward<K>(k));
|
||||
}
|
||||
template <typename K, typename... Args>
|
||||
std::pair<iterator, bool> ArenaAwareTryEmplace(std::true_type, K&& k,
|
||||
Args&&... args) {
|
||||
// case 1.2: "default" constructed + copy/move assignment
|
||||
auto p = TryEmplaceInternal(std::forward<K>(k));
|
||||
if (p.second) {
|
||||
AssignMapped(std::is_same<void(typename std::decay<Args>::type...),
|
||||
void(mapped_type)>(),
|
||||
p.first->second, std::forward<Args>(args)...);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
// Case 2: `mapped_type` is not arena constructible. Using in-place
|
||||
// construction.
|
||||
template <typename... Args>
|
||||
std::pair<iterator, bool> ArenaAwareTryEmplace(std::false_type,
|
||||
Args&&... args) {
|
||||
return TryEmplaceInternal(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
const_iterator find(const Key& k, TreeIterator* it) const {
|
||||
return FindHelper(k, it).first;
|
||||
}
|
||||
@ -1282,14 +1345,22 @@ class Map {
|
||||
}
|
||||
|
||||
// insert
|
||||
std::pair<iterator, bool> insert(const value_type& value) {
|
||||
std::pair<typename InnerMap::iterator, bool> p =
|
||||
elements_.insert(value.first);
|
||||
if (p.second) {
|
||||
p.first->second = value.second;
|
||||
}
|
||||
template <typename K, typename... Args>
|
||||
std::pair<iterator, bool> try_emplace(K&& k, Args&&... args) {
|
||||
auto p =
|
||||
elements_.try_emplace(std::forward<K>(k), std::forward<Args>(args)...);
|
||||
return std::pair<iterator, bool>(iterator(p.first), p.second);
|
||||
}
|
||||
std::pair<iterator, bool> insert(const value_type& value) {
|
||||
return try_emplace(value.first, value.second);
|
||||
}
|
||||
std::pair<iterator, bool> insert(value_type&& value) {
|
||||
return try_emplace(value.first, std::move(value.second));
|
||||
}
|
||||
template <typename... Args>
|
||||
std::pair<iterator, bool> emplace(Args&&... args) {
|
||||
return insert(value_type(std::forward<Args>(args)...));
|
||||
}
|
||||
template <class InputIt>
|
||||
void insert(InputIt first, InputIt last) {
|
||||
for (InputIt it = first; it != last; ++it) {
|
||||
|
@ -687,12 +687,37 @@ TEST_F(MapImplTest, IteratorCategory) {
|
||||
Map<int, int>::const_iterator>::iterator_category()));
|
||||
}
|
||||
|
||||
TEST_F(MapImplTest, InsertSingle) {
|
||||
TEST_F(MapImplTest, InsertSingleLValue) {
|
||||
int32_t key = 0;
|
||||
int32_t value1 = 100;
|
||||
int32_t value2 = 101;
|
||||
|
||||
// Insert a non-existed key.
|
||||
// Insert a non-existing key.
|
||||
Map<int32_t, int32_t>::value_type v1(key, value1);
|
||||
std::pair<Map<int32_t, int32_t>::iterator, bool> result1 = map_.insert(v1);
|
||||
ExpectSingleElement(key, value1);
|
||||
|
||||
Map<int32_t, int32_t>::iterator it1 = result1.first;
|
||||
EXPECT_EQ(key, it1->first);
|
||||
EXPECT_EQ(value1, it1->second);
|
||||
EXPECT_TRUE(result1.second);
|
||||
|
||||
// Insert an existing key.
|
||||
Map<int32_t, int32_t>::value_type v2(key, value2);
|
||||
std::pair<Map<int32_t, int32_t>::iterator, bool> result2 = map_.insert(v2);
|
||||
ExpectSingleElement(key, value1);
|
||||
|
||||
Map<int32_t, int32_t>::iterator it2 = result2.first;
|
||||
EXPECT_TRUE(it1 == it2);
|
||||
EXPECT_FALSE(result2.second);
|
||||
}
|
||||
|
||||
TEST_F(MapImplTest, InsertSingleRValue) {
|
||||
int32_t key = 0;
|
||||
int32_t value1 = 100;
|
||||
int32_t value2 = 101;
|
||||
|
||||
// Insert a non-existing key.
|
||||
std::pair<Map<int32_t, int32_t>::iterator, bool> result1 =
|
||||
map_.insert(Map<int32_t, int32_t>::value_type(key, value1));
|
||||
ExpectSingleElement(key, value1);
|
||||
@ -702,7 +727,7 @@ TEST_F(MapImplTest, InsertSingle) {
|
||||
EXPECT_EQ(value1, it1->second);
|
||||
EXPECT_TRUE(result1.second);
|
||||
|
||||
// Insert an existed key.
|
||||
// Insert an existing key.
|
||||
std::pair<Map<int32_t, int32_t>::iterator, bool> result2 =
|
||||
map_.insert(Map<int32_t, int32_t>::value_type(key, value2));
|
||||
ExpectSingleElement(key, value1);
|
||||
@ -712,6 +737,167 @@ TEST_F(MapImplTest, InsertSingle) {
|
||||
EXPECT_FALSE(result2.second);
|
||||
}
|
||||
|
||||
TEST_F(MapImplTest, TryEmplace) {
|
||||
using ::testing::Pair;
|
||||
using ::testing::UnorderedElementsAre;
|
||||
|
||||
Map<int32_t, std::string> m;
|
||||
|
||||
m.try_emplace(1, "one");
|
||||
EXPECT_EQ(m.size(), 1);
|
||||
|
||||
const int32_t key = 42;
|
||||
m.try_emplace(key, 3, 'a');
|
||||
m.try_emplace(2, std::string("two"));
|
||||
EXPECT_THAT(
|
||||
m, UnorderedElementsAre(Pair(1, "one"), Pair(2, "two"), Pair(42, "aaa")));
|
||||
}
|
||||
|
||||
TEST_F(MapImplTest, Emplace) {
|
||||
using ::testing::Pair;
|
||||
using ::testing::UnorderedElementsAre;
|
||||
|
||||
Map<int32_t, std::string> m;
|
||||
|
||||
m.emplace(1, "one");
|
||||
EXPECT_EQ(m.size(), 1);
|
||||
|
||||
const int32_t key = 42;
|
||||
m.emplace(key, "aaa");
|
||||
m.emplace(2, std::string("two"));
|
||||
EXPECT_THAT(
|
||||
m, UnorderedElementsAre(Pair(1, "one"), Pair(2, "two"), Pair(42, "aaa")));
|
||||
}
|
||||
|
||||
struct CountedInstance {
|
||||
CountedInstance() { ++num_created; }
|
||||
CountedInstance(const CountedInstance&) : CountedInstance() {}
|
||||
CountedInstance(CountedInstance&&) : CountedInstance() {}
|
||||
|
||||
CountedInstance& operator=(const CountedInstance&) {
|
||||
++num_assigned;
|
||||
return *this;
|
||||
}
|
||||
|
||||
explicit CountedInstance(int x) : CountedInstance() {}
|
||||
|
||||
static int num_created;
|
||||
static int num_assigned;
|
||||
};
|
||||
|
||||
int CountedInstance::num_created = 0;
|
||||
int CountedInstance::num_assigned = 0;
|
||||
|
||||
TEST_F(MapImplTest, TryEmplaceExisting) {
|
||||
Map<int32_t, CountedInstance> m;
|
||||
|
||||
m.try_emplace(1, 1);
|
||||
ASSERT_EQ(m.size(), 1);
|
||||
|
||||
CountedInstance::num_created = 0;
|
||||
CountedInstance::num_assigned = 0;
|
||||
m.try_emplace(1, 123);
|
||||
EXPECT_EQ(m.size(), 1);
|
||||
EXPECT_EQ(CountedInstance::num_created, 0);
|
||||
EXPECT_EQ(CountedInstance::num_assigned, 0);
|
||||
}
|
||||
|
||||
struct ArenaConstructible {
|
||||
using InternalArenaConstructable_ = void;
|
||||
using DestructorSkippable_ = void;
|
||||
|
||||
ArenaConstructible() = default;
|
||||
ArenaConstructible(const ArenaConstructible&) = default;
|
||||
ArenaConstructible(Arena*) : ArenaConstructible() {}
|
||||
|
||||
ArenaConstructible& operator=(const ArenaConstructible&) = default;
|
||||
|
||||
explicit ArenaConstructible(int) : ArenaConstructible() {}
|
||||
|
||||
Arena* arena() const { return nullptr; }
|
||||
|
||||
CountedInstance unused;
|
||||
};
|
||||
|
||||
TEST_F(MapImplTest, TryEmplaceArenaConstructible) {
|
||||
ASSERT_TRUE(Arena::is_arena_constructable<ArenaConstructible>::value);
|
||||
|
||||
ArenaConstructible v1, v2;
|
||||
|
||||
Map<int32_t, ArenaConstructible> m;
|
||||
|
||||
// "default" construction
|
||||
CountedInstance::num_created = 0;
|
||||
CountedInstance::num_assigned = 0;
|
||||
m.try_emplace(1);
|
||||
EXPECT_EQ(m.size(), 1);
|
||||
EXPECT_EQ(CountedInstance::num_created, 1);
|
||||
EXPECT_EQ(CountedInstance::num_assigned, 0);
|
||||
|
||||
// "default" construction + copy assignment
|
||||
CountedInstance::num_created = 0;
|
||||
CountedInstance::num_assigned = 0;
|
||||
m.try_emplace(2, v1);
|
||||
EXPECT_EQ(m.size(), 2);
|
||||
EXPECT_EQ(CountedInstance::num_created, 1);
|
||||
EXPECT_EQ(CountedInstance::num_assigned, 1);
|
||||
|
||||
// "default" construction + move assignment
|
||||
CountedInstance::num_created = 0;
|
||||
CountedInstance::num_assigned = 0;
|
||||
m.try_emplace(3, std::move(v2));
|
||||
EXPECT_EQ(m.size(), 3);
|
||||
EXPECT_EQ(CountedInstance::num_created, 1);
|
||||
EXPECT_EQ(CountedInstance::num_assigned, 1);
|
||||
|
||||
// "default" construction + in-place temporary + move assignment
|
||||
CountedInstance::num_created = 0;
|
||||
CountedInstance::num_assigned = 0;
|
||||
m.try_emplace(4, 239);
|
||||
EXPECT_EQ(m.size(), 4);
|
||||
EXPECT_EQ(CountedInstance::num_created, 2);
|
||||
EXPECT_EQ(CountedInstance::num_assigned, 1);
|
||||
}
|
||||
|
||||
TEST_F(MapImplTest, TryEmplaceExistingArenaConstructible) {
|
||||
ASSERT_TRUE(Arena::is_arena_constructable<ArenaConstructible>::value);
|
||||
|
||||
Map<int32_t, ArenaConstructible> m;
|
||||
|
||||
m.try_emplace(1, 1);
|
||||
ASSERT_EQ(m.size(), 1);
|
||||
|
||||
CountedInstance::num_created = 0;
|
||||
CountedInstance::num_assigned = 0;
|
||||
m.try_emplace(1, 123);
|
||||
EXPECT_EQ(m.size(), 1);
|
||||
EXPECT_EQ(CountedInstance::num_created, 0);
|
||||
EXPECT_EQ(CountedInstance::num_assigned, 0);
|
||||
}
|
||||
|
||||
TEST_F(MapImplTest, EmplaceSingle) {
|
||||
int32_t key = 0;
|
||||
int32_t value1 = 100;
|
||||
int32_t value2 = 101;
|
||||
|
||||
// Emplace a non-existing key.
|
||||
auto result1 = map_.emplace(key, value1);
|
||||
ExpectSingleElement(key, value1);
|
||||
|
||||
Map<int32_t, int32_t>::iterator it1 = result1.first;
|
||||
EXPECT_EQ(key, it1->first);
|
||||
EXPECT_EQ(value1, it1->second);
|
||||
EXPECT_TRUE(result1.second);
|
||||
|
||||
// Emplace an existing key.
|
||||
auto result2 = map_.emplace(key, value2);
|
||||
ExpectSingleElement(key, value1);
|
||||
|
||||
Map<int32_t, int32_t>::iterator it2 = result2.first;
|
||||
EXPECT_TRUE(it1 == it2);
|
||||
EXPECT_FALSE(result2.second);
|
||||
}
|
||||
|
||||
TEST_F(MapImplTest, InsertByIterator) {
|
||||
int32_t key1 = 0;
|
||||
int32_t key2 = 1;
|
||||
@ -3610,7 +3796,9 @@ TEST(TextFormatMapTest, DynamicMessage) {
|
||||
&expected_text, true));
|
||||
|
||||
CleanStringLineEndings(&expected_text, false);
|
||||
EXPECT_EQ(message->DebugString(), expected_text);
|
||||
std::string actual_text;
|
||||
TextFormat::PrintToString(*message, &actual_text);
|
||||
EXPECT_EQ(actual_text, expected_text);
|
||||
}
|
||||
|
||||
TEST(TextFormatMapTest, Sorted) {
|
||||
|
@ -84,11 +84,11 @@ void Message::MergeFrom(const Message& from) {
|
||||
auto* class_from = from.GetClassData();
|
||||
auto* merge_to_from = class_to ? class_to->merge_to_from : nullptr;
|
||||
if (class_to == nullptr || class_to != class_from) {
|
||||
merge_to_from = [](Message* to, const Message& from) {
|
||||
ReflectionOps::Merge(from, to);
|
||||
merge_to_from = [](Message& to, const Message& from) {
|
||||
ReflectionOps::Merge(from, &to);
|
||||
};
|
||||
}
|
||||
merge_to_from(this, from);
|
||||
merge_to_from(*this, from);
|
||||
}
|
||||
|
||||
void Message::CheckTypeAndMergeFrom(const MessageLite& other) {
|
||||
@ -111,24 +111,24 @@ void Message::CopyFrom(const Message& from) {
|
||||
<< ", "
|
||||
"from: "
|
||||
<< from.GetDescriptor()->full_name();
|
||||
copy_to_from = [](Message* to, const Message& from) {
|
||||
ReflectionOps::Copy(from, to);
|
||||
copy_to_from = [](Message& to, const Message& from) {
|
||||
ReflectionOps::Copy(from, &to);
|
||||
};
|
||||
}
|
||||
copy_to_from(this, from);
|
||||
copy_to_from(*this, from);
|
||||
}
|
||||
|
||||
void Message::CopyWithSourceCheck(Message* to, const Message& from) {
|
||||
void Message::CopyWithSourceCheck(Message& to, const Message& from) {
|
||||
#ifndef NDEBUG
|
||||
FailIfCopyFromDescendant(to, from);
|
||||
#endif
|
||||
to->Clear();
|
||||
to->GetClassData()->merge_to_from(to, from);
|
||||
to.Clear();
|
||||
to.GetClassData()->merge_to_from(to, from);
|
||||
}
|
||||
|
||||
void Message::FailIfCopyFromDescendant(Message* to, const Message& from) {
|
||||
auto* arena = to->GetArenaForAllocation();
|
||||
bool same_message_owned_arena = to->GetOwningArena() == nullptr &&
|
||||
void Message::FailIfCopyFromDescendant(Message& to, const Message& from) {
|
||||
auto* arena = to.GetArenaForAllocation();
|
||||
bool same_message_owned_arena = to.GetOwningArena() == nullptr &&
|
||||
arena != nullptr &&
|
||||
arena == from.GetOwningArena();
|
||||
GOOGLE_CHECK(!same_message_owned_arena && !internal::IsDescendant(to, from))
|
||||
|
@ -221,7 +221,7 @@ const To& GetConstRefAtOffset(const Message& message, uint32_t offset) {
|
||||
bool CreateUnknownEnumValues(const FieldDescriptor* field);
|
||||
|
||||
// Returns true if "message" is a descendant of "root".
|
||||
PROTOBUF_EXPORT bool IsDescendant(Message* root, const Message& message);
|
||||
PROTOBUF_EXPORT bool IsDescendant(Message& root, const Message& message);
|
||||
} // namespace internal
|
||||
|
||||
// Abstract interface for protocol messages.
|
||||
@ -371,8 +371,8 @@ class PROTOBUF_EXPORT Message : public MessageLite {
|
||||
// Note: The order of arguments (to, then from) is chosen so that the ABI
|
||||
// of this function is the same as the CopyFrom method. That is, the
|
||||
// hidden "this" parameter comes first.
|
||||
void (*copy_to_from)(Message* to, const Message& from_msg);
|
||||
void (*merge_to_from)(Message* to, const Message& from_msg);
|
||||
void (*copy_to_from)(Message& to, const Message& from_msg);
|
||||
void (*merge_to_from)(Message& to, const Message& from_msg);
|
||||
};
|
||||
// GetClassData() returns a pointer to a ClassData struct which
|
||||
// exists in global memory and is unique to each subclass. This uniqueness
|
||||
@ -385,10 +385,10 @@ class PROTOBUF_EXPORT Message : public MessageLite {
|
||||
// builds, checks that calling Clear() on the destination message doesn't
|
||||
// alter the source. It assumes the messages are known to be of the same
|
||||
// type, and thus uses GetClassData().
|
||||
static void CopyWithSourceCheck(Message* to, const Message& from);
|
||||
static void CopyWithSourceCheck(Message& to, const Message& from);
|
||||
|
||||
// Fail if "from" is a descendant of "to" as such copy is not allowed.
|
||||
static void FailIfCopyFromDescendant(Message* to, const Message& from);
|
||||
static void FailIfCopyFromDescendant(Message& to, const Message& from);
|
||||
|
||||
inline explicit Message(Arena* arena, bool is_message_owned = false)
|
||||
: MessageLite(arena, is_message_owned) {}
|
||||
@ -1030,7 +1030,7 @@ class PROTOBUF_EXPORT Reflection final {
|
||||
bool IsEagerlyVerifiedLazyField(const FieldDescriptor* field) const;
|
||||
|
||||
friend class FastReflectionMessageMutator;
|
||||
friend bool internal::IsDescendant(Message* root, const Message& message);
|
||||
friend bool internal::IsDescendant(Message& root, const Message& message);
|
||||
|
||||
const Descriptor* const descriptor_;
|
||||
const internal::ReflectionSchema schema_;
|
||||
|
@ -658,14 +658,14 @@ const char* ReadTagInlined(const char* ptr, uint32_t* out) {
|
||||
// If bit 15 of return value is set (equivalent to the continuation bits of both
|
||||
// bytes being set) the varint continues, otherwise the parse is done. On x86
|
||||
// movsx eax, dil
|
||||
// add edi, eax
|
||||
// and edi, eax
|
||||
// add eax, edi
|
||||
// adc [rsi], 1
|
||||
// add eax, eax
|
||||
// and eax, edi
|
||||
inline uint32_t DecodeTwoBytes(const char** ptr) {
|
||||
uint32_t value = UnalignedLoad<uint16_t>(*ptr);
|
||||
// Sign extend the low byte continuation bit
|
||||
uint32_t x = static_cast<int8_t>(value);
|
||||
value &= x; // Mask out the high byte iff no continuation
|
||||
// This add is an amazing operation, it cancels the low byte continuation bit
|
||||
// from y transferring it to the carry. Simultaneously it also shifts the 7
|
||||
// LSB left by one tightly against high byte varint bits. Hence value now
|
||||
@ -673,7 +673,7 @@ inline uint32_t DecodeTwoBytes(const char** ptr) {
|
||||
value += x;
|
||||
// Use the carry to update the ptr appropriately.
|
||||
*ptr += value < x ? 2 : 1;
|
||||
return value & (x + x); // Mask out the high byte iff no continuation
|
||||
return value;
|
||||
}
|
||||
|
||||
// More efficient varint parsing for big varints
|
||||
|
@ -874,9 +874,7 @@
|
||||
#undef DEBUG
|
||||
#endif // defined(__clang__) || PROTOBUF_GNUC_MIN(3, 0) || defined(_MSC_VER)
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#elif PROTOBUF_GNUC_MIN(3, 0)
|
||||
#if PROTOBUF_GNUC_MIN(3, 0)
|
||||
// GCC does not allow disabling diagnostics within an expression:
|
||||
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60875, so we disable this one
|
||||
// globally even though it's only used for PROTOBUF_FIELD_OFFSET.
|
||||
|
@ -150,9 +150,7 @@
|
||||
#pragma pop_macro("DEBUG")
|
||||
#endif // defined(__clang__) || defined(__GNUC__) || defined(_MSC_VER)
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#elif defined(__GNUC__)
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
@ -547,7 +547,7 @@ RepeatedField<Element>::~RepeatedField() {
|
||||
#ifndef NDEBUG
|
||||
// Try to trigger segfault / asan failure in non-opt builds if arena_
|
||||
// lifetime has ended before the destructor.
|
||||
auto arena = GetArena();
|
||||
auto arena = GetOwningArena();
|
||||
if (arena) (void)arena->SpaceAllocated();
|
||||
#endif
|
||||
if (total_size_ > 0) {
|
||||
@ -571,7 +571,7 @@ inline RepeatedField<Element>::RepeatedField(RepeatedField&& other) noexcept
|
||||
// We don't just call Swap(&other) here because it would perform 3 copies if
|
||||
// other is on an arena. This field can't be on an arena because arena
|
||||
// construction always uses the Arena* accepting constructor.
|
||||
if (other.GetArena()) {
|
||||
if (other.GetOwningArena()) {
|
||||
CopyFrom(other);
|
||||
} else {
|
||||
InternalSwap(&other);
|
||||
@ -585,9 +585,9 @@ inline RepeatedField<Element>& RepeatedField<Element>::operator=(
|
||||
// We don't just call Swap(&other) here because it would perform 3 copies if
|
||||
// the two fields are on different arenas.
|
||||
if (this != &other) {
|
||||
if (GetArena() != other.GetArena()
|
||||
if (GetOwningArena() != other.GetOwningArena()
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
|| GetArena() == nullptr
|
||||
|| GetOwningArena() == nullptr
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
) {
|
||||
CopyFrom(other);
|
||||
@ -831,13 +831,14 @@ template <typename Element>
|
||||
void RepeatedField<Element>::Swap(RepeatedField* other) {
|
||||
if (this == other) return;
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetArena() != nullptr && GetArena() == other->GetArena()) {
|
||||
if (GetOwningArena() != nullptr &&
|
||||
GetOwningArena() == other->GetOwningArena()) {
|
||||
#else // PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetArena() == other->GetArena()) {
|
||||
if (GetOwningArena() == other->GetOwningArena()) {
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
InternalSwap(other);
|
||||
} else {
|
||||
RepeatedField<Element> temp(other->GetArena());
|
||||
RepeatedField<Element> temp(other->GetOwningArena());
|
||||
temp.MergeFrom(*this);
|
||||
CopyFrom(*other);
|
||||
other->UnsafeArenaSwap(&temp);
|
||||
@ -847,7 +848,7 @@ void RepeatedField<Element>::Swap(RepeatedField* other) {
|
||||
template <typename Element>
|
||||
void RepeatedField<Element>::UnsafeArenaSwap(RepeatedField* other) {
|
||||
if (this == other) return;
|
||||
GOOGLE_DCHECK_EQ(GetArena(), other->GetArena());
|
||||
GOOGLE_DCHECK_EQ(GetOwningArena(), other->GetOwningArena());
|
||||
InternalSwap(other);
|
||||
}
|
||||
|
||||
@ -928,7 +929,7 @@ void RepeatedField<Element>::Reserve(int new_size) {
|
||||
if (total_size_ >= new_size) return;
|
||||
Rep* old_rep = total_size_ > 0 ? rep() : nullptr;
|
||||
Rep* new_rep;
|
||||
Arena* arena = GetArena();
|
||||
Arena* arena = GetOwningArena();
|
||||
|
||||
new_size = internal::CalculateReserveSize<Element, kRepHeaderSize>(
|
||||
total_size_, new_size);
|
||||
|
@ -56,7 +56,7 @@ void** RepeatedPtrFieldBase::InternalExtend(int extend_amount) {
|
||||
return &rep_->elements[current_size_];
|
||||
}
|
||||
Rep* old_rep = rep_;
|
||||
Arena* arena = GetArena();
|
||||
Arena* arena = GetOwningArena();
|
||||
new_size = internal::CalculateReserveSize<void*, kRepHeaderSize>(total_size_,
|
||||
new_size);
|
||||
GOOGLE_CHECK_LE(static_cast<int64_t>(new_size),
|
||||
|
@ -367,9 +367,10 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase {
|
||||
template <typename TypeHandler>
|
||||
PROTOBUF_NDEBUG_INLINE void Swap(RepeatedPtrFieldBase* other) {
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetArena() != nullptr && GetArena() == other->GetArena())
|
||||
if (GetOwningArena() != nullptr &&
|
||||
GetOwningArena() == other->GetOwningArena())
|
||||
#else // PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetArena() == other->GetArena())
|
||||
if (GetOwningArena() == other->GetOwningArena())
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
{
|
||||
InternalSwap(other);
|
||||
@ -470,8 +471,8 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase {
|
||||
|
||||
template <typename TypeHandler>
|
||||
void AddCleared(typename TypeHandler::Type* value) {
|
||||
GOOGLE_DCHECK(GetArena() == nullptr) << "AddCleared() can only be used on a "
|
||||
"RepeatedPtrField not on an arena.";
|
||||
GOOGLE_DCHECK(GetOwningArena() == nullptr) << "AddCleared() can only be used on a "
|
||||
"RepeatedPtrField not on an arena.";
|
||||
GOOGLE_DCHECK(TypeHandler::GetOwningArena(value) == nullptr)
|
||||
<< "AddCleared() can only accept values not on an arena.";
|
||||
if (!rep_ || rep_->allocated_size == total_size_) {
|
||||
@ -482,10 +483,10 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase {
|
||||
|
||||
template <typename TypeHandler>
|
||||
PROTOBUF_NODISCARD typename TypeHandler::Type* ReleaseCleared() {
|
||||
GOOGLE_DCHECK(GetArena() == nullptr)
|
||||
GOOGLE_DCHECK(GetOwningArena() == nullptr)
|
||||
<< "ReleaseCleared() can only be used on a RepeatedPtrField not on "
|
||||
<< "an arena.";
|
||||
GOOGLE_DCHECK(GetArena() == nullptr);
|
||||
GOOGLE_DCHECK(GetOwningArena() == nullptr);
|
||||
GOOGLE_DCHECK(rep_ != nullptr);
|
||||
GOOGLE_DCHECK_GT(rep_->allocated_size, current_size_);
|
||||
return cast<TypeHandler>(rep_->elements[--rep_->allocated_size]);
|
||||
@ -496,7 +497,7 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase {
|
||||
// AddAllocated version that implements arena-safe copying behavior.
|
||||
Arena* element_arena =
|
||||
reinterpret_cast<Arena*>(TypeHandler::GetOwningArena(value));
|
||||
Arena* arena = GetArena();
|
||||
Arena* arena = GetOwningArena();
|
||||
if (arena == element_arena && rep_ && rep_->allocated_size < total_size_) {
|
||||
// Fast path: underlying arena representation (tagged pointer) is equal to
|
||||
// our arena pointer, and we can add to array without resizing it (at
|
||||
@ -566,7 +567,7 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase {
|
||||
// First, release an element.
|
||||
typename TypeHandler::Type* result = UnsafeArenaReleaseLast<TypeHandler>();
|
||||
// Now perform a copy if we're on an arena.
|
||||
Arena* arena = GetArena();
|
||||
Arena* arena = GetOwningArena();
|
||||
|
||||
typename TypeHandler::Type* new_result;
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
|
||||
@ -584,7 +585,7 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase {
|
||||
// this is the same as UnsafeArenaReleaseLast(). Note that we GOOGLE_DCHECK-fail if
|
||||
// we're on an arena, since the user really should implement the copy
|
||||
// operation in this case.
|
||||
GOOGLE_DCHECK(GetArena() == nullptr)
|
||||
GOOGLE_DCHECK(GetOwningArena() == nullptr)
|
||||
<< "ReleaseLast() called on a RepeatedPtrField that is on an arena, "
|
||||
<< "with a type that does not implement MergeFrom. This is unsafe; "
|
||||
<< "please implement MergeFrom for your type.";
|
||||
@ -594,15 +595,16 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase {
|
||||
template <typename TypeHandler>
|
||||
PROTOBUF_NOINLINE void SwapFallback(RepeatedPtrFieldBase* other) {
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
GOOGLE_DCHECK(GetArena() == nullptr || other->GetArena() != GetArena());
|
||||
GOOGLE_DCHECK(GetOwningArena() == nullptr ||
|
||||
other->GetOwningArena() != GetOwningArena());
|
||||
#else // PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
GOOGLE_DCHECK(other->GetArena() != GetArena());
|
||||
GOOGLE_DCHECK(other->GetOwningArena() != GetOwningArena());
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
|
||||
// Copy semantics in this case. We try to improve efficiency by placing the
|
||||
// temporary on |other|'s arena so that messages are copied twice rather
|
||||
// than three times.
|
||||
RepeatedPtrFieldBase temp(other->GetArena());
|
||||
RepeatedPtrFieldBase temp(other->GetOwningArena());
|
||||
temp.MergeFrom<TypeHandler>(*this);
|
||||
this->Clear<TypeHandler>();
|
||||
this->MergeFrom<TypeHandler>(*other);
|
||||
@ -612,11 +614,12 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase {
|
||||
|
||||
inline Arena* GetArena() const { return arena_; }
|
||||
|
||||
protected:
|
||||
inline Arena* GetOwningArena() const { return arena_; }
|
||||
|
||||
private:
|
||||
template <typename T> friend class Arena::InternalHelper;
|
||||
|
||||
inline Arena* GetOwningArena() const { return arena_; }
|
||||
|
||||
static constexpr int kInitialSize = 0;
|
||||
// A few notes on internal representation:
|
||||
//
|
||||
@ -676,7 +679,7 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase {
|
||||
void** other_elems, int length,
|
||||
int already_allocated) {
|
||||
if (already_allocated < length) {
|
||||
Arena* arena = GetArena();
|
||||
Arena* arena = GetOwningArena();
|
||||
typename TypeHandler::Type* elem_prototype =
|
||||
reinterpret_cast<typename TypeHandler::Type*>(other_elems[0]);
|
||||
for (int i = already_allocated; i < length; i++) {
|
||||
@ -1126,6 +1129,9 @@ class RepeatedPtrField final : private internal::RepeatedPtrFieldBase {
|
||||
// Note: RepeatedPtrField SHOULD NOT be subclassed by users.
|
||||
class TypeHandler;
|
||||
|
||||
// Internal version of GetArena().
|
||||
inline Arena* GetOwningArena() const;
|
||||
|
||||
// Implementations for ExtractSubrange(). The copying behavior must be
|
||||
// included only if the type supports the necessary operations (e.g.,
|
||||
// MergeFrom()), so we must resolve this at compile time. ExtractSubrange()
|
||||
@ -1205,7 +1211,7 @@ inline RepeatedPtrField<Element>::RepeatedPtrField(
|
||||
// We don't just call Swap(&other) here because it would perform 3 copies if
|
||||
// other is on an arena. This field can't be on an arena because arena
|
||||
// construction always uses the Arena* accepting constructor.
|
||||
if (other.GetArena()) {
|
||||
if (other.GetOwningArena()) {
|
||||
CopyFrom(other);
|
||||
} else {
|
||||
InternalSwap(&other);
|
||||
@ -1219,9 +1225,9 @@ inline RepeatedPtrField<Element>& RepeatedPtrField<Element>::operator=(
|
||||
// We don't just call Swap(&other) here because it would perform 3 copies if
|
||||
// the two fields are on different arenas.
|
||||
if (this != &other) {
|
||||
if (GetArena() != other.GetArena()
|
||||
if (GetOwningArena() != other.GetOwningArena()
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
|| GetArena() == nullptr
|
||||
|| GetOwningArena() == nullptr
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
) {
|
||||
CopyFrom(other);
|
||||
@ -1330,7 +1336,7 @@ inline void RepeatedPtrField<Element>::ExtractSubrangeInternal(
|
||||
return;
|
||||
}
|
||||
|
||||
Arena* arena = GetArena();
|
||||
Arena* arena = GetOwningArena();
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
|
||||
// Always copy.
|
||||
for (int i = 0; i < num; ++i) {
|
||||
@ -1368,7 +1374,7 @@ inline void RepeatedPtrField<Element>::ExtractSubrangeInternal(
|
||||
// ExtractSubrange() must return heap-allocated objects by contract, and we
|
||||
// cannot fulfill this contract if we are an on arena, we must GOOGLE_DCHECK() that
|
||||
// we are not on an arena.
|
||||
GOOGLE_DCHECK(GetArena() == nullptr)
|
||||
GOOGLE_DCHECK(GetOwningArena() == nullptr)
|
||||
<< "ExtractSubrange() when arena is non-nullptr is only supported when "
|
||||
<< "the Element type supplies a MergeFrom() operation to make copies.";
|
||||
UnsafeArenaExtractSubrange(start, num, elements);
|
||||
@ -1450,7 +1456,7 @@ template <typename Element>
|
||||
inline void RepeatedPtrField<Element>::UnsafeArenaSwap(
|
||||
RepeatedPtrField* other) {
|
||||
if (this == other) return;
|
||||
GOOGLE_DCHECK_EQ(GetArena(), other->GetArena());
|
||||
GOOGLE_DCHECK_EQ(GetOwningArena(), other->GetOwningArena());
|
||||
RepeatedPtrFieldBase::InternalSwap(other);
|
||||
}
|
||||
|
||||
@ -1464,6 +1470,11 @@ inline Arena* RepeatedPtrField<Element>::GetArena() const {
|
||||
return RepeatedPtrFieldBase::GetArena();
|
||||
}
|
||||
|
||||
template <typename Element>
|
||||
inline Arena* RepeatedPtrField<Element>::GetOwningArena() const {
|
||||
return RepeatedPtrFieldBase::GetOwningArena();
|
||||
}
|
||||
|
||||
template <typename Element>
|
||||
inline size_t RepeatedPtrField<Element>::SpaceUsedExcludingSelfLong() const {
|
||||
return RepeatedPtrFieldBase::SpaceUsedExcludingSelfLong<TypeHandler>();
|
||||
|
@ -95,6 +95,7 @@ SourceContext::SourceContext(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
SourceContext::SourceContext(const SourceContext& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
SourceContext* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.file_name_){}
|
||||
, /*decltype(_impl_._cached_size_)*/{}};
|
||||
@ -105,8 +106,8 @@ SourceContext::SourceContext(const SourceContext& from)
|
||||
_impl_.file_name_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_file_name().empty()) {
|
||||
_impl_.file_name_.Set(from._internal_file_name(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.file_name_.Set(from._internal_file_name(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
// @@protoc_insertion_point(copy_constructor:google.protobuf.SourceContext)
|
||||
}
|
||||
@ -240,23 +241,19 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData SourceContext::_class_data_ =
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*SourceContext::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void SourceContext::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<SourceContext *>(to)->MergeFrom(
|
||||
static_cast<const SourceContext &>(from));
|
||||
}
|
||||
|
||||
|
||||
void SourceContext::MergeFrom(const SourceContext& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.SourceContext)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void SourceContext::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<SourceContext*>(&to_msg);
|
||||
auto& from = static_cast<const SourceContext&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.SourceContext)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
if (!from._internal_file_name().empty()) {
|
||||
_internal_set_file_name(from._internal_file_name());
|
||||
_this->_internal_set_file_name(from._internal_file_name());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void SourceContext::CopyFrom(const SourceContext& from) {
|
||||
|
@ -136,9 +136,11 @@ class PROTOBUF_EXPORT SourceContext final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const SourceContext& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const SourceContext& from);
|
||||
void MergeFrom( const SourceContext& from) {
|
||||
SourceContext::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
@ -209,12 +209,13 @@ Struct::Struct(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
Struct::Struct(const Struct& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
Struct* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
/*decltype(_impl_.fields_)*/{}
|
||||
, /*decltype(_impl_._cached_size_)*/{}};
|
||||
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_impl_.fields_.MergeFrom(from._impl_.fields_);
|
||||
_this->_impl_.fields_.MergeFrom(from._impl_.fields_);
|
||||
// @@protoc_insertion_point(copy_constructor:google.protobuf.Struct)
|
||||
}
|
||||
|
||||
@ -370,21 +371,17 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Struct::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Struct::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void Struct::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<Struct *>(to)->MergeFrom(
|
||||
static_cast<const Struct &>(from));
|
||||
}
|
||||
|
||||
|
||||
void Struct::MergeFrom(const Struct& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Struct)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void Struct::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<Struct*>(&to_msg);
|
||||
auto& from = static_cast<const Struct&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Struct)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
_impl_.fields_.MergeFrom(from._impl_.fields_);
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_impl_.fields_.MergeFrom(from._impl_.fields_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void Struct::CopyFrom(const Struct& from) {
|
||||
@ -464,6 +461,7 @@ Value::Value(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
Value::Value(const Value& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
Value* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.kind_){}
|
||||
, /*decltype(_impl_._cached_size_)*/{}
|
||||
@ -473,27 +471,29 @@ Value::Value(const Value& from)
|
||||
clear_has_kind();
|
||||
switch (from.kind_case()) {
|
||||
case kNullValue: {
|
||||
_internal_set_null_value(from._internal_null_value());
|
||||
_this->_internal_set_null_value(from._internal_null_value());
|
||||
break;
|
||||
}
|
||||
case kNumberValue: {
|
||||
_internal_set_number_value(from._internal_number_value());
|
||||
_this->_internal_set_number_value(from._internal_number_value());
|
||||
break;
|
||||
}
|
||||
case kStringValue: {
|
||||
_internal_set_string_value(from._internal_string_value());
|
||||
_this->_internal_set_string_value(from._internal_string_value());
|
||||
break;
|
||||
}
|
||||
case kBoolValue: {
|
||||
_internal_set_bool_value(from._internal_bool_value());
|
||||
_this->_internal_set_bool_value(from._internal_bool_value());
|
||||
break;
|
||||
}
|
||||
case kStructValue: {
|
||||
_internal_mutable_struct_value()->::PROTOBUF_NAMESPACE_ID::Struct::MergeFrom(from._internal_struct_value());
|
||||
_this->_internal_mutable_struct_value()->::PROTOBUF_NAMESPACE_ID::Struct::MergeFrom(
|
||||
from._internal_struct_value());
|
||||
break;
|
||||
}
|
||||
case kListValue: {
|
||||
_internal_mutable_list_value()->::PROTOBUF_NAMESPACE_ID::ListValue::MergeFrom(from._internal_list_value());
|
||||
_this->_internal_mutable_list_value()->::PROTOBUF_NAMESPACE_ID::ListValue::MergeFrom(
|
||||
from._internal_list_value());
|
||||
break;
|
||||
}
|
||||
case KIND_NOT_SET: {
|
||||
@ -780,49 +780,47 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Value::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Value::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<Value *>(to)->MergeFrom(
|
||||
static_cast<const Value &>(from));
|
||||
}
|
||||
|
||||
|
||||
void Value::MergeFrom(const Value& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Value)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<Value*>(&to_msg);
|
||||
auto& from = static_cast<const Value&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Value)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
switch (from.kind_case()) {
|
||||
case kNullValue: {
|
||||
_internal_set_null_value(from._internal_null_value());
|
||||
_this->_internal_set_null_value(from._internal_null_value());
|
||||
break;
|
||||
}
|
||||
case kNumberValue: {
|
||||
_internal_set_number_value(from._internal_number_value());
|
||||
_this->_internal_set_number_value(from._internal_number_value());
|
||||
break;
|
||||
}
|
||||
case kStringValue: {
|
||||
_internal_set_string_value(from._internal_string_value());
|
||||
_this->_internal_set_string_value(from._internal_string_value());
|
||||
break;
|
||||
}
|
||||
case kBoolValue: {
|
||||
_internal_set_bool_value(from._internal_bool_value());
|
||||
_this->_internal_set_bool_value(from._internal_bool_value());
|
||||
break;
|
||||
}
|
||||
case kStructValue: {
|
||||
_internal_mutable_struct_value()->::PROTOBUF_NAMESPACE_ID::Struct::MergeFrom(from._internal_struct_value());
|
||||
_this->_internal_mutable_struct_value()->::PROTOBUF_NAMESPACE_ID::Struct::MergeFrom(
|
||||
from._internal_struct_value());
|
||||
break;
|
||||
}
|
||||
case kListValue: {
|
||||
_internal_mutable_list_value()->::PROTOBUF_NAMESPACE_ID::ListValue::MergeFrom(from._internal_list_value());
|
||||
_this->_internal_mutable_list_value()->::PROTOBUF_NAMESPACE_ID::ListValue::MergeFrom(
|
||||
from._internal_list_value());
|
||||
break;
|
||||
}
|
||||
case KIND_NOT_SET: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void Value::CopyFrom(const Value& from) {
|
||||
@ -863,6 +861,7 @@ ListValue::ListValue(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
ListValue::ListValue(const ListValue& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
ListValue* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.values_){from._impl_.values_}
|
||||
, /*decltype(_impl_._cached_size_)*/{}};
|
||||
@ -997,21 +996,17 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ListValue::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ListValue::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void ListValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<ListValue *>(to)->MergeFrom(
|
||||
static_cast<const ListValue &>(from));
|
||||
}
|
||||
|
||||
|
||||
void ListValue::MergeFrom(const ListValue& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.ListValue)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void ListValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<ListValue*>(&to_msg);
|
||||
auto& from = static_cast<const ListValue&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.ListValue)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
_impl_.values_.MergeFrom(from._impl_.values_);
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_impl_.values_.MergeFrom(from._impl_.values_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void ListValue::CopyFrom(const ListValue& from) {
|
||||
|
@ -202,9 +202,11 @@ class PROTOBUF_EXPORT Struct final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const Struct& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const Struct& from);
|
||||
void MergeFrom( const Struct& from) {
|
||||
Struct::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -373,9 +375,11 @@ class PROTOBUF_EXPORT Value final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const Value& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const Value& from);
|
||||
void MergeFrom( const Value& from) {
|
||||
Value::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -630,9 +634,11 @@ class PROTOBUF_EXPORT ListValue final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const ListValue& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const ListValue& from);
|
||||
void MergeFrom( const ListValue& from) {
|
||||
ListValue::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
@ -66,8 +66,6 @@
|
||||
// Must be included last.
|
||||
#include <google/protobuf/port_def.inc>
|
||||
|
||||
#define DEBUG_STRING_SILENT_MARKER "\t "
|
||||
|
||||
namespace google {
|
||||
namespace protobuf {
|
||||
|
||||
@ -86,7 +84,10 @@ inline bool IsOctNumber(const std::string& str) {
|
||||
} // namespace
|
||||
|
||||
namespace internal {
|
||||
// Controls insertion of DEBUG_STRING_SILENT_MARKER.
|
||||
const char kDebugStringSilentMarker[] = "";
|
||||
const char kDebugStringSilentMarkerForDetection[] = "\t ";
|
||||
|
||||
// Controls insertion of kDebugStringSilentMarker.
|
||||
PROTOBUF_EXPORT std::atomic<bool> enable_debug_text_format_marker;
|
||||
} // namespace internal
|
||||
|
||||
@ -1282,7 +1283,8 @@ class TextFormat::Parser::ParserImpl {
|
||||
bool TryConsumeWhitespace() {
|
||||
had_silent_marker_ = false;
|
||||
if (LookingAtType(io::Tokenizer::TYPE_WHITESPACE)) {
|
||||
if (tokenizer_.current().text == " " DEBUG_STRING_SILENT_MARKER) {
|
||||
if (tokenizer_.current().text ==
|
||||
StrCat(" ", internal::kDebugStringSilentMarkerForDetection)) {
|
||||
had_silent_marker_ = true;
|
||||
}
|
||||
tokenizer_.Next();
|
||||
@ -1422,7 +1424,7 @@ class TextFormat::Printer::TextGenerator
|
||||
void PrintMaybeWithMarker(StringPiece text) {
|
||||
Print(text.data(), text.size());
|
||||
if (ConsumeInsertSilentMarker()) {
|
||||
PrintLiteral(DEBUG_STRING_SILENT_MARKER);
|
||||
PrintLiteral(internal::kDebugStringSilentMarker);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1430,7 +1432,7 @@ class TextFormat::Printer::TextGenerator
|
||||
StringPiece text_tail) {
|
||||
Print(text_head.data(), text_head.size());
|
||||
if (ConsumeInsertSilentMarker()) {
|
||||
PrintLiteral(DEBUG_STRING_SILENT_MARKER);
|
||||
PrintLiteral(internal::kDebugStringSilentMarker);
|
||||
}
|
||||
Print(text_tail.data(), text_tail.size());
|
||||
}
|
||||
|
@ -60,6 +60,11 @@
|
||||
namespace google {
|
||||
namespace protobuf {
|
||||
|
||||
namespace internal {
|
||||
PROTOBUF_EXPORT extern const char kDebugStringSilentMarker[1];
|
||||
PROTOBUF_EXPORT extern const char kDebugStringSilentMarkerForDetection[3];
|
||||
} // namespace internal
|
||||
|
||||
namespace io {
|
||||
class ErrorCollector; // tokenizer.h
|
||||
}
|
||||
|
@ -77,6 +77,8 @@ extern PROTOBUF_EXPORT std::atomic<bool> enable_debug_text_format_marker;
|
||||
// Can't use an anonymous namespace here due to brokenness of Tru64 compiler.
|
||||
namespace text_format_unittest {
|
||||
|
||||
using ::google::protobuf::internal::kDebugStringSilentMarker;
|
||||
|
||||
// A basic string with different escapable characters for testing.
|
||||
const std::string kEscapeTestString =
|
||||
"\"A string with ' characters \n and \r newlines and \t tabs and \001 "
|
||||
@ -94,21 +96,21 @@ class TextFormatTest : public testing::Test {
|
||||
TestUtil::GetTestDataPath(
|
||||
"net/proto2/internal/"
|
||||
"testdata/text_format_unittest_data_oneof_implemented.txt"),
|
||||
&static_proto_debug_string_, true));
|
||||
CleanStringLineEndings(&static_proto_debug_string_, false);
|
||||
&static_proto_text_format_, true));
|
||||
CleanStringLineEndings(&static_proto_text_format_, false);
|
||||
}
|
||||
|
||||
TextFormatTest() : proto_debug_string_(static_proto_debug_string_) {}
|
||||
TextFormatTest() : proto_text_format_(static_proto_text_format_) {}
|
||||
|
||||
protected:
|
||||
// Debug string read from text_format_unittest_data.txt.
|
||||
const std::string proto_debug_string_;
|
||||
// Text format read from text_format_unittest_data.txt.
|
||||
const std::string proto_text_format_;
|
||||
unittest::TestAllTypes proto_;
|
||||
|
||||
private:
|
||||
static std::string static_proto_debug_string_;
|
||||
static std::string static_proto_text_format_;
|
||||
};
|
||||
std::string TextFormatTest::static_proto_debug_string_;
|
||||
std::string TextFormatTest::static_proto_text_format_;
|
||||
|
||||
class TextFormatExtensionsTest : public testing::Test {
|
||||
public:
|
||||
@ -116,31 +118,34 @@ class TextFormatExtensionsTest : public testing::Test {
|
||||
GOOGLE_CHECK_OK(File::GetContents(
|
||||
TestUtil::GetTestDataPath("net/proto2/internal/testdata/"
|
||||
"text_format_unittest_extensions_data.txt"),
|
||||
&static_proto_debug_string_, true));
|
||||
CleanStringLineEndings(&static_proto_debug_string_, false);
|
||||
&static_proto_text_format_, true));
|
||||
CleanStringLineEndings(&static_proto_text_format_, false);
|
||||
}
|
||||
|
||||
TextFormatExtensionsTest()
|
||||
: proto_debug_string_(static_proto_debug_string_) {}
|
||||
TextFormatExtensionsTest() : proto_text_format_(static_proto_text_format_) {}
|
||||
|
||||
protected:
|
||||
// Debug string read from text_format_unittest_data.txt.
|
||||
const std::string proto_debug_string_;
|
||||
const std::string proto_text_format_;
|
||||
unittest::TestAllExtensions proto_;
|
||||
|
||||
private:
|
||||
static std::string static_proto_debug_string_;
|
||||
static std::string static_proto_text_format_;
|
||||
};
|
||||
std::string TextFormatExtensionsTest::static_proto_debug_string_;
|
||||
std::string TextFormatExtensionsTest::static_proto_text_format_;
|
||||
|
||||
TEST_F(TextFormatTest, Basic) {
|
||||
TestUtil::SetAllFields(&proto_);
|
||||
EXPECT_EQ(proto_debug_string_, proto_.DebugString());
|
||||
std::string actual_proto_text_format;
|
||||
TextFormat::PrintToString(proto_, &actual_proto_text_format);
|
||||
EXPECT_EQ(actual_proto_text_format, proto_text_format_);
|
||||
}
|
||||
|
||||
TEST_F(TextFormatExtensionsTest, Extensions) {
|
||||
TestUtil::SetAllExtensions(&proto_);
|
||||
EXPECT_EQ(proto_debug_string_, proto_.DebugString());
|
||||
std::string actual_proto_text_format;
|
||||
TextFormat::PrintToString(proto_, &actual_proto_text_format);
|
||||
EXPECT_EQ(actual_proto_text_format, proto_text_format_);
|
||||
}
|
||||
|
||||
TEST_F(TextFormatTest, ShortDebugString) {
|
||||
@ -149,11 +154,12 @@ TEST_F(TextFormatTest, ShortDebugString) {
|
||||
proto_.mutable_optional_nested_message()->set_bb(2);
|
||||
proto_.mutable_optional_foreign_message();
|
||||
|
||||
EXPECT_EQ(
|
||||
"optional_int32: 1 optional_string: \"hello\" "
|
||||
"optional_nested_message { bb: 2 } "
|
||||
"optional_foreign_message { }",
|
||||
proto_.ShortDebugString());
|
||||
EXPECT_EQ(proto_.ShortDebugString(),
|
||||
StrCat("optional_int32: ", kDebugStringSilentMarker,
|
||||
"1 "
|
||||
"optional_string: \"hello\" "
|
||||
"optional_nested_message { bb: 2 } "
|
||||
"optional_foreign_message { }"));
|
||||
}
|
||||
|
||||
TEST_F(TextFormatTest, ShortPrimitiveRepeateds) {
|
||||
@ -223,7 +229,8 @@ TEST_F(TextFormatTest, StringEscape) {
|
||||
|
||||
// Hardcode a correct value to test against.
|
||||
std::string correct_string =
|
||||
"optional_string: " + kEscapeTestStringEscaped + "\n";
|
||||
StrCat("optional_string: ", kDebugStringSilentMarker,
|
||||
kEscapeTestStringEscaped, "\n");
|
||||
|
||||
// Compare.
|
||||
EXPECT_EQ(correct_string, debug_string);
|
||||
@ -231,8 +238,8 @@ TEST_F(TextFormatTest, StringEscape) {
|
||||
// the protocol buffer contains no UTF-8 text.
|
||||
EXPECT_EQ(correct_string, utf8_debug_string);
|
||||
|
||||
std::string expected_short_debug_string =
|
||||
"optional_string: " + kEscapeTestStringEscaped;
|
||||
std::string expected_short_debug_string = StrCat(
|
||||
"optional_string: ", kDebugStringSilentMarker, kEscapeTestStringEscaped);
|
||||
EXPECT_EQ(expected_short_debug_string, proto_.ShortDebugString());
|
||||
}
|
||||
|
||||
@ -247,19 +254,13 @@ TEST_F(TextFormatTest, Utf8DebugString) {
|
||||
|
||||
// Hardcode a correct value to test against.
|
||||
std::string correct_utf8_string =
|
||||
"optional_string: "
|
||||
"\"\350\260\267\346\255\214\""
|
||||
"\n"
|
||||
"optional_bytes: "
|
||||
"\"\\350\\260\\267\\346\\255\\214\""
|
||||
"\n";
|
||||
StrCat("optional_string: ", kDebugStringSilentMarker,
|
||||
"\"\350\260\267\346\255\214\"\n"
|
||||
"optional_bytes: \"\\350\\260\\267\\346\\255\\214\"\n");
|
||||
std::string correct_string =
|
||||
"optional_string: "
|
||||
"\"\\350\\260\\267\\346\\255\\214\""
|
||||
"\n"
|
||||
"optional_bytes: "
|
||||
"\"\\350\\260\\267\\346\\255\\214\""
|
||||
"\n";
|
||||
StrCat("optional_string: ", kDebugStringSilentMarker,
|
||||
"\"\\350\\260\\267\\346\\255\\214\"\n"
|
||||
"optional_bytes: \"\\350\\260\\267\\346\\255\\214\"\n");
|
||||
|
||||
// Compare.
|
||||
EXPECT_EQ(correct_utf8_string, utf8_debug_string);
|
||||
@ -282,18 +283,18 @@ TEST_F(TextFormatTest, PrintUnknownFields) {
|
||||
unknown_fields->AddVarint(8, 2);
|
||||
unknown_fields->AddVarint(8, 3);
|
||||
|
||||
EXPECT_EQ(
|
||||
"5: 1\n"
|
||||
"5: 0x00000002\n"
|
||||
"5: 0x0000000000000003\n"
|
||||
"5: \"4\"\n"
|
||||
"5 {\n"
|
||||
" 10: 5\n"
|
||||
"}\n"
|
||||
"8: 1\n"
|
||||
"8: 2\n"
|
||||
"8: 3\n",
|
||||
message.DebugString());
|
||||
EXPECT_EQ(StrCat("5: ", kDebugStringSilentMarker,
|
||||
"1\n"
|
||||
"5: 0x00000002\n"
|
||||
"5: 0x0000000000000003\n"
|
||||
"5: \"4\"\n"
|
||||
"5 {\n"
|
||||
" 10: 5\n"
|
||||
"}\n"
|
||||
"8: 1\n"
|
||||
"8: 2\n"
|
||||
"8: 3\n"),
|
||||
message.DebugString());
|
||||
}
|
||||
|
||||
TEST_F(TextFormatTest, PrintUnknownFieldsHidden) {
|
||||
@ -800,15 +801,15 @@ TEST_F(TextFormatTest, CustomMessagePrinter) {
|
||||
}
|
||||
|
||||
TEST_F(TextFormatTest, ParseBasic) {
|
||||
io::ArrayInputStream input_stream(proto_debug_string_.data(),
|
||||
proto_debug_string_.size());
|
||||
io::ArrayInputStream input_stream(proto_text_format_.data(),
|
||||
proto_text_format_.size());
|
||||
TextFormat::Parse(&input_stream, &proto_);
|
||||
TestUtil::ExpectAllFieldsSet(proto_);
|
||||
}
|
||||
|
||||
TEST_F(TextFormatExtensionsTest, ParseExtensions) {
|
||||
io::ArrayInputStream input_stream(proto_debug_string_.data(),
|
||||
proto_debug_string_.size());
|
||||
io::ArrayInputStream input_stream(proto_text_format_.data(),
|
||||
proto_text_format_.size());
|
||||
TextFormat::Parse(&input_stream, &proto_);
|
||||
TestUtil::ExpectAllExtensionsSet(proto_);
|
||||
}
|
||||
@ -844,12 +845,12 @@ TEST_F(TextFormatTest, PrintUnknownEnumFieldProto3) {
|
||||
proto.add_repeated_nested_enum(
|
||||
static_cast<proto3_unittest::TestAllTypes::NestedEnum>(-2147483648));
|
||||
|
||||
EXPECT_EQ(
|
||||
"repeated_nested_enum: 10\n"
|
||||
"repeated_nested_enum: -10\n"
|
||||
"repeated_nested_enum: 2147483647\n"
|
||||
"repeated_nested_enum: -2147483648\n",
|
||||
proto.DebugString());
|
||||
EXPECT_EQ(StrCat("repeated_nested_enum: ", kDebugStringSilentMarker,
|
||||
"10\n"
|
||||
"repeated_nested_enum: -10\n"
|
||||
"repeated_nested_enum: 2147483647\n"
|
||||
"repeated_nested_enum: -2147483648\n"),
|
||||
proto.DebugString());
|
||||
}
|
||||
|
||||
TEST_F(TextFormatTest, ParseUnknownEnumFieldProto3) {
|
||||
@ -1102,19 +1103,20 @@ TEST_F(TextFormatTest, PrintExotic) {
|
||||
// have this problem, so we switched to that instead.
|
||||
|
||||
EXPECT_EQ(
|
||||
"repeated_int64: -9223372036854775808\n"
|
||||
"repeated_uint64: 18446744073709551615\n"
|
||||
"repeated_double: 123.456\n"
|
||||
"repeated_double: 1.23e+21\n"
|
||||
"repeated_double: 1.23e-18\n"
|
||||
"repeated_double: inf\n"
|
||||
"repeated_double: -inf\n"
|
||||
"repeated_double: nan\n"
|
||||
"repeated_double: nan\n"
|
||||
"repeated_double: nan\n"
|
||||
"repeated_double: nan\n"
|
||||
"repeated_string: "
|
||||
"\"\\000\\001\\007\\010\\014\\n\\r\\t\\013\\\\\\'\\\"\"\n",
|
||||
StrCat("repeated_int64: ", kDebugStringSilentMarker,
|
||||
"-9223372036854775808\n"
|
||||
"repeated_uint64: 18446744073709551615\n"
|
||||
"repeated_double: 123.456\n"
|
||||
"repeated_double: 1.23e+21\n"
|
||||
"repeated_double: 1.23e-18\n"
|
||||
"repeated_double: inf\n"
|
||||
"repeated_double: -inf\n"
|
||||
"repeated_double: nan\n"
|
||||
"repeated_double: nan\n"
|
||||
"repeated_double: nan\n"
|
||||
"repeated_double: nan\n"
|
||||
"repeated_string: "
|
||||
"\"\\000\\001\\007\\010\\014\\n\\r\\t\\013\\\\\\'\\\"\"\n"),
|
||||
RemoveRedundantZeros(message.DebugString()));
|
||||
}
|
||||
|
||||
@ -1161,47 +1163,47 @@ TEST_F(TextFormatTest, PrintFloatPrecision) {
|
||||
message.add_repeated_double(1.2345678987654e100);
|
||||
message.add_repeated_double(1.23456789876543e100);
|
||||
|
||||
EXPECT_EQ(
|
||||
"repeated_float: 1\n"
|
||||
"repeated_float: 1.2\n"
|
||||
"repeated_float: 1.23\n"
|
||||
"repeated_float: 1.234\n"
|
||||
"repeated_float: 1.2345\n"
|
||||
"repeated_float: 1.23456\n"
|
||||
"repeated_float: 1.2e+10\n"
|
||||
"repeated_float: 1.23e+10\n"
|
||||
"repeated_float: 1.234e+10\n"
|
||||
"repeated_float: 1.2345e+10\n"
|
||||
"repeated_float: 1.23456e+10\n"
|
||||
"repeated_double: 1.2\n"
|
||||
"repeated_double: 1.23\n"
|
||||
"repeated_double: 1.234\n"
|
||||
"repeated_double: 1.2345\n"
|
||||
"repeated_double: 1.23456\n"
|
||||
"repeated_double: 1.234567\n"
|
||||
"repeated_double: 1.2345678\n"
|
||||
"repeated_double: 1.23456789\n"
|
||||
"repeated_double: 1.234567898\n"
|
||||
"repeated_double: 1.2345678987\n"
|
||||
"repeated_double: 1.23456789876\n"
|
||||
"repeated_double: 1.234567898765\n"
|
||||
"repeated_double: 1.2345678987654\n"
|
||||
"repeated_double: 1.23456789876543\n"
|
||||
"repeated_double: 1.2e+100\n"
|
||||
"repeated_double: 1.23e+100\n"
|
||||
"repeated_double: 1.234e+100\n"
|
||||
"repeated_double: 1.2345e+100\n"
|
||||
"repeated_double: 1.23456e+100\n"
|
||||
"repeated_double: 1.234567e+100\n"
|
||||
"repeated_double: 1.2345678e+100\n"
|
||||
"repeated_double: 1.23456789e+100\n"
|
||||
"repeated_double: 1.234567898e+100\n"
|
||||
"repeated_double: 1.2345678987e+100\n"
|
||||
"repeated_double: 1.23456789876e+100\n"
|
||||
"repeated_double: 1.234567898765e+100\n"
|
||||
"repeated_double: 1.2345678987654e+100\n"
|
||||
"repeated_double: 1.23456789876543e+100\n",
|
||||
RemoveRedundantZeros(message.DebugString()));
|
||||
EXPECT_EQ(StrCat("repeated_float: ", kDebugStringSilentMarker,
|
||||
"1\n"
|
||||
"repeated_float: 1.2\n"
|
||||
"repeated_float: 1.23\n"
|
||||
"repeated_float: 1.234\n"
|
||||
"repeated_float: 1.2345\n"
|
||||
"repeated_float: 1.23456\n"
|
||||
"repeated_float: 1.2e+10\n"
|
||||
"repeated_float: 1.23e+10\n"
|
||||
"repeated_float: 1.234e+10\n"
|
||||
"repeated_float: 1.2345e+10\n"
|
||||
"repeated_float: 1.23456e+10\n"
|
||||
"repeated_double: 1.2\n"
|
||||
"repeated_double: 1.23\n"
|
||||
"repeated_double: 1.234\n"
|
||||
"repeated_double: 1.2345\n"
|
||||
"repeated_double: 1.23456\n"
|
||||
"repeated_double: 1.234567\n"
|
||||
"repeated_double: 1.2345678\n"
|
||||
"repeated_double: 1.23456789\n"
|
||||
"repeated_double: 1.234567898\n"
|
||||
"repeated_double: 1.2345678987\n"
|
||||
"repeated_double: 1.23456789876\n"
|
||||
"repeated_double: 1.234567898765\n"
|
||||
"repeated_double: 1.2345678987654\n"
|
||||
"repeated_double: 1.23456789876543\n"
|
||||
"repeated_double: 1.2e+100\n"
|
||||
"repeated_double: 1.23e+100\n"
|
||||
"repeated_double: 1.234e+100\n"
|
||||
"repeated_double: 1.2345e+100\n"
|
||||
"repeated_double: 1.23456e+100\n"
|
||||
"repeated_double: 1.234567e+100\n"
|
||||
"repeated_double: 1.2345678e+100\n"
|
||||
"repeated_double: 1.23456789e+100\n"
|
||||
"repeated_double: 1.234567898e+100\n"
|
||||
"repeated_double: 1.2345678987e+100\n"
|
||||
"repeated_double: 1.23456789876e+100\n"
|
||||
"repeated_double: 1.234567898765e+100\n"
|
||||
"repeated_double: 1.2345678987654e+100\n"
|
||||
"repeated_double: 1.23456789876543e+100\n"),
|
||||
RemoveRedundantZeros(message.DebugString()));
|
||||
}
|
||||
|
||||
TEST_F(TextFormatTest, AllowPartial) {
|
||||
@ -2064,9 +2066,9 @@ TEST_F(TextFormatParserTest, ParseSkippedFieldWithAdditionalWhiteSpaces) {
|
||||
|
||||
class TextFormatMessageSetTest : public testing::Test {
|
||||
protected:
|
||||
static const char proto_debug_string_[];
|
||||
static const char proto_text_format_[];
|
||||
};
|
||||
const char TextFormatMessageSetTest::proto_debug_string_[] =
|
||||
const char TextFormatMessageSetTest::proto_text_format_[] =
|
||||
"message_set {\n"
|
||||
" [protobuf_unittest.TestMessageSetExtension1] {\n"
|
||||
" i: 23\n"
|
||||
@ -2086,12 +2088,14 @@ TEST_F(TextFormatMessageSetTest, Serialize) {
|
||||
proto.mutable_message_set()->MutableExtension(
|
||||
protobuf_unittest::TestMessageSetExtension2::message_set_extension);
|
||||
item_b->set_str("foo");
|
||||
EXPECT_EQ(proto_debug_string_, proto.DebugString());
|
||||
std::string actual_proto_text_format;
|
||||
TextFormat::PrintToString(proto, &actual_proto_text_format);
|
||||
EXPECT_EQ(proto_text_format_, actual_proto_text_format);
|
||||
}
|
||||
|
||||
TEST_F(TextFormatMessageSetTest, Deserialize) {
|
||||
protobuf_unittest::TestMessageSetContainer proto;
|
||||
ASSERT_TRUE(TextFormat::ParseFromString(proto_debug_string_, &proto));
|
||||
ASSERT_TRUE(TextFormat::ParseFromString(proto_text_format_, &proto));
|
||||
EXPECT_EQ(
|
||||
23,
|
||||
proto.message_set()
|
||||
@ -2251,131 +2255,6 @@ TEST(TextFormatUnknownFieldTest, TestUnknownExtension) {
|
||||
EXPECT_FALSE(parser.ParseFromString("unknown_field: 1", &proto));
|
||||
}
|
||||
|
||||
class TextFormatSilentMarkerTest : public testing::Test {
|
||||
public:
|
||||
void SetUp() override {
|
||||
google::protobuf::internal::enable_debug_text_format_marker = true;
|
||||
}
|
||||
void TearDown() override {
|
||||
google::protobuf::internal::enable_debug_text_format_marker = false;
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(TextFormatSilentMarkerTest, NonMessageFieldAsFirstField) {
|
||||
protobuf_unittest::TestAllTypes proto;
|
||||
proto.set_optional_int32(1);
|
||||
proto.mutable_optional_nested_message()->set_bb(2);
|
||||
|
||||
EXPECT_EQ(
|
||||
"optional_int32: \t 1\n"
|
||||
"optional_nested_message {\n"
|
||||
" bb: 2\n"
|
||||
"}\n",
|
||||
proto.DebugString());
|
||||
|
||||
EXPECT_EQ(
|
||||
"optional_int32: \t 1 "
|
||||
"optional_nested_message { bb: 2 }",
|
||||
proto.ShortDebugString());
|
||||
}
|
||||
|
||||
TEST_F(TextFormatSilentMarkerTest, MessageFieldAsFirstField) {
|
||||
protobuf_unittest::TestAllTypes proto;
|
||||
proto.mutable_optional_nested_message()->set_bb(2);
|
||||
proto.add_repeated_int32(3);
|
||||
|
||||
EXPECT_EQ(
|
||||
"optional_nested_message \t {\n"
|
||||
" bb: 2\n"
|
||||
"}\n"
|
||||
"repeated_int32: 3\n",
|
||||
proto.DebugString());
|
||||
|
||||
EXPECT_EQ(
|
||||
"optional_nested_message \t { bb: 2 } "
|
||||
"repeated_int32: 3",
|
||||
proto.ShortDebugString());
|
||||
}
|
||||
|
||||
TEST_F(TextFormatSilentMarkerTest, UnknownFieldAsFirstField) {
|
||||
unittest::TestEmptyMessage message;
|
||||
UnknownFieldSet* unknown_fields = message.mutable_unknown_fields();
|
||||
|
||||
unknown_fields->AddVarint(5, 1);
|
||||
unknown_fields->AddGroup(5)->AddVarint(10, 5);
|
||||
|
||||
EXPECT_EQ(
|
||||
"5: \t 1\n"
|
||||
"5 {\n"
|
||||
" 10: 5\n"
|
||||
"}\n",
|
||||
message.DebugString());
|
||||
|
||||
EXPECT_EQ(
|
||||
"5: \t 1 "
|
||||
"5 { 10: 5 }",
|
||||
message.ShortDebugString());
|
||||
|
||||
unknown_fields->Clear();
|
||||
unknown_fields->AddGroup(5)->AddVarint(10, 5);
|
||||
unknown_fields->AddVarint(5, 1);
|
||||
|
||||
EXPECT_EQ(
|
||||
"5 \t {\n"
|
||||
" 10: 5\n"
|
||||
"}\n"
|
||||
"5: 1\n",
|
||||
message.DebugString());
|
||||
|
||||
EXPECT_EQ(
|
||||
"5 \t { 10: 5 } "
|
||||
"5: 1",
|
||||
message.ShortDebugString());
|
||||
}
|
||||
|
||||
TEST_F(TextFormatSilentMarkerTest, AnyFieldAsFirstField) {
|
||||
protobuf_unittest::TestAllTypes proto;
|
||||
proto.set_optional_string("teststr");
|
||||
proto.set_optional_int32(432);
|
||||
Any any;
|
||||
any.PackFrom(proto);
|
||||
|
||||
EXPECT_EQ(
|
||||
"[type.googleapis.com/protobuf_unittest.TestAllTypes] \t {\n"
|
||||
" optional_int32: 432\n"
|
||||
" optional_string: \"teststr\"\n"
|
||||
"}\n",
|
||||
any.DebugString());
|
||||
|
||||
EXPECT_EQ(
|
||||
"[type.googleapis.com/protobuf_unittest.TestAllTypes]"
|
||||
" \t { optional_int32: 432 optional_string: \"teststr\" }",
|
||||
any.ShortDebugString());
|
||||
}
|
||||
|
||||
TEST_F(TextFormatSilentMarkerTest, ExtensionFieldAsFirstField) {
|
||||
unittest::TestAllExtensions proto;
|
||||
proto.SetExtension(protobuf_unittest::optional_int32_extension, 101);
|
||||
proto.SetExtension(protobuf_unittest::optional_int64_extension, 102);
|
||||
|
||||
EXPECT_EQ(
|
||||
"[protobuf_unittest.optional_int32_extension]: \t 101\n"
|
||||
"[protobuf_unittest.optional_int64_extension]: 102\n",
|
||||
proto.DebugString());
|
||||
}
|
||||
|
||||
TEST_F(TextFormatSilentMarkerTest, MapFieldAsFirstField) {
|
||||
unittest::TestMap proto;
|
||||
(*proto.mutable_map_int32_int32())[0] = 1;
|
||||
(*proto.mutable_map_int64_int64())[2] = 3;
|
||||
|
||||
EXPECT_EQ(
|
||||
"map_int32_int32 \t {\n key: 0\n value: 1\n}\n"
|
||||
"map_int64_int64 {\n key: 2\n value: 3\n}\n",
|
||||
proto.DebugString());
|
||||
}
|
||||
|
||||
|
||||
TEST(TextFormatFloatingPointTest, PreservesNegative0) {
|
||||
proto3_unittest::TestAllTypes in_message;
|
||||
in_message.set_optional_float(-0.0f);
|
||||
|
@ -97,6 +97,7 @@ Timestamp::Timestamp(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
Timestamp::Timestamp(const Timestamp& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
Timestamp* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.seconds_){}
|
||||
, decltype(_impl_.nanos_){}
|
||||
@ -247,26 +248,22 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Timestamp::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Timestamp::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void Timestamp::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<Timestamp *>(to)->MergeFrom(
|
||||
static_cast<const Timestamp &>(from));
|
||||
}
|
||||
|
||||
|
||||
void Timestamp::MergeFrom(const Timestamp& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Timestamp)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void Timestamp::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<Timestamp*>(&to_msg);
|
||||
auto& from = static_cast<const Timestamp&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Timestamp)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
if (from._internal_seconds() != 0) {
|
||||
_internal_set_seconds(from._internal_seconds());
|
||||
_this->_internal_set_seconds(from._internal_seconds());
|
||||
}
|
||||
if (from._internal_nanos() != 0) {
|
||||
_internal_set_nanos(from._internal_nanos());
|
||||
_this->_internal_set_nanos(from._internal_nanos());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void Timestamp::CopyFrom(const Timestamp& from) {
|
||||
|
@ -136,9 +136,11 @@ class PROTOBUF_EXPORT Timestamp final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const Timestamp& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const Timestamp& from);
|
||||
void MergeFrom( const Timestamp& from) {
|
||||
Timestamp::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
@ -368,6 +368,7 @@ Type::Type(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
Type::Type(const Type& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
Type* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.fields_){from._impl_.fields_}
|
||||
, decltype(_impl_.oneofs_){from._impl_.oneofs_}
|
||||
@ -383,13 +384,13 @@ Type::Type(const Type& from)
|
||||
_impl_.name_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_name().empty()) {
|
||||
_impl_.name_.Set(from._internal_name(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.name_.Set(from._internal_name(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
if (from._internal_has_source_context()) {
|
||||
_impl_.source_context_ = new ::PROTOBUF_NAMESPACE_ID::SourceContext(*from._impl_.source_context_);
|
||||
_this->_impl_.source_context_ = new ::PROTOBUF_NAMESPACE_ID::SourceContext(*from._impl_.source_context_);
|
||||
}
|
||||
_impl_.syntax_ = from._impl_.syntax_;
|
||||
_this->_impl_.syntax_ = from._impl_.syntax_;
|
||||
// @@protoc_insertion_point(copy_constructor:google.protobuf.Type)
|
||||
}
|
||||
|
||||
@ -672,32 +673,29 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Type::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Type::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void Type::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<Type *>(to)->MergeFrom(
|
||||
static_cast<const Type &>(from));
|
||||
}
|
||||
|
||||
|
||||
void Type::MergeFrom(const Type& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Type)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void Type::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<Type*>(&to_msg);
|
||||
auto& from = static_cast<const Type&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Type)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
_impl_.fields_.MergeFrom(from._impl_.fields_);
|
||||
_impl_.oneofs_.MergeFrom(from._impl_.oneofs_);
|
||||
_impl_.options_.MergeFrom(from._impl_.options_);
|
||||
_this->_impl_.fields_.MergeFrom(from._impl_.fields_);
|
||||
_this->_impl_.oneofs_.MergeFrom(from._impl_.oneofs_);
|
||||
_this->_impl_.options_.MergeFrom(from._impl_.options_);
|
||||
if (!from._internal_name().empty()) {
|
||||
_internal_set_name(from._internal_name());
|
||||
_this->_internal_set_name(from._internal_name());
|
||||
}
|
||||
if (from._internal_has_source_context()) {
|
||||
_internal_mutable_source_context()->::PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom(from._internal_source_context());
|
||||
_this->_internal_mutable_source_context()->::PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom(
|
||||
from._internal_source_context());
|
||||
}
|
||||
if (from._internal_syntax() != 0) {
|
||||
_internal_set_syntax(from._internal_syntax());
|
||||
_this->_internal_set_syntax(from._internal_syntax());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void Type::CopyFrom(const Type& from) {
|
||||
@ -751,6 +749,7 @@ Field::Field(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
Field::Field(const Field& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
Field* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.options_){from._impl_.options_}
|
||||
, decltype(_impl_.name_){}
|
||||
@ -770,32 +769,32 @@ Field::Field(const Field& from)
|
||||
_impl_.name_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_name().empty()) {
|
||||
_impl_.name_.Set(from._internal_name(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.name_.Set(from._internal_name(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
_impl_.type_url_.InitDefault();
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
_impl_.type_url_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_type_url().empty()) {
|
||||
_impl_.type_url_.Set(from._internal_type_url(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.type_url_.Set(from._internal_type_url(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
_impl_.json_name_.InitDefault();
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
_impl_.json_name_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_json_name().empty()) {
|
||||
_impl_.json_name_.Set(from._internal_json_name(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.json_name_.Set(from._internal_json_name(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
_impl_.default_value_.InitDefault();
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
_impl_.default_value_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_default_value().empty()) {
|
||||
_impl_.default_value_.Set(from._internal_default_value(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.default_value_.Set(from._internal_default_value(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
::memcpy(&_impl_.kind_, &from._impl_.kind_,
|
||||
static_cast<size_t>(reinterpret_cast<char*>(&_impl_.packed_) -
|
||||
@ -1174,48 +1173,44 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Field::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Field::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void Field::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<Field *>(to)->MergeFrom(
|
||||
static_cast<const Field &>(from));
|
||||
}
|
||||
|
||||
|
||||
void Field::MergeFrom(const Field& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Field)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void Field::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<Field*>(&to_msg);
|
||||
auto& from = static_cast<const Field&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Field)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
_impl_.options_.MergeFrom(from._impl_.options_);
|
||||
_this->_impl_.options_.MergeFrom(from._impl_.options_);
|
||||
if (!from._internal_name().empty()) {
|
||||
_internal_set_name(from._internal_name());
|
||||
_this->_internal_set_name(from._internal_name());
|
||||
}
|
||||
if (!from._internal_type_url().empty()) {
|
||||
_internal_set_type_url(from._internal_type_url());
|
||||
_this->_internal_set_type_url(from._internal_type_url());
|
||||
}
|
||||
if (!from._internal_json_name().empty()) {
|
||||
_internal_set_json_name(from._internal_json_name());
|
||||
_this->_internal_set_json_name(from._internal_json_name());
|
||||
}
|
||||
if (!from._internal_default_value().empty()) {
|
||||
_internal_set_default_value(from._internal_default_value());
|
||||
_this->_internal_set_default_value(from._internal_default_value());
|
||||
}
|
||||
if (from._internal_kind() != 0) {
|
||||
_internal_set_kind(from._internal_kind());
|
||||
_this->_internal_set_kind(from._internal_kind());
|
||||
}
|
||||
if (from._internal_cardinality() != 0) {
|
||||
_internal_set_cardinality(from._internal_cardinality());
|
||||
_this->_internal_set_cardinality(from._internal_cardinality());
|
||||
}
|
||||
if (from._internal_number() != 0) {
|
||||
_internal_set_number(from._internal_number());
|
||||
_this->_internal_set_number(from._internal_number());
|
||||
}
|
||||
if (from._internal_oneof_index() != 0) {
|
||||
_internal_set_oneof_index(from._internal_oneof_index());
|
||||
_this->_internal_set_oneof_index(from._internal_oneof_index());
|
||||
}
|
||||
if (from._internal_packed() != 0) {
|
||||
_internal_set_packed(from._internal_packed());
|
||||
_this->_internal_set_packed(from._internal_packed());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void Field::CopyFrom(const Field& from) {
|
||||
@ -1290,6 +1285,7 @@ Enum::Enum(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
Enum::Enum(const Enum& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
Enum* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.enumvalue_){from._impl_.enumvalue_}
|
||||
, decltype(_impl_.options_){from._impl_.options_}
|
||||
@ -1304,13 +1300,13 @@ Enum::Enum(const Enum& from)
|
||||
_impl_.name_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_name().empty()) {
|
||||
_impl_.name_.Set(from._internal_name(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.name_.Set(from._internal_name(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
if (from._internal_has_source_context()) {
|
||||
_impl_.source_context_ = new ::PROTOBUF_NAMESPACE_ID::SourceContext(*from._impl_.source_context_);
|
||||
_this->_impl_.source_context_ = new ::PROTOBUF_NAMESPACE_ID::SourceContext(*from._impl_.source_context_);
|
||||
}
|
||||
_impl_.syntax_ = from._impl_.syntax_;
|
||||
_this->_impl_.syntax_ = from._impl_.syntax_;
|
||||
// @@protoc_insertion_point(copy_constructor:google.protobuf.Enum)
|
||||
}
|
||||
|
||||
@ -1557,31 +1553,28 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Enum::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Enum::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void Enum::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<Enum *>(to)->MergeFrom(
|
||||
static_cast<const Enum &>(from));
|
||||
}
|
||||
|
||||
|
||||
void Enum::MergeFrom(const Enum& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Enum)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void Enum::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<Enum*>(&to_msg);
|
||||
auto& from = static_cast<const Enum&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Enum)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
_impl_.enumvalue_.MergeFrom(from._impl_.enumvalue_);
|
||||
_impl_.options_.MergeFrom(from._impl_.options_);
|
||||
_this->_impl_.enumvalue_.MergeFrom(from._impl_.enumvalue_);
|
||||
_this->_impl_.options_.MergeFrom(from._impl_.options_);
|
||||
if (!from._internal_name().empty()) {
|
||||
_internal_set_name(from._internal_name());
|
||||
_this->_internal_set_name(from._internal_name());
|
||||
}
|
||||
if (from._internal_has_source_context()) {
|
||||
_internal_mutable_source_context()->::PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom(from._internal_source_context());
|
||||
_this->_internal_mutable_source_context()->::PROTOBUF_NAMESPACE_ID::SourceContext::MergeFrom(
|
||||
from._internal_source_context());
|
||||
}
|
||||
if (from._internal_syntax() != 0) {
|
||||
_internal_set_syntax(from._internal_syntax());
|
||||
_this->_internal_set_syntax(from._internal_syntax());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void Enum::CopyFrom(const Enum& from) {
|
||||
@ -1634,6 +1627,7 @@ EnumValue::EnumValue(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
EnumValue::EnumValue(const EnumValue& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
EnumValue* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.options_){from._impl_.options_}
|
||||
, decltype(_impl_.name_){}
|
||||
@ -1646,10 +1640,10 @@ EnumValue::EnumValue(const EnumValue& from)
|
||||
_impl_.name_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_name().empty()) {
|
||||
_impl_.name_.Set(from._internal_name(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.name_.Set(from._internal_name(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
_impl_.number_ = from._impl_.number_;
|
||||
_this->_impl_.number_ = from._impl_.number_;
|
||||
// @@protoc_insertion_point(copy_constructor:google.protobuf.EnumValue)
|
||||
}
|
||||
|
||||
@ -1834,27 +1828,23 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData EnumValue::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*EnumValue::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void EnumValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<EnumValue *>(to)->MergeFrom(
|
||||
static_cast<const EnumValue &>(from));
|
||||
}
|
||||
|
||||
|
||||
void EnumValue::MergeFrom(const EnumValue& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumValue)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void EnumValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<EnumValue*>(&to_msg);
|
||||
auto& from = static_cast<const EnumValue&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumValue)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
_impl_.options_.MergeFrom(from._impl_.options_);
|
||||
_this->_impl_.options_.MergeFrom(from._impl_.options_);
|
||||
if (!from._internal_name().empty()) {
|
||||
_internal_set_name(from._internal_name());
|
||||
_this->_internal_set_name(from._internal_name());
|
||||
}
|
||||
if (from._internal_number() != 0) {
|
||||
_internal_set_number(from._internal_number());
|
||||
_this->_internal_set_number(from._internal_number());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void EnumValue::CopyFrom(const EnumValue& from) {
|
||||
@ -1912,6 +1902,7 @@ Option::Option(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
Option::Option(const Option& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
Option* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.name_){}
|
||||
, decltype(_impl_.value_){nullptr}
|
||||
@ -1923,11 +1914,11 @@ Option::Option(const Option& from)
|
||||
_impl_.name_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_name().empty()) {
|
||||
_impl_.name_.Set(from._internal_name(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.name_.Set(from._internal_name(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
if (from._internal_has_value()) {
|
||||
_impl_.value_ = new ::PROTOBUF_NAMESPACE_ID::Any(*from._impl_.value_);
|
||||
_this->_impl_.value_ = new ::PROTOBUF_NAMESPACE_ID::Any(*from._impl_.value_);
|
||||
}
|
||||
// @@protoc_insertion_point(copy_constructor:google.protobuf.Option)
|
||||
}
|
||||
@ -2089,26 +2080,23 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Option::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Option::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void Option::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<Option *>(to)->MergeFrom(
|
||||
static_cast<const Option &>(from));
|
||||
}
|
||||
|
||||
|
||||
void Option::MergeFrom(const Option& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Option)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void Option::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<Option*>(&to_msg);
|
||||
auto& from = static_cast<const Option&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Option)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
if (!from._internal_name().empty()) {
|
||||
_internal_set_name(from._internal_name());
|
||||
_this->_internal_set_name(from._internal_name());
|
||||
}
|
||||
if (from._internal_has_value()) {
|
||||
_internal_mutable_value()->::PROTOBUF_NAMESPACE_ID::Any::MergeFrom(from._internal_value());
|
||||
_this->_internal_mutable_value()->::PROTOBUF_NAMESPACE_ID::Any::MergeFrom(
|
||||
from._internal_value());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void Option::CopyFrom(const Option& from) {
|
||||
|
@ -249,9 +249,11 @@ class PROTOBUF_EXPORT Type final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const Type& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const Type& from);
|
||||
void MergeFrom( const Type& from) {
|
||||
Type::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -497,9 +499,11 @@ class PROTOBUF_EXPORT Field final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const Field& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const Field& from);
|
||||
void MergeFrom( const Field& from) {
|
||||
Field::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -869,9 +873,11 @@ class PROTOBUF_EXPORT Enum final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const Enum& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const Enum& from);
|
||||
void MergeFrom( const Enum& from) {
|
||||
Enum::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -1091,9 +1097,11 @@ class PROTOBUF_EXPORT EnumValue final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const EnumValue& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const EnumValue& from);
|
||||
void MergeFrom( const EnumValue& from) {
|
||||
EnumValue::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -1273,9 +1281,11 @@ class PROTOBUF_EXPORT Option final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const Option& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const Option& from);
|
||||
void MergeFrom( const Option& from) {
|
||||
Option::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include <google/protobuf/io/zero_copy_stream_impl.h>
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#include <google/protobuf/stubs/mutex.h>
|
||||
#include <google/protobuf/text_format.h>
|
||||
#include <google/protobuf/wire_format.h>
|
||||
#include <gmock/gmock.h>
|
||||
#include <google/protobuf/testing/googletest.h>
|
||||
@ -306,6 +307,8 @@ TEST_F(UnknownFieldSetTest, MergeFrom) {
|
||||
|
||||
destination.MergeFrom(source);
|
||||
|
||||
std::string destination_text;
|
||||
TextFormat::PrintToString(destination, &destination_text);
|
||||
EXPECT_EQ(
|
||||
// Note: The ordering of fields here depends on the ordering of adds
|
||||
// and merging, above.
|
||||
@ -313,7 +316,7 @@ TEST_F(UnknownFieldSetTest, MergeFrom) {
|
||||
"3: 2\n"
|
||||
"2: 3\n"
|
||||
"3: 4\n",
|
||||
destination.DebugString());
|
||||
destination_text);
|
||||
}
|
||||
|
||||
TEST_F(UnknownFieldSetTest, MergeFromMessage) {
|
||||
@ -326,6 +329,8 @@ TEST_F(UnknownFieldSetTest, MergeFromMessage) {
|
||||
|
||||
destination.mutable_unknown_fields()->MergeFromMessage(source);
|
||||
|
||||
std::string destination_text;
|
||||
TextFormat::PrintToString(destination, &destination_text);
|
||||
EXPECT_EQ(
|
||||
// Note: The ordering of fields here depends on the ordering of adds
|
||||
// and merging, above.
|
||||
@ -333,7 +338,7 @@ TEST_F(UnknownFieldSetTest, MergeFromMessage) {
|
||||
"3: 2\n"
|
||||
"2: 3\n"
|
||||
"3: 4\n",
|
||||
destination.DebugString());
|
||||
destination_text);
|
||||
}
|
||||
|
||||
TEST_F(UnknownFieldSetTest, MergeFromMessageLite) {
|
||||
|
@ -100,6 +100,24 @@ util::StatusOr<float> DoubleToFloat(double before) {
|
||||
return static_cast<float>(before);
|
||||
} else if (before > std::numeric_limits<float>::max() ||
|
||||
before < -std::numeric_limits<float>::max()) {
|
||||
// Some doubles are larger than the largest float, but after
|
||||
// rounding they will be equal to the largest float.
|
||||
// We can't just attempt the conversion because that has UB if
|
||||
// the value really is out-of-range.
|
||||
// Here we take advantage that 1/2-ing a large floating point
|
||||
// will not lose precision.
|
||||
double half_before = before * 0.5;
|
||||
if (half_before < std::numeric_limits<float>::max() &&
|
||||
half_before > -std::numeric_limits<float>::max()) {
|
||||
const float half_fmax = std::numeric_limits<float>::max() * 0.5f;
|
||||
// If after being cut in half, the value is less than the largest float,
|
||||
// then it's safe to convert it to float. Importantly, this conversion
|
||||
// rounds in the same way that the original does.
|
||||
float half_after = static_cast<float>(half_before);
|
||||
if (half_after <= half_fmax && half_after >= -half_fmax) {
|
||||
return half_after + half_after;
|
||||
}
|
||||
}
|
||||
// Double value outside of the range of float.
|
||||
return util::InvalidArgumentError(DoubleAsString(before));
|
||||
} else {
|
||||
|
@ -265,7 +265,9 @@ TEST_F(JsonUtilTest, ParseMessage) {
|
||||
// functions are working properly.
|
||||
std::string input =
|
||||
"{\n"
|
||||
" \"int32Value\": 1024,\n"
|
||||
" \"int32Value\": 1234567891,\n"
|
||||
" \"int64Value\": 5302428716536692736,\n"
|
||||
" \"floatValue\": 3.4028235e+38,\n"
|
||||
" \"repeatedInt32Value\": [1, 2],\n"
|
||||
" \"messageValue\": {\n"
|
||||
" \"value\": 2048\n"
|
||||
@ -277,7 +279,9 @@ TEST_F(JsonUtilTest, ParseMessage) {
|
||||
JsonParseOptions options;
|
||||
TestMessage m;
|
||||
ASSERT_TRUE(FromJson(input, &m, options));
|
||||
EXPECT_EQ(1024, m.int32_value());
|
||||
EXPECT_EQ(1234567891, m.int32_value());
|
||||
EXPECT_EQ(5302428716536692736, m.int64_value());
|
||||
EXPECT_EQ(3.402823466e+38f, m.float_value());
|
||||
ASSERT_EQ(2, m.repeated_int32_value_size());
|
||||
EXPECT_EQ(1, m.repeated_int32_value(0));
|
||||
EXPECT_EQ(2, m.repeated_int32_value(1));
|
||||
|
@ -40,8 +40,6 @@
|
||||
#define GOOGLE_PROTOBUF_WIRE_FORMAT_H__
|
||||
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/stubs/common.h>
|
||||
#include <google/protobuf/io/coded_stream.h>
|
||||
#include <google/protobuf/stubs/casts.h>
|
||||
|
@ -277,12 +277,13 @@ DoubleValue::DoubleValue(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
DoubleValue::DoubleValue(const DoubleValue& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
DoubleValue* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.value_){}
|
||||
, /*decltype(_impl_._cached_size_)*/{}};
|
||||
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_impl_.value_ = from._impl_.value_;
|
||||
_this->_impl_.value_ = from._impl_.value_;
|
||||
// @@protoc_insertion_point(copy_constructor:google.protobuf.DoubleValue)
|
||||
}
|
||||
|
||||
@ -410,16 +411,12 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData DoubleValue::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*DoubleValue::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void DoubleValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<DoubleValue *>(to)->MergeFrom(
|
||||
static_cast<const DoubleValue &>(from));
|
||||
}
|
||||
|
||||
|
||||
void DoubleValue::MergeFrom(const DoubleValue& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.DoubleValue)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void DoubleValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<DoubleValue*>(&to_msg);
|
||||
auto& from = static_cast<const DoubleValue&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.DoubleValue)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
@ -428,9 +425,9 @@ void DoubleValue::MergeFrom(const DoubleValue& from) {
|
||||
uint64_t raw_value;
|
||||
memcpy(&raw_value, &tmp_value, sizeof(tmp_value));
|
||||
if (raw_value != 0) {
|
||||
_internal_set_value(from._internal_value());
|
||||
_this->_internal_set_value(from._internal_value());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void DoubleValue::CopyFrom(const DoubleValue& from) {
|
||||
@ -470,12 +467,13 @@ FloatValue::FloatValue(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
FloatValue::FloatValue(const FloatValue& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
FloatValue* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.value_){}
|
||||
, /*decltype(_impl_._cached_size_)*/{}};
|
||||
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_impl_.value_ = from._impl_.value_;
|
||||
_this->_impl_.value_ = from._impl_.value_;
|
||||
// @@protoc_insertion_point(copy_constructor:google.protobuf.FloatValue)
|
||||
}
|
||||
|
||||
@ -603,16 +601,12 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData FloatValue::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*FloatValue::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void FloatValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<FloatValue *>(to)->MergeFrom(
|
||||
static_cast<const FloatValue &>(from));
|
||||
}
|
||||
|
||||
|
||||
void FloatValue::MergeFrom(const FloatValue& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FloatValue)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void FloatValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<FloatValue*>(&to_msg);
|
||||
auto& from = static_cast<const FloatValue&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FloatValue)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
@ -621,9 +615,9 @@ void FloatValue::MergeFrom(const FloatValue& from) {
|
||||
uint32_t raw_value;
|
||||
memcpy(&raw_value, &tmp_value, sizeof(tmp_value));
|
||||
if (raw_value != 0) {
|
||||
_internal_set_value(from._internal_value());
|
||||
_this->_internal_set_value(from._internal_value());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void FloatValue::CopyFrom(const FloatValue& from) {
|
||||
@ -663,12 +657,13 @@ Int64Value::Int64Value(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
Int64Value::Int64Value(const Int64Value& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
Int64Value* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.value_){}
|
||||
, /*decltype(_impl_._cached_size_)*/{}};
|
||||
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_impl_.value_ = from._impl_.value_;
|
||||
_this->_impl_.value_ = from._impl_.value_;
|
||||
// @@protoc_insertion_point(copy_constructor:google.protobuf.Int64Value)
|
||||
}
|
||||
|
||||
@ -788,23 +783,19 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Int64Value::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Int64Value::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void Int64Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<Int64Value *>(to)->MergeFrom(
|
||||
static_cast<const Int64Value &>(from));
|
||||
}
|
||||
|
||||
|
||||
void Int64Value::MergeFrom(const Int64Value& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Int64Value)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void Int64Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<Int64Value*>(&to_msg);
|
||||
auto& from = static_cast<const Int64Value&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Int64Value)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
if (from._internal_value() != 0) {
|
||||
_internal_set_value(from._internal_value());
|
||||
_this->_internal_set_value(from._internal_value());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void Int64Value::CopyFrom(const Int64Value& from) {
|
||||
@ -844,12 +835,13 @@ UInt64Value::UInt64Value(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
UInt64Value::UInt64Value(const UInt64Value& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
UInt64Value* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.value_){}
|
||||
, /*decltype(_impl_._cached_size_)*/{}};
|
||||
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_impl_.value_ = from._impl_.value_;
|
||||
_this->_impl_.value_ = from._impl_.value_;
|
||||
// @@protoc_insertion_point(copy_constructor:google.protobuf.UInt64Value)
|
||||
}
|
||||
|
||||
@ -969,23 +961,19 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData UInt64Value::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*UInt64Value::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void UInt64Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<UInt64Value *>(to)->MergeFrom(
|
||||
static_cast<const UInt64Value &>(from));
|
||||
}
|
||||
|
||||
|
||||
void UInt64Value::MergeFrom(const UInt64Value& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.UInt64Value)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void UInt64Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<UInt64Value*>(&to_msg);
|
||||
auto& from = static_cast<const UInt64Value&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.UInt64Value)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
if (from._internal_value() != 0) {
|
||||
_internal_set_value(from._internal_value());
|
||||
_this->_internal_set_value(from._internal_value());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void UInt64Value::CopyFrom(const UInt64Value& from) {
|
||||
@ -1025,12 +1013,13 @@ Int32Value::Int32Value(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
Int32Value::Int32Value(const Int32Value& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
Int32Value* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.value_){}
|
||||
, /*decltype(_impl_._cached_size_)*/{}};
|
||||
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_impl_.value_ = from._impl_.value_;
|
||||
_this->_impl_.value_ = from._impl_.value_;
|
||||
// @@protoc_insertion_point(copy_constructor:google.protobuf.Int32Value)
|
||||
}
|
||||
|
||||
@ -1150,23 +1139,19 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Int32Value::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Int32Value::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void Int32Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<Int32Value *>(to)->MergeFrom(
|
||||
static_cast<const Int32Value &>(from));
|
||||
}
|
||||
|
||||
|
||||
void Int32Value::MergeFrom(const Int32Value& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Int32Value)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void Int32Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<Int32Value*>(&to_msg);
|
||||
auto& from = static_cast<const Int32Value&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Int32Value)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
if (from._internal_value() != 0) {
|
||||
_internal_set_value(from._internal_value());
|
||||
_this->_internal_set_value(from._internal_value());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void Int32Value::CopyFrom(const Int32Value& from) {
|
||||
@ -1206,12 +1191,13 @@ UInt32Value::UInt32Value(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
UInt32Value::UInt32Value(const UInt32Value& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
UInt32Value* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.value_){}
|
||||
, /*decltype(_impl_._cached_size_)*/{}};
|
||||
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_impl_.value_ = from._impl_.value_;
|
||||
_this->_impl_.value_ = from._impl_.value_;
|
||||
// @@protoc_insertion_point(copy_constructor:google.protobuf.UInt32Value)
|
||||
}
|
||||
|
||||
@ -1331,23 +1317,19 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData UInt32Value::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*UInt32Value::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void UInt32Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<UInt32Value *>(to)->MergeFrom(
|
||||
static_cast<const UInt32Value &>(from));
|
||||
}
|
||||
|
||||
|
||||
void UInt32Value::MergeFrom(const UInt32Value& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.UInt32Value)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void UInt32Value::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<UInt32Value*>(&to_msg);
|
||||
auto& from = static_cast<const UInt32Value&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.UInt32Value)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
if (from._internal_value() != 0) {
|
||||
_internal_set_value(from._internal_value());
|
||||
_this->_internal_set_value(from._internal_value());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void UInt32Value::CopyFrom(const UInt32Value& from) {
|
||||
@ -1387,12 +1369,13 @@ BoolValue::BoolValue(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
BoolValue::BoolValue(const BoolValue& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
BoolValue* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.value_){}
|
||||
, /*decltype(_impl_._cached_size_)*/{}};
|
||||
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_impl_.value_ = from._impl_.value_;
|
||||
_this->_impl_.value_ = from._impl_.value_;
|
||||
// @@protoc_insertion_point(copy_constructor:google.protobuf.BoolValue)
|
||||
}
|
||||
|
||||
@ -1512,23 +1495,19 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData BoolValue::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*BoolValue::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void BoolValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<BoolValue *>(to)->MergeFrom(
|
||||
static_cast<const BoolValue &>(from));
|
||||
}
|
||||
|
||||
|
||||
void BoolValue::MergeFrom(const BoolValue& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.BoolValue)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void BoolValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<BoolValue*>(&to_msg);
|
||||
auto& from = static_cast<const BoolValue&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.BoolValue)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
if (from._internal_value() != 0) {
|
||||
_internal_set_value(from._internal_value());
|
||||
_this->_internal_set_value(from._internal_value());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void BoolValue::CopyFrom(const BoolValue& from) {
|
||||
@ -1568,6 +1547,7 @@ StringValue::StringValue(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
StringValue::StringValue(const StringValue& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
StringValue* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.value_){}
|
||||
, /*decltype(_impl_._cached_size_)*/{}};
|
||||
@ -1578,8 +1558,8 @@ StringValue::StringValue(const StringValue& from)
|
||||
_impl_.value_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_value().empty()) {
|
||||
_impl_.value_.Set(from._internal_value(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.value_.Set(from._internal_value(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
// @@protoc_insertion_point(copy_constructor:google.protobuf.StringValue)
|
||||
}
|
||||
@ -1713,23 +1693,19 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData StringValue::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*StringValue::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void StringValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<StringValue *>(to)->MergeFrom(
|
||||
static_cast<const StringValue &>(from));
|
||||
}
|
||||
|
||||
|
||||
void StringValue::MergeFrom(const StringValue& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.StringValue)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void StringValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<StringValue*>(&to_msg);
|
||||
auto& from = static_cast<const StringValue&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.StringValue)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
if (!from._internal_value().empty()) {
|
||||
_internal_set_value(from._internal_value());
|
||||
_this->_internal_set_value(from._internal_value());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void StringValue::CopyFrom(const StringValue& from) {
|
||||
@ -1774,6 +1750,7 @@ BytesValue::BytesValue(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
BytesValue::BytesValue(const BytesValue& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
BytesValue* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.value_){}
|
||||
, /*decltype(_impl_._cached_size_)*/{}};
|
||||
@ -1784,8 +1761,8 @@ BytesValue::BytesValue(const BytesValue& from)
|
||||
_impl_.value_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_value().empty()) {
|
||||
_impl_.value_.Set(from._internal_value(),
|
||||
GetArenaForAllocation());
|
||||
_this->_impl_.value_.Set(from._internal_value(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
// @@protoc_insertion_point(copy_constructor:google.protobuf.BytesValue)
|
||||
}
|
||||
@ -1914,23 +1891,19 @@ const ::PROTOBUF_NAMESPACE_ID::Message::ClassData BytesValue::_class_data_ = {
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*BytesValue::GetClassData() const { return &_class_data_; }
|
||||
|
||||
void BytesValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to,
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message& from) {
|
||||
static_cast<BytesValue *>(to)->MergeFrom(
|
||||
static_cast<const BytesValue &>(from));
|
||||
}
|
||||
|
||||
|
||||
void BytesValue::MergeFrom(const BytesValue& from) {
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.BytesValue)
|
||||
GOOGLE_DCHECK_NE(&from, this);
|
||||
void BytesValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<BytesValue*>(&to_msg);
|
||||
auto& from = static_cast<const BytesValue&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.BytesValue)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
if (!from._internal_value().empty()) {
|
||||
_internal_set_value(from._internal_value());
|
||||
_this->_internal_set_value(from._internal_value());
|
||||
}
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void BytesValue::CopyFrom(const BytesValue& from) {
|
||||
|
@ -168,9 +168,11 @@ class PROTOBUF_EXPORT DoubleValue final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const DoubleValue& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const DoubleValue& from);
|
||||
void MergeFrom( const DoubleValue& from) {
|
||||
DoubleValue::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -314,9 +316,11 @@ class PROTOBUF_EXPORT FloatValue final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const FloatValue& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const FloatValue& from);
|
||||
void MergeFrom( const FloatValue& from) {
|
||||
FloatValue::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -460,9 +464,11 @@ class PROTOBUF_EXPORT Int64Value final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const Int64Value& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const Int64Value& from);
|
||||
void MergeFrom( const Int64Value& from) {
|
||||
Int64Value::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -606,9 +612,11 @@ class PROTOBUF_EXPORT UInt64Value final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const UInt64Value& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const UInt64Value& from);
|
||||
void MergeFrom( const UInt64Value& from) {
|
||||
UInt64Value::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -752,9 +760,11 @@ class PROTOBUF_EXPORT Int32Value final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const Int32Value& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const Int32Value& from);
|
||||
void MergeFrom( const Int32Value& from) {
|
||||
Int32Value::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -898,9 +908,11 @@ class PROTOBUF_EXPORT UInt32Value final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const UInt32Value& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const UInt32Value& from);
|
||||
void MergeFrom( const UInt32Value& from) {
|
||||
UInt32Value::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -1044,9 +1056,11 @@ class PROTOBUF_EXPORT BoolValue final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const BoolValue& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const BoolValue& from);
|
||||
void MergeFrom( const BoolValue& from) {
|
||||
BoolValue::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -1190,9 +1204,11 @@ class PROTOBUF_EXPORT StringValue final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const StringValue& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const StringValue& from);
|
||||
void MergeFrom( const StringValue& from) {
|
||||
StringValue::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
@ -1341,9 +1357,11 @@ class PROTOBUF_EXPORT BytesValue final :
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const BytesValue& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom(const BytesValue& from);
|
||||
void MergeFrom( const BytesValue& from) {
|
||||
BytesValue::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message* to, const ::PROTOBUF_NAMESPACE_ID::Message& from);
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
Loading…
Reference in New Issue
Block a user