Merge pull request #6199 from haon4/201905301330

Down integrate to GitHub
pull/6201/head
Hao Nguyen 6 years ago committed by GitHub
commit da5d02bced
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      Makefile.am
  2. 11
      conformance/conformance_objc.m
  3. 6
      java/pom.xml
  4. 5
      java/util/pom.xml
  5. 65
      java/util/src/main/java/com/google/protobuf/util/Structs.java
  6. 85
      java/util/src/main/java/com/google/protobuf/util/Values.java
  7. 59
      java/util/src/test/java/com/google/protobuf/util/StructsTest.java
  8. 102
      java/util/src/test/java/com/google/protobuf/util/ValuesTest.java
  9. 2
      python/google/protobuf/descriptor_pool.py
  10. 2
      python/google/protobuf/internal/message_test.py
  11. 17
      python/google/protobuf/pyext/map_container.cc
  12. 6
      src/google/protobuf/any.pb.cc
  13. 2
      src/google/protobuf/any.pb.h
  14. 26
      src/google/protobuf/api.pb.cc
  15. 6
      src/google/protobuf/api.pb.h
  16. 2
      src/google/protobuf/compiler/cpp/cpp_field.cc
  17. 13
      src/google/protobuf/compiler/cpp/cpp_helpers.cc
  18. 4
      src/google/protobuf/compiler/cpp/cpp_message.cc
  19. 20
      src/google/protobuf/compiler/cpp/cpp_message_field.cc
  20. 2
      src/google/protobuf/compiler/cpp/cpp_string_field.cc
  21. 16
      src/google/protobuf/compiler/parser.cc
  22. 43
      src/google/protobuf/compiler/parser_unittest.cc
  23. 34
      src/google/protobuf/compiler/plugin.pb.cc
  24. 8
      src/google/protobuf/compiler/plugin.pb.h
  25. 314
      src/google/protobuf/descriptor.pb.cc
  26. 54
      src/google/protobuf/descriptor.pb.h
  27. 1
      src/google/protobuf/descriptor.proto
  28. 2
      src/google/protobuf/duration.pb.cc
  29. 2
      src/google/protobuf/duration.pb.h
  30. 2
      src/google/protobuf/empty.pb.cc
  31. 2
      src/google/protobuf/empty.pb.h
  32. 2
      src/google/protobuf/field_mask.pb.cc
  33. 2
      src/google/protobuf/field_mask.pb.h
  34. 2
      src/google/protobuf/map_test.cc
  35. 4
      src/google/protobuf/source_context.pb.cc
  36. 2
      src/google/protobuf/source_context.pb.h
  37. 18
      src/google/protobuf/struct.pb.cc
  38. 6
      src/google/protobuf/struct.pb.h
  39. 16
      src/google/protobuf/text_format.cc
  40. 5
      src/google/protobuf/text_format.h
  41. 2
      src/google/protobuf/timestamp.pb.cc
  42. 2
      src/google/protobuf/timestamp.pb.h
  43. 44
      src/google/protobuf/type.pb.cc
  44. 10
      src/google/protobuf/type.pb.h
  45. 52
      src/google/protobuf/util/internal/json_objectwriter_test.cc
  46. 22
      src/google/protobuf/wrappers.pb.cc
  47. 18
      src/google/protobuf/wrappers.pb.h

@ -493,11 +493,15 @@ java_EXTRA_DIST=
java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java \
java/util/src/main/java/com/google/protobuf/util/JsonFormat.java \
java/util/src/main/java/com/google/protobuf/util/TimeUtil.java \
java/util/src/main/java/com/google/protobuf/util/Structs.java \
java/util/src/main/java/com/google/protobuf/util/Timestamps.java \
java/util/src/main/java/com/google/protobuf/util/Values.java \
java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java \
java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java \
java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java \
java/util/src/test/java/com/google/protobuf/util/StructsTest.java \
java/util/src/test/java/com/google/protobuf/util/TimeUtilTest.java \
java/util/src/test/java/com/google/protobuf/util/ValuesTest.java \
java/util/src/test/proto/com/google/protobuf/util/json_test.proto
objectivec_EXTRA_DIST= \

@ -68,8 +68,7 @@ static ConformanceResponse *DoTest(ConformanceRequest *request) {
switch (request.payloadOneOfCase) {
case ConformanceRequest_Payload_OneOfCase_GPBUnsetOneOfCase:
response.runtimeError =
[NSString stringWithFormat:@"Request didn't have a payload: %@", request];
Die(@"Request didn't have a payload: %@", request);
break;
case ConformanceRequest_Payload_OneOfCase_ProtobufPayload: {
@ -79,10 +78,7 @@ static ConformanceResponse *DoTest(ConformanceRequest *request) {
} else if ([request.messageType isEqual:@"protobuf_test_messages.proto2.TestAllTypesProto2"]) {
msgClass = [TestAllTypesProto2 class];
} else {
response.runtimeError =
[NSString stringWithFormat:
@"Protobuf request had an unknown message_type: %@", request.messageType];
break;
Die(@"Protobuf request had an unknown message_type: %@", request.messageType);
}
NSError *error = nil;
testMessage = [msgClass parseFromData:request.protobufPayload error:&error];
@ -112,8 +108,7 @@ static ConformanceResponse *DoTest(ConformanceRequest *request) {
switch (request.requestedOutputFormat) {
case WireFormat_GPBUnrecognizedEnumeratorValue:
case WireFormat_Unspecified:
response.runtimeError =
[NSString stringWithFormat:@"Unrecognized/unspecified output format: %@", request];
Die(@"Unrecognized/unspecified output format: %@", request);
break;
case WireFormat_Protobuf:

@ -101,6 +101,12 @@
<version>26.0-jre</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.truth</groupId>
<artifactId>truth</artifactId>
<version>0.45</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>

@ -49,6 +49,11 @@
<groupId>org.easymock</groupId>
<artifactId>easymockclassextension</artifactId>
</dependency>
<dependency>
<groupId>com.google.truth</groupId>
<artifactId>truth</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<properties>

@ -0,0 +1,65 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package com.google.protobuf.util;
import com.google.protobuf.Struct;
import com.google.protobuf.Value;
/** Utilities to help create {@code google.protobuf.Struct} messages. */
public final class Structs {
/**
* Returns a struct containing the key-value pair.
*/
public static Struct of(String k1, Value v1) {
return Struct.newBuilder().putFields(k1, v1).build();
}
/**
* Returns a struct containing each of the key-value pairs.
*
* <p>Providing duplicate keys is undefined behavior.
*/
public static Struct of(String k1, Value v1, String k2, Value v2) {
return Struct.newBuilder().putFields(k1, v1).putFields(k2, v2).build();
}
/**
* Returns a struct containing each of the key-value pairs.
*
* <p>Providing duplicate keys is undefined behavior.
*/
public static Struct of(String k1, Value v1, String k2, Value v2, String k3, Value v3) {
return Struct.newBuilder().putFields(k1, v1).putFields(k2, v2).putFields(k3, v3).build();
}
private Structs() {}
}

@ -0,0 +1,85 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package com.google.protobuf.util;
import com.google.protobuf.ListValue;
import com.google.protobuf.NullValue;
import com.google.protobuf.Struct;
import com.google.protobuf.Value;
/** Utilities to help create {@code google.protobuf.Value} messages. */
public final class Values {
private static final Value NULL_VALUE =
Value.newBuilder().setNullValue(NullValue.NULL_VALUE).build();
public static Value ofNull() {
return NULL_VALUE;
}
/** Returns a Value object with number set to value. */
public static Value of(boolean value) {
return Value.newBuilder().setBoolValue(value).build();
}
/** Returns a Value object with number set to value. */
public static Value of(double value) {
return Value.newBuilder().setNumberValue(value).build();
}
/** Returns a Value object with string set to value. */
public static Value of(String value) {
return Value.newBuilder().setStringValue(value).build();
}
/** Returns a Value object with struct set to value. */
public static Value of(Struct value) {
return Value.newBuilder().setStructValue(value).build();
}
/** Returns a Value with ListValue set to value. */
public static Value of(ListValue value) {
return Value.newBuilder().setListValue(value).build();
}
/**
* Returns a Value with ListValue set to the appending the result of calling {@link #of(Object)}
* on each element in the iterable.
*/
public static Value of(Iterable<Value> values) {
Value.Builder valueBuilder = Value.newBuilder();
ListValue.Builder listValue = valueBuilder.getListValueBuilder();
listValue.addAllValues(values);
return valueBuilder.build();
}
private Values() {}
}

@ -0,0 +1,59 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package com.google.protobuf.util;
import static com.google.common.truth.Truth.assertThat;
import com.google.protobuf.Struct;
import junit.framework.TestCase;
public final class StructsTest extends TestCase {
public void test1pair_constructsObject() throws Exception {
Struct.Builder expected = Struct.newBuilder();
JsonFormat.parser().merge("{\"k1\": 1}", expected);
assertThat(Structs.of("k1", Values.of(1))).isEqualTo(expected.build());
}
public void test2pair_constructsObject() throws Exception {
Struct.Builder expected = Struct.newBuilder();
JsonFormat.parser().merge("{\"k1\": 1, \"k2\": 2}", expected);
assertThat(Structs.of("k1", Values.of(1), "k2", Values.of(2))).isEqualTo(expected.build());
}
public void test3pair_constructsObject() throws Exception {
Struct.Builder expected = Struct.newBuilder();
JsonFormat.parser().merge("{\"k1\": 1, \"k2\": 2, \"k3\": 3}", expected);
assertThat(Structs.of("k1", Values.of(1), "k2", Values.of(2), "k3", Values.of(3)))
.isEqualTo(expected.build());
}
}

@ -0,0 +1,102 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package com.google.protobuf.util;
import static com.google.common.truth.Truth.assertThat;
import com.google.protobuf.ListValue;
import com.google.protobuf.NullValue;
import com.google.protobuf.Struct;
import com.google.protobuf.Value;
import java.util.ArrayList;
import java.util.List;
import junit.framework.TestCase;
public final class ValuesTest extends TestCase {
public void testOfNull_IsNullValue() throws Exception {
assertThat(Values.ofNull())
.isEqualTo(Value.newBuilder().setNullValue(NullValue.NULL_VALUE).build());
}
public void testOfBoolean_ConstructsValue() {
assertThat(Values.of(true)).isEqualTo(Value.newBuilder().setBoolValue(true).build());
assertThat(Values.of(false)).isEqualTo(Value.newBuilder().setBoolValue(false).build());
}
public void testOfNumeric_ConstructsValue() {
assertThat(Values.of(100)).isEqualTo(Value.newBuilder().setNumberValue(100).build());
assertThat(Values.of(1000L)).isEqualTo(Value.newBuilder().setNumberValue(1000).build());
assertThat(Values.of(1000.23f)).isEqualTo(Value.newBuilder().setNumberValue(1000.23f).build());
assertThat(Values.of(10000.23)).isEqualTo(Value.newBuilder().setNumberValue(10000.23).build());
}
public void testOfString_ConstructsValue() {
assertThat(Values.of("")).isEqualTo(Value.newBuilder().setStringValue("").build());
assertThat(Values.of("foo")).isEqualTo(Value.newBuilder().setStringValue("foo").build());
}
public void testOfStruct_ConstructsValue() {
Struct.Builder builder = Struct.newBuilder();
builder.putFields("a", Values.of("a"));
builder.putFields("b", Values.of("b"));
assertThat(Values.of(builder.build()))
.isEqualTo(Value.newBuilder().setStructValue(builder.build()).build());
}
public void testOfListValue_ConstructsInstance() {
ListValue.Builder builder = ListValue.newBuilder();
builder.addValues(Values.of(1));
builder.addValues(Values.of(2));
assertThat(Values.of(builder.build()))
.isEqualTo(Value.newBuilder().setListValue(builder.build()).build());
}
public void testOfIterable_ReturnsTheValue() {
ListValue.Builder builder = ListValue.newBuilder();
builder.addValues(Values.of(1));
builder.addValues(Values.of(2));
builder.addValues(Values.of(true));
builder.addValues(Value.newBuilder().setListValue(builder.build()).build());
List<Value> list = new ArrayList<>();
list.add(Values.of(1));
list.add(Values.of(2));
list.add(Values.of(true));
List<Value> copyList = new ArrayList<>(list);
list.add(Values.of(copyList));
assertThat(Values.of(list)).isEqualTo(Value.newBuilder().setListValue(builder).build());
assertThat(Values.of(new ArrayList<Value>()))
.isEqualTo(Value.newBuilder().setListValue(ListValue.getDefaultInstance()).build());
}
}

@ -99,8 +99,6 @@ def _IsMessageSetExtension(field):
field.label == descriptor.FieldDescriptor.LABEL_OPTIONAL)
class DescriptorPool(object):
"""A collection of protobufs dynamically constructed by descriptor protos."""

@ -1725,6 +1725,7 @@ class Proto3Test(unittest.TestCase):
self.assertIsNone(msg.map_int32_int32.get(5))
self.assertEqual(10, msg.map_int32_int32.get(5, 10))
self.assertEqual(10, msg.map_int32_int32.get(key=5, default=10))
self.assertIsNone(msg.map_int32_int32.get(5))
msg.map_int32_int32[5] = 15
@ -1735,6 +1736,7 @@ class Proto3Test(unittest.TestCase):
self.assertIsNone(msg.map_int32_foreign_message.get(5))
self.assertEqual(10, msg.map_int32_foreign_message.get(5, 10))
self.assertEqual(10, msg.map_int32_foreign_message.get(key=5, default=10))
submsg = msg.map_int32_foreign_message[5]
self.assertIs(submsg, msg.map_int32_foreign_message.get(5))

@ -464,10 +464,13 @@ int MapReflectionFriend::ScalarMapSetItem(PyObject* _self, PyObject* key,
}
}
static PyObject* ScalarMapGet(PyObject* self, PyObject* args) {
static PyObject* ScalarMapGet(PyObject* self, PyObject* args,
PyObject* kwargs) {
static char* kwlist[] = {"key", "default", nullptr};
PyObject* key;
PyObject* default_value = NULL;
if (PyArg_ParseTuple(args, "O|O", &key, &default_value) < 0) {
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O", kwlist, &key,
&default_value)) {
return NULL;
}
@ -536,7 +539,7 @@ static PyMethodDef ScalarMapMethods[] = {
"Tests whether a key is a member of the map."},
{"clear", (PyCFunction)Clear, METH_NOARGS,
"Removes all elements from the map."},
{ "get", ScalarMapGet, METH_VARARGS,
{"get", (PyCFunction)ScalarMapGet, METH_VARARGS | METH_KEYWORDS,
"Gets the value for the given key if present, or otherwise a default"},
{"GetEntryClass", (PyCFunction)GetEntryClass, METH_NOARGS,
"Return the class used to build Entries of (key, value) pairs."},
@ -773,10 +776,12 @@ PyObject* MapReflectionFriend::MessageMapToStr(PyObject* _self) {
return PyObject_Repr(dict.get());
}
PyObject* MessageMapGet(PyObject* self, PyObject* args) {
PyObject* MessageMapGet(PyObject* self, PyObject* args, PyObject* kwargs) {
static char* kwlist[] = {"key", "default", nullptr};
PyObject* key;
PyObject* default_value = NULL;
if (PyArg_ParseTuple(args, "O|O", &key, &default_value) < 0) {
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O", kwlist, &key,
&default_value)) {
return NULL;
}
@ -814,7 +819,7 @@ static PyMethodDef MessageMapMethods[] = {
"Tests whether the map contains this element."},
{"clear", (PyCFunction)Clear, METH_NOARGS,
"Removes all elements from the map."},
{ "get", MessageMapGet, METH_VARARGS,
{"get", (PyCFunction)MessageMapGet, METH_VARARGS | METH_KEYWORDS,
"Gets the value for the given key if present, or otherwise a default"},
{"get_or_create", MapReflectionFriend::MessageMapGetItem, METH_O,
"Alias for getitem, useful to make explicit that the map is mutated."},

@ -111,7 +111,7 @@ bool Any::ParseAnyTypeUrl(const string& type_url,
full_type_name);
}
class Any::HasBitSetters {
class Any::_Internal {
public:
};
@ -131,11 +131,11 @@ Any::Any(const Any& from)
_any_metadata_(&type_url_, &value_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from.type_url().size() > 0) {
if (!from.type_url().empty()) {
type_url_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.type_url_);
}
value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from.value().size() > 0) {
if (!from.value().empty()) {
value_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.value_);
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.Any)

@ -217,7 +217,7 @@ class PROTOBUF_EXPORT Any :
// @@protoc_insertion_point(class_scope:google.protobuf.Any)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr type_url_;

@ -178,13 +178,13 @@ void Api::InitAsDefaultInstance() {
PROTOBUF_NAMESPACE_ID::_Api_default_instance_._instance.get_mutable()->source_context_ = const_cast< PROTOBUF_NAMESPACE_ID::SourceContext*>(
PROTOBUF_NAMESPACE_ID::SourceContext::internal_default_instance());
}
class Api::HasBitSetters {
class Api::_Internal {
public:
static const PROTOBUF_NAMESPACE_ID::SourceContext& source_context(const Api* msg);
};
const PROTOBUF_NAMESPACE_ID::SourceContext&
Api::HasBitSetters::source_context(const Api* msg) {
Api::_Internal::source_context(const Api* msg) {
return *msg->source_context_;
}
void Api::clear_options() {
@ -219,11 +219,11 @@ Api::Api(const Api& from)
mixins_(from.mixins_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from.name().size() > 0) {
if (!from.name().empty()) {
name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_);
}
version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from.version().size() > 0) {
if (!from.version().empty()) {
version_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.version_);
}
if (from.has_source_context()) {
@ -542,7 +542,7 @@ void Api::SerializeWithCachedSizes(
// .google.protobuf.SourceContext source_context = 5;
if (this->has_source_context()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteMessageMaybeToArray(
5, HasBitSetters::source_context(this), output);
5, _Internal::source_context(this), output);
}
// repeated .google.protobuf.Mixin mixins = 6;
@ -615,7 +615,7 @@ void Api::SerializeWithCachedSizes(
if (this->has_source_context()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(
5, HasBitSetters::source_context(this), target);
5, _Internal::source_context(this), target);
}
// repeated .google.protobuf.Mixin mixins = 6;
@ -804,7 +804,7 @@ void Api::InternalSwap(Api* other) {
void Method::InitAsDefaultInstance() {
}
class Method::HasBitSetters {
class Method::_Internal {
public:
};
@ -832,15 +832,15 @@ Method::Method(const Method& from)
options_(from.options_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from.name().size() > 0) {
if (!from.name().empty()) {
name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_);
}
request_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from.request_type_url().size() > 0) {
if (!from.request_type_url().empty()) {
request_type_url_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.request_type_url_);
}
response_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from.response_type_url().size() > 0) {
if (!from.response_type_url().empty()) {
response_type_url_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.response_type_url_);
}
::memcpy(&request_streaming_, &from.request_streaming_,
@ -1402,7 +1402,7 @@ void Method::InternalSwap(Method* other) {
void Mixin::InitAsDefaultInstance() {
}
class Mixin::HasBitSetters {
class Mixin::_Internal {
public:
};
@ -1421,11 +1421,11 @@ Mixin::Mixin(const Mixin& from)
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from.name().size() > 0) {
if (!from.name().empty()) {
name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_);
}
root_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from.root().size() > 0) {
if (!from.root().empty()) {
root_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.root_);
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.Mixin)

@ -262,7 +262,7 @@ class PROTOBUF_EXPORT Api :
// @@protoc_insertion_point(class_scope:google.protobuf.Api)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Method > methods_;
@ -454,7 +454,7 @@ class PROTOBUF_EXPORT Method :
// @@protoc_insertion_point(class_scope:google.protobuf.Method)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< PROTOBUF_NAMESPACE_ID::Option > options_;
@ -604,7 +604,7 @@ class PROTOBUF_EXPORT Mixin :
// @@protoc_insertion_point(class_scope:google.protobuf.Mixin)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_;

@ -77,7 +77,7 @@ void SetCommonFieldVariables(const FieldDescriptor* descriptor,
(*variables)["clear_hasbit"] = "";
if (HasFieldPresence(descriptor->file())) {
(*variables)["set_hasbit_io"] =
"HasBitSetters::set_has_" + FieldName(descriptor) + "(&_has_bits_);";
"_Internal::set_has_" + FieldName(descriptor) + "(&_has_bits_);";
} else {
(*variables)["set_hasbit_io"] = "";
}

@ -1381,7 +1381,7 @@ class ParseLoopGenerator {
// For now only optimize small hasbits.
if (hasbits_size != 1) hasbits_size = 0;
if (hasbits_size) {
format_("HasBitSetters::HasBits has_bits{};\n");
format_("_Internal::HasBits has_bits{};\n");
format_.Set("has_bits", "has_bits");
} else {
format_.Set("has_bits", "_has_bits_");
@ -1420,7 +1420,7 @@ class ParseLoopGenerator {
field_name = ", kFieldName";
}
if (HasFieldPresence(field->file())) {
format_("HasBitSetters::set_has_$1$(&$has_bits$);\n", FieldName(field));
format_("_Internal::set_has_$1$(&$has_bits$);\n", FieldName(field));
}
string default_string =
field->default_value_string().empty()
@ -1536,7 +1536,7 @@ class ParseLoopGenerator {
FieldName(field), field->containing_oneof()->name());
} else if (HasFieldPresence(field->file())) {
format_(
"HasBitSetters::set_has_$1$(&$has_bits$);\n"
"_Internal::set_has_$1$(&$has_bits$);\n"
"ptr = ctx->ParseMessage(&$1$_, ptr);\n",
FieldName(field));
} else {
@ -1546,7 +1546,7 @@ class ParseLoopGenerator {
} else if (IsImplicitWeakField(field, options_, scc_analyzer_)) {
if (!field->is_repeated()) {
format_(
"ptr = ctx->ParseMessage(HasBitSetters::mutable_$1$(this), "
"ptr = ctx->ParseMessage(_Internal::mutable_$1$(this), "
"ptr);\n",
FieldName(field));
} else {
@ -1633,7 +1633,7 @@ class ParseLoopGenerator {
prefix, FieldName(field), zigzag);
} else {
if (HasFieldPresence(field->file())) {
format_("HasBitSetters::set_has_$1$(&$has_bits$);\n",
format_("_Internal::set_has_$1$(&$has_bits$);\n",
FieldName(field));
}
format_(
@ -1655,8 +1655,7 @@ class ParseLoopGenerator {
prefix, FieldName(field), type);
} else {
if (HasFieldPresence(field->file())) {
format_("HasBitSetters::set_has_$1$(&$has_bits$);\n",
FieldName(field));
format_("_Internal::set_has_$1$(&$has_bits$);\n", FieldName(field));
}
format_(
"$1$_ = $pi_ns$::UnalignedLoad<$2$>(ptr);\n"

@ -1392,7 +1392,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
format(" private:\n");
format.Indent();
// TODO(seongkim): Remove hack to track field access and remove this class.
format("class HasBitSetters;\n");
format("class _Internal;\n");
for (auto field : FieldRange(descriptor_)) {
@ -1990,7 +1990,7 @@ void MessageGenerator::GenerateClassMethods(io::Printer* printer) {
}
format(
"class $classname$::HasBitSetters {\n"
"class $classname$::_Internal {\n"
" public:\n");
format.Indent();
if (HasFieldPresence(descriptor_->file()) && HasBitsSize() != 0) {

@ -269,7 +269,7 @@ void MessageFieldGenerator::GenerateInternalAccessorDeclarations(
void MessageFieldGenerator::GenerateInternalAccessorDefinitions(
io::Printer* printer) const {
// In theory, these accessors could be inline in HasBitSetters. However, in
// In theory, these accessors could be inline in _Internal. However, in
// practice, the linker is then not able to throw them out making implicit
// weak dependencies not work at all.
Formatter format(printer, variables_);
@ -278,7 +278,7 @@ void MessageFieldGenerator::GenerateInternalAccessorDefinitions(
// MergePartialFromCodedStream, and their purpose is to provide access to
// the field without creating a strong dependency on the message type.
format(
"const ::$proto_ns$::MessageLite& $classname$::HasBitSetters::$name$(\n"
"const ::$proto_ns$::MessageLite& $classname$::_Internal::$name$(\n"
" const $classname$* msg) {\n"
" if (msg->$name$_ != nullptr) {\n"
" return *msg->$name$_;\n"
@ -293,7 +293,7 @@ void MessageFieldGenerator::GenerateInternalAccessorDefinitions(
if (SupportsArenas(descriptor_)) {
format(
"::$proto_ns$::MessageLite*\n"
"$classname$::HasBitSetters::mutable_$name$($classname$* msg) {\n");
"$classname$::_Internal::mutable_$name$($classname$* msg) {\n");
if (HasFieldPresence(descriptor_->file())) {
format(" msg->$set_hasbit$\n");
}
@ -315,7 +315,7 @@ void MessageFieldGenerator::GenerateInternalAccessorDefinitions(
} else {
format(
"::$proto_ns$::MessageLite*\n"
"$classname$::HasBitSetters::mutable_$name$($classname$* msg) {\n");
"$classname$::_Internal::mutable_$name$($classname$* msg) {\n");
if (HasFieldPresence(descriptor_->file())) {
format(" msg->$set_hasbit$\n");
}
@ -339,7 +339,7 @@ void MessageFieldGenerator::GenerateInternalAccessorDefinitions(
// message fields under serialize.
format(
"const $type$&\n"
"$classname$::HasBitSetters::$name$(const $classname$* msg) {\n"
"$classname$::_Internal::$name$(const $classname$* msg) {\n"
" return *msg->$field_member$;\n"
"}\n");
}
@ -382,8 +382,8 @@ void MessageFieldGenerator::GenerateMergingCode(io::Printer* printer) const {
Formatter format(printer, variables_);
if (implicit_weak_field_) {
format(
"HasBitSetters::mutable_$name$(this)->CheckTypeAndMergeFrom(\n"
" HasBitSetters::$name$(&from));\n");
"_Internal::mutable_$name$(this)->CheckTypeAndMergeFrom(\n"
" _Internal::$name$(&from));\n");
} else {
format("mutable_$name$()->$type$::MergeFrom(from.$name$());\n");
}
@ -430,7 +430,7 @@ void MessageFieldGenerator::GenerateMergeFromCodedStream(
if (implicit_weak_field_) {
format(
"DO_(::$proto_ns$::internal::WireFormatLite::ReadMessage(\n"
" input, HasBitSetters::mutable_$name$(this)));\n");
" input, _Internal::mutable_$name$(this)));\n");
} else if (descriptor_->type() == FieldDescriptor::TYPE_MESSAGE) {
format(
"DO_(::$proto_ns$::internal::WireFormatLite::ReadMessage(\n"
@ -447,7 +447,7 @@ void MessageFieldGenerator::GenerateSerializeWithCachedSizes(
Formatter format(printer, variables_);
format(
"::$proto_ns$::internal::WireFormatLite::Write$stream_writer$(\n"
" $number$, HasBitSetters::$name$(this), output);\n");
" $number$, _Internal::$name$(this), output);\n");
}
void MessageFieldGenerator::GenerateSerializeWithCachedSizesToArray(
@ -456,7 +456,7 @@ void MessageFieldGenerator::GenerateSerializeWithCachedSizesToArray(
format(
"target = ::$proto_ns$::internal::WireFormatLite::\n"
" InternalWrite$declared_type$ToArray(\n"
" $number$, HasBitSetters::$name$(this), target);\n");
" $number$, _Internal::$name$(this), target);\n");
}
void MessageFieldGenerator::GenerateByteSize(io::Printer* printer) const {

@ -519,7 +519,7 @@ void StringFieldGenerator::GenerateCopyConstructorCode(
if (HasFieldPresence(descriptor_->file())) {
format("if (from.has_$name$()) {\n");
} else {
format("if (from.$name$().size() > 0) {\n");
format("if (!from.$name$().empty()) {\n");
}
format.Indent();

@ -157,6 +157,16 @@ bool IsLowerUnderscore(const string& name) {
return true;
}
bool IsNumberFollowUnderscore(const string& name) {
for (int i = 1; i < name.length(); i++) {
const char c = name[i];
if (IsNumber(c) && name[i - 1] == '_') {
return true;
}
}
return false;
}
} // anonymous namespace
// Makes code slightly more readable. The meaning of "DO(foo)" is
@ -1004,6 +1014,12 @@ bool Parser::ParseMessageFieldNoLabel(
"Field name should be lowercase. Found: " + field->name() +
". See: https://developers.google.com/protocol-buffers/docs/style");
}
if (IsNumberFollowUnderscore(field->name())) {
AddWarning(
"Number should not come right after an underscore. Found: " +
field->name() +
". See: https://developers.google.com/protocol-buffers/docs/style");
}
}
DO(Consume("=", "Missing field number."));

@ -65,9 +65,15 @@ class MockErrorCollector : public io::ErrorCollector {
MockErrorCollector() = default;
~MockErrorCollector() override = default;
std::string warning_;
std::string text_;
// implements ErrorCollector ---------------------------------------
void AddWarning(int line, int column, const std::string& message) override {
strings::SubstituteAndAppend(&warning_, "$0:$1: $2\n", line, column,
message);
}
void AddError(int line, int column, const std::string& message) override {
strings::SubstituteAndAppend(&text_, "$0:$1: $2\n", line, column, message);
}
@ -223,6 +229,43 @@ TEST_F(ParserTest, WarnIfSyntaxIdentifierOmmitted) {
string::npos);
}
TEST_F(ParserTest, WarnIfFieldNameIsNotUpperCamel) {
SetupParser(
"syntax = \"proto2\";"
"message abc {}");
FileDescriptorProto file;
EXPECT_TRUE(parser_->Parse(input_.get(), &file));
EXPECT_TRUE(error_collector_.warning_.find(
"Message name should be in UpperCamelCase. Found: abc.") !=
string::npos);
}
TEST_F(ParserTest, WarnIfFieldNameIsNotLowerUnderscore) {
SetupParser(
"syntax = \"proto2\";"
"message A {"
" optional string SongName = 1;"
"}");
FileDescriptorProto file;
EXPECT_TRUE(parser_->Parse(input_.get(), &file));
EXPECT_TRUE(error_collector_.warning_.find(
"Field name should be lowercase. Found: SongName") !=
string::npos);
}
TEST_F(ParserTest, WarnIfFieldNameContainsNumberImmediatelyFollowUnderscore) {
SetupParser(
"syntax = \"proto2\";"
"message A {"
" optional string song_name_1 = 1;"
"}");
FileDescriptorProto file;
EXPECT_TRUE(parser_->Parse(input_.get(), &file));
EXPECT_TRUE(error_collector_.warning_.find(
"Number should not come right after an underscore. Found: "
"song_name_1.") != string::npos);
}
// ===================================================================
typedef ParserTest ParseMessageTest;

@ -208,7 +208,7 @@ namespace compiler {
void Version::InitAsDefaultInstance() {
}
class Version::HasBitSetters {
class Version::_Internal {
public:
using HasBits = decltype(std::declval<Version>()._has_bits_);
static void set_has_major(HasBits* has_bits) {
@ -300,7 +300,7 @@ void Version::Clear() {
#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
const char* Version::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
HasBitSetters::HasBits has_bits{};
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
@ -309,7 +309,7 @@ const char* Version::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::in
// optional int32 major = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
HasBitSetters::set_has_major(&has_bits);
_Internal::set_has_major(&has_bits);
major_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr);
CHK_(ptr);
} else goto handle_unusual;
@ -317,7 +317,7 @@ const char* Version::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::in
// optional int32 minor = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
HasBitSetters::set_has_minor(&has_bits);
_Internal::set_has_minor(&has_bits);
minor_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr);
CHK_(ptr);
} else goto handle_unusual;
@ -325,7 +325,7 @@ const char* Version::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::in
// optional int32 patch = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
HasBitSetters::set_has_patch(&has_bits);
_Internal::set_has_patch(&has_bits);
patch_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr);
CHK_(ptr);
} else goto handle_unusual;
@ -371,7 +371,7 @@ bool Version::MergePartialFromCodedStream(
// optional int32 major = 1;
case 1: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) {
HasBitSetters::set_has_major(&_has_bits_);
_Internal::set_has_major(&_has_bits_);
DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive<
::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>(
input, &major_)));
@ -384,7 +384,7 @@ bool Version::MergePartialFromCodedStream(
// optional int32 minor = 2;
case 2: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) {
HasBitSetters::set_has_minor(&_has_bits_);
_Internal::set_has_minor(&_has_bits_);
DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive<
::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>(
input, &minor_)));
@ -397,7 +397,7 @@ bool Version::MergePartialFromCodedStream(
// optional int32 patch = 3;
case 3: {
if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (24 & 0xFF)) {
HasBitSetters::set_has_patch(&_has_bits_);
_Internal::set_has_patch(&_has_bits_);
DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive<
::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>(
input, &patch_)));
@ -657,7 +657,7 @@ void CodeGeneratorRequest::InitAsDefaultInstance() {
PROTOBUF_NAMESPACE_ID::compiler::_CodeGeneratorRequest_default_instance_._instance.get_mutable()->compiler_version_ = const_cast< PROTOBUF_NAMESPACE_ID::compiler::Version*>(
PROTOBUF_NAMESPACE_ID::compiler::Version::internal_default_instance());
}
class CodeGeneratorRequest::HasBitSetters {
class CodeGeneratorRequest::_Internal {
public:
using HasBits = decltype(std::declval<CodeGeneratorRequest>()._has_bits_);
static void set_has_parameter(HasBits* has_bits) {
@ -670,7 +670,7 @@ class CodeGeneratorRequest::HasBitSetters {
};
const PROTOBUF_NAMESPACE_ID::compiler::Version&
CodeGeneratorRequest::HasBitSetters::compiler_version(const CodeGeneratorRequest* msg) {
CodeGeneratorRequest::_Internal::compiler_version(const CodeGeneratorRequest* msg) {
return *msg->compiler_version_;
}
void CodeGeneratorRequest::clear_proto_file() {
@ -757,7 +757,7 @@ void CodeGeneratorRequest::Clear() {
#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
const char* CodeGeneratorRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
HasBitSetters::HasBits has_bits{};
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
@ -936,7 +936,7 @@ void CodeGeneratorRequest::SerializeWithCachedSizes(
// optional .google.protobuf.compiler.Version compiler_version = 3;
if (cached_has_bits & 0x00000002u) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteMessageMaybeToArray(
3, HasBitSetters::compiler_version(this), output);
3, _Internal::compiler_version(this), output);
}
// repeated .google.protobuf.FileDescriptorProto proto_file = 15;
@ -987,7 +987,7 @@ void CodeGeneratorRequest::SerializeWithCachedSizes(
if (cached_has_bits & 0x00000002u) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(
3, HasBitSetters::compiler_version(this), target);
3, _Internal::compiler_version(this), target);
}
// repeated .google.protobuf.FileDescriptorProto proto_file = 15;
@ -1139,7 +1139,7 @@ void CodeGeneratorRequest::InternalSwap(CodeGeneratorRequest* other) {
void CodeGeneratorResponse_File::InitAsDefaultInstance() {
}
class CodeGeneratorResponse_File::HasBitSetters {
class CodeGeneratorResponse_File::_Internal {
public:
using HasBits = decltype(std::declval<CodeGeneratorResponse_File>()._has_bits_);
static void set_has_name(HasBits* has_bits) {
@ -1236,7 +1236,7 @@ void CodeGeneratorResponse_File::Clear() {
#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
const char* CodeGeneratorResponse_File::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
HasBitSetters::HasBits has_bits{};
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
@ -1576,7 +1576,7 @@ void CodeGeneratorResponse_File::InternalSwap(CodeGeneratorResponse_File* other)
void CodeGeneratorResponse::InitAsDefaultInstance() {
}
class CodeGeneratorResponse::HasBitSetters {
class CodeGeneratorResponse::_Internal {
public:
using HasBits = decltype(std::declval<CodeGeneratorResponse>()._has_bits_);
static void set_has_error(HasBits* has_bits) {
@ -1648,7 +1648,7 @@ void CodeGeneratorResponse::Clear() {
#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
const char* CodeGeneratorResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
HasBitSetters::HasBits has_bits{};
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);

@ -240,7 +240,7 @@ class PROTOC_EXPORT Version :
// @@protoc_insertion_point(class_scope:google.protobuf.compiler.Version)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_;
@ -423,7 +423,7 @@ class PROTOC_EXPORT CodeGeneratorRequest :
// @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorRequest)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_;
@ -593,7 +593,7 @@ class PROTOC_EXPORT CodeGeneratorResponse_File :
// @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorResponse.File)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_;
@ -750,7 +750,7 @@ class PROTOC_EXPORT CodeGeneratorResponse :
// @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorResponse)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_;

File diff suppressed because it is too large Load Diff

@ -472,7 +472,7 @@ class PROTOBUF_EXPORT FileDescriptorSet :
// @@protoc_insertion_point(class_scope:google.protobuf.FileDescriptorSet)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -795,7 +795,7 @@ class PROTOBUF_EXPORT FileDescriptorProto :
// @@protoc_insertion_point(class_scope:google.protobuf.FileDescriptorProto)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -975,7 +975,7 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange :
// @@protoc_insertion_point(class_scope:google.protobuf.DescriptorProto.ExtensionRange)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -1134,7 +1134,7 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange :
// @@protoc_insertion_point(class_scope:google.protobuf.DescriptorProto.ReservedRange)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -1417,7 +1417,7 @@ class PROTOBUF_EXPORT DescriptorProto :
// @@protoc_insertion_point(class_scope:google.protobuf.DescriptorProto)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -1582,7 +1582,7 @@ class PROTOBUF_EXPORT ExtensionRangeOptions :
GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(ExtensionRangeOptions)
// @@protoc_insertion_point(class_scope:google.protobuf.ExtensionRangeOptions)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::ExtensionSet _extensions_;
@ -1971,7 +1971,7 @@ class PROTOBUF_EXPORT FieldDescriptorProto :
// @@protoc_insertion_point(class_scope:google.protobuf.FieldDescriptorProto)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -2157,7 +2157,7 @@ class PROTOBUF_EXPORT OneofDescriptorProto :
// @@protoc_insertion_point(class_scope:google.protobuf.OneofDescriptorProto)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -2315,7 +2315,7 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange :
// @@protoc_insertion_point(class_scope:google.protobuf.EnumDescriptorProto.EnumReservedRange)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -2537,7 +2537,7 @@ class PROTOBUF_EXPORT EnumDescriptorProto :
// @@protoc_insertion_point(class_scope:google.protobuf.EnumDescriptorProto)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -2725,7 +2725,7 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto :
// @@protoc_insertion_point(class_scope:google.protobuf.EnumValueDescriptorProto)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -2916,7 +2916,7 @@ class PROTOBUF_EXPORT ServiceDescriptorProto :
// @@protoc_insertion_point(class_scope:google.protobuf.ServiceDescriptorProto)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -3153,7 +3153,7 @@ class PROTOBUF_EXPORT MethodDescriptorProto :
// @@protoc_insertion_point(class_scope:google.protobuf.MethodDescriptorProto)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -3636,7 +3636,7 @@ class PROTOBUF_EXPORT FileOptions :
GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(FileOptions)
// @@protoc_insertion_point(class_scope:google.protobuf.FileOptions)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::ExtensionSet _extensions_;
@ -3842,7 +3842,7 @@ class PROTOBUF_EXPORT MessageOptions :
GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(MessageOptions)
// @@protoc_insertion_point(class_scope:google.protobuf.MessageOptions)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::ExtensionSet _extensions_;
@ -4110,7 +4110,7 @@ class PROTOBUF_EXPORT FieldOptions :
GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(FieldOptions)
// @@protoc_insertion_point(class_scope:google.protobuf.FieldOptions)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::ExtensionSet _extensions_;
@ -4274,7 +4274,7 @@ class PROTOBUF_EXPORT OneofOptions :
GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(OneofOptions)
// @@protoc_insertion_point(class_scope:google.protobuf.OneofOptions)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::ExtensionSet _extensions_;
@ -4446,7 +4446,7 @@ class PROTOBUF_EXPORT EnumOptions :
GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(EnumOptions)
// @@protoc_insertion_point(class_scope:google.protobuf.EnumOptions)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::ExtensionSet _extensions_;
@ -4613,7 +4613,7 @@ class PROTOBUF_EXPORT EnumValueOptions :
GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(EnumValueOptions)
// @@protoc_insertion_point(class_scope:google.protobuf.EnumValueOptions)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::ExtensionSet _extensions_;
@ -4779,7 +4779,7 @@ class PROTOBUF_EXPORT ServiceOptions :
GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(ServiceOptions)
// @@protoc_insertion_point(class_scope:google.protobuf.ServiceOptions)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::ExtensionSet _extensions_;
@ -4984,7 +4984,7 @@ class PROTOBUF_EXPORT MethodOptions :
GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(MethodOptions)
// @@protoc_insertion_point(class_scope:google.protobuf.MethodOptions)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::ExtensionSet _extensions_;
@ -5160,7 +5160,7 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart :
// @@protoc_insertion_point(class_scope:google.protobuf.UninterpretedOption.NamePart)
private:
class HasBitSetters;
class _Internal;
// helper for ByteSizeLong()
size_t RequiredFieldsByteSizeFallback() const;
@ -5408,7 +5408,7 @@ class PROTOBUF_EXPORT UninterpretedOption :
// @@protoc_insertion_point(class_scope:google.protobuf.UninterpretedOption)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -5643,7 +5643,7 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location :
// @@protoc_insertion_point(class_scope:google.protobuf.SourceCodeInfo.Location)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -5806,7 +5806,7 @@ class PROTOBUF_EXPORT SourceCodeInfo :
// @@protoc_insertion_point(class_scope:google.protobuf.SourceCodeInfo)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -5997,7 +5997,7 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation :
// @@protoc_insertion_point(class_scope:google.protobuf.GeneratedCodeInfo.Annotation)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -6158,7 +6158,7 @@ class PROTOBUF_EXPORT GeneratedCodeInfo :
// @@protoc_insertion_point(class_scope:google.protobuf.GeneratedCodeInfo)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;

@ -428,6 +428,7 @@ message FileOptions {
// determining the ruby package.
optional string ruby_package = 45;
// The parser stores options it doesn't recognize here.
// See the documentation for the "Options" section above.
repeated UninterpretedOption uninterpreted_option = 999;

@ -86,7 +86,7 @@ PROTOBUF_NAMESPACE_OPEN
void Duration::InitAsDefaultInstance() {
}
class Duration::HasBitSetters {
class Duration::_Internal {
public:
};

@ -201,7 +201,7 @@ class PROTOBUF_EXPORT Duration :
// @@protoc_insertion_point(class_scope:google.protobuf.Duration)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;

@ -83,7 +83,7 @@ PROTOBUF_NAMESPACE_OPEN
void Empty::InitAsDefaultInstance() {
}
class Empty::HasBitSetters {
class Empty::_Internal {
public:
};

@ -189,7 +189,7 @@ class PROTOBUF_EXPORT Empty :
// @@protoc_insertion_point(class_scope:google.protobuf.Empty)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;

@ -85,7 +85,7 @@ PROTOBUF_NAMESPACE_OPEN
void FieldMask::InitAsDefaultInstance() {
}
class FieldMask::HasBitSetters {
class FieldMask::_Internal {
public:
};

@ -207,7 +207,7 @@ class PROTOBUF_EXPORT FieldMask :
// @@protoc_insertion_point(class_scope:google.protobuf.FieldMask)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;

@ -3083,11 +3083,13 @@ static std::string DeterministicSerialization(const T& t) {
const int size = t.ByteSize();
std::string result(size, '\0');
io::ArrayOutputStream array_stream(::google::protobuf::string_as_array(&result), size);
{
io::CodedOutputStream output_stream(&array_stream);
output_stream.SetSerializationDeterministic(true);
t.SerializeWithCachedSizes(&output_stream);
EXPECT_FALSE(output_stream.HadError());
EXPECT_EQ(size, output_stream.ByteCount());
}
EXPECT_EQ(result, DeterministicSerializationWithSerializeToCodedStream(t));
EXPECT_EQ(result,
DeterministicSerializationWithSerializePartialToCodedStream(t));

@ -86,7 +86,7 @@ PROTOBUF_NAMESPACE_OPEN
void SourceContext::InitAsDefaultInstance() {
}
class SourceContext::HasBitSetters {
class SourceContext::_Internal {
public:
};
@ -104,7 +104,7 @@ SourceContext::SourceContext(const SourceContext& from)
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
file_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from.file_name().size() > 0) {
if (!from.file_name().empty()) {
file_name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.file_name_);
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.SourceContext)

@ -189,7 +189,7 @@ class PROTOBUF_EXPORT SourceContext :
// @@protoc_insertion_point(class_scope:google.protobuf.SourceContext)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr file_name_;

@ -195,7 +195,7 @@ void Struct_FieldsEntry_DoNotUse::MergeFrom(
void Struct::InitAsDefaultInstance() {
}
class Struct::HasBitSetters {
class Struct::_Internal {
public:
};
@ -578,18 +578,18 @@ void Value::InitAsDefaultInstance() {
PROTOBUF_NAMESPACE_ID::_Value_default_instance_.list_value_ = const_cast< PROTOBUF_NAMESPACE_ID::ListValue*>(
PROTOBUF_NAMESPACE_ID::ListValue::internal_default_instance());
}
class Value::HasBitSetters {
class Value::_Internal {
public:
static const PROTOBUF_NAMESPACE_ID::Struct& struct_value(const Value* msg);
static const PROTOBUF_NAMESPACE_ID::ListValue& list_value(const Value* msg);
};
const PROTOBUF_NAMESPACE_ID::Struct&
Value::HasBitSetters::struct_value(const Value* msg) {
Value::_Internal::struct_value(const Value* msg) {
return *msg->kind_.struct_value_;
}
const PROTOBUF_NAMESPACE_ID::ListValue&
Value::HasBitSetters::list_value(const Value* msg) {
Value::_Internal::list_value(const Value* msg) {
return *msg->kind_.list_value_;
}
void Value::set_allocated_struct_value(PROTOBUF_NAMESPACE_ID::Struct* struct_value) {
@ -979,13 +979,13 @@ void Value::SerializeWithCachedSizes(
// .google.protobuf.Struct struct_value = 5;
if (has_struct_value()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteMessageMaybeToArray(
5, HasBitSetters::struct_value(this), output);
5, _Internal::struct_value(this), output);
}
// .google.protobuf.ListValue list_value = 6;
if (has_list_value()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteMessageMaybeToArray(
6, HasBitSetters::list_value(this), output);
6, _Internal::list_value(this), output);
}
if (_internal_metadata_.have_unknown_fields()) {
@ -1032,14 +1032,14 @@ void Value::SerializeWithCachedSizes(
if (has_struct_value()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(
5, HasBitSetters::struct_value(this), target);
5, _Internal::struct_value(this), target);
}
// .google.protobuf.ListValue list_value = 6;
if (has_list_value()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(
6, HasBitSetters::list_value(this), target);
6, _Internal::list_value(this), target);
}
if (_internal_metadata_.have_unknown_fields()) {
@ -1216,7 +1216,7 @@ void Value::InternalSwap(Value* other) {
void ListValue::InitAsDefaultInstance() {
}
class ListValue::HasBitSetters {
class ListValue::_Internal {
public:
};

@ -271,7 +271,7 @@ class PROTOBUF_EXPORT Struct :
// @@protoc_insertion_point(class_scope:google.protobuf.Struct)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -498,7 +498,7 @@ class PROTOBUF_EXPORT Value :
KindCase kind_case() const;
// @@protoc_insertion_point(class_scope:google.protobuf.Value)
private:
class HasBitSetters;
class _Internal;
void set_has_null_value();
void set_has_number_value();
void set_has_string_value();
@ -664,7 +664,7 @@ class PROTOBUF_EXPORT ListValue :
// @@protoc_insertion_point(class_scope:google.protobuf.ListValue)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;

@ -208,6 +208,11 @@ const FieldDescriptor* DefaultFinderFindExtension(Message* message,
name);
}
const FieldDescriptor* DefaultFinderFindExtensionByNumber(
const Descriptor* descriptor, int number) {
return descriptor->file()->pool()->FindExtensionByNumber(descriptor, number);
}
const Descriptor* DefaultFinderFindAnyType(const Message& message,
const std::string& prefix,
const std::string& name) {
@ -459,8 +464,10 @@ class TextFormat::Parser::ParserImpl {
if (allow_field_number_ &&
safe_strto32(field_name, &field_number)) {
if (descriptor->IsExtensionNumber(field_number)) {
field = descriptor->file()->pool()->FindExtensionByNumber(
descriptor, field_number);
field = finder_
? finder_->FindExtensionByNumber(descriptor, field_number)
: DefaultFinderFindExtensionByNumber(descriptor,
field_number);
} else if (descriptor->IsReservedNumber(field_number)) {
reserved_field = true;
} else {
@ -1354,6 +1361,11 @@ const FieldDescriptor* TextFormat::Finder::FindExtension(
return DefaultFinderFindExtension(message, name);
}
const FieldDescriptor* TextFormat::Finder::FindExtensionByNumber(
const Descriptor* descriptor, int number) const {
return DefaultFinderFindExtensionByNumber(descriptor, number);
}
const Descriptor* TextFormat::Finder::FindAnyType(
const Message& message, const std::string& prefix,
const std::string& name) const {

@ -208,6 +208,11 @@ class PROTOBUF_EXPORT TextFormat {
virtual const FieldDescriptor* FindExtension(Message* message,
const std::string& name) const;
// Similar to FindExtension, but uses a Descriptor and the extension number
// instead of using a Message and the name when doing the look up.
virtual const FieldDescriptor* FindExtensionByNumber(
const Descriptor* descriptor, int number) const;
// Find the message type for an Any proto.
// Returns NULL if no message is known for this name.
// The base implementation only accepts prefixes of type.googleprod.com/ or

@ -86,7 +86,7 @@ PROTOBUF_NAMESPACE_OPEN
void Timestamp::InitAsDefaultInstance() {
}
class Timestamp::HasBitSetters {
class Timestamp::_Internal {
public:
};

@ -201,7 +201,7 @@ class PROTOBUF_EXPORT Timestamp :
// @@protoc_insertion_point(class_scope:google.protobuf.Timestamp)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;

@ -360,13 +360,13 @@ void Type::InitAsDefaultInstance() {
PROTOBUF_NAMESPACE_ID::_Type_default_instance_._instance.get_mutable()->source_context_ = const_cast< PROTOBUF_NAMESPACE_ID::SourceContext*>(
PROTOBUF_NAMESPACE_ID::SourceContext::internal_default_instance());
}
class Type::HasBitSetters {
class Type::_Internal {
public:
static const PROTOBUF_NAMESPACE_ID::SourceContext& source_context(const Type* msg);
};
const PROTOBUF_NAMESPACE_ID::SourceContext&
Type::HasBitSetters::source_context(const Type* msg) {
Type::_Internal::source_context(const Type* msg) {
return *msg->source_context_;
}
void Type::unsafe_arena_set_allocated_source_context(
@ -420,7 +420,7 @@ Type::Type(const Type& from)
options_(from.options_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from.name().size() > 0) {
if (!from.name().empty()) {
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name(),
GetArenaNoVirtual());
}
@ -728,7 +728,7 @@ void Type::SerializeWithCachedSizes(
// .google.protobuf.SourceContext source_context = 5;
if (this->has_source_context()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteMessageMaybeToArray(
5, HasBitSetters::source_context(this), output);
5, _Internal::source_context(this), output);
}
// .google.protobuf.Syntax syntax = 6;
@ -791,7 +791,7 @@ void Type::SerializeWithCachedSizes(
if (this->has_source_context()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(
5, HasBitSetters::source_context(this), target);
5, _Internal::source_context(this), target);
}
// .google.protobuf.Syntax syntax = 6;
@ -970,7 +970,7 @@ void Type::InternalSwap(Type* other) {
void Field::InitAsDefaultInstance() {
}
class Field::HasBitSetters {
class Field::_Internal {
public:
};
@ -1006,22 +1006,22 @@ Field::Field(const Field& from)
options_(from.options_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from.name().size() > 0) {
if (!from.name().empty()) {
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name(),
GetArenaNoVirtual());
}
type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from.type_url().size() > 0) {
if (!from.type_url().empty()) {
type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.type_url(),
GetArenaNoVirtual());
}
json_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from.json_name().size() > 0) {
if (!from.json_name().empty()) {
json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.json_name(),
GetArenaNoVirtual());
}
default_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from.default_value().size() > 0) {
if (!from.default_value().empty()) {
default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.default_value(),
GetArenaNoVirtual());
}
@ -1751,13 +1751,13 @@ void Enum::InitAsDefaultInstance() {
PROTOBUF_NAMESPACE_ID::_Enum_default_instance_._instance.get_mutable()->source_context_ = const_cast< PROTOBUF_NAMESPACE_ID::SourceContext*>(
PROTOBUF_NAMESPACE_ID::SourceContext::internal_default_instance());
}
class Enum::HasBitSetters {
class Enum::_Internal {
public:
static const PROTOBUF_NAMESPACE_ID::SourceContext& source_context(const Enum* msg);
};
const PROTOBUF_NAMESPACE_ID::SourceContext&
Enum::HasBitSetters::source_context(const Enum* msg) {
Enum::_Internal::source_context(const Enum* msg) {
return *msg->source_context_;
}
void Enum::unsafe_arena_set_allocated_source_context(
@ -1808,7 +1808,7 @@ Enum::Enum(const Enum& from)
options_(from.options_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from.name().size() > 0) {
if (!from.name().empty()) {
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name(),
GetArenaNoVirtual());
}
@ -2077,7 +2077,7 @@ void Enum::SerializeWithCachedSizes(
// .google.protobuf.SourceContext source_context = 4;
if (this->has_source_context()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteMessageMaybeToArray(
4, HasBitSetters::source_context(this), output);
4, _Internal::source_context(this), output);
}
// .google.protobuf.Syntax syntax = 5;
@ -2130,7 +2130,7 @@ void Enum::SerializeWithCachedSizes(
if (this->has_source_context()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(
4, HasBitSetters::source_context(this), target);
4, _Internal::source_context(this), target);
}
// .google.protobuf.Syntax syntax = 5;
@ -2299,7 +2299,7 @@ void Enum::InternalSwap(Enum* other) {
void EnumValue::InitAsDefaultInstance() {
}
class EnumValue::HasBitSetters {
class EnumValue::_Internal {
public:
};
@ -2328,7 +2328,7 @@ EnumValue::EnumValue(const EnumValue& from)
options_(from.options_) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from.name().size() > 0) {
if (!from.name().empty()) {
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name(),
GetArenaNoVirtual());
}
@ -2710,13 +2710,13 @@ void Option::InitAsDefaultInstance() {
PROTOBUF_NAMESPACE_ID::_Option_default_instance_._instance.get_mutable()->value_ = const_cast< PROTOBUF_NAMESPACE_ID::Any*>(
PROTOBUF_NAMESPACE_ID::Any::internal_default_instance());
}
class Option::HasBitSetters {
class Option::_Internal {
public:
static const PROTOBUF_NAMESPACE_ID::Any& value(const Option* msg);
};
const PROTOBUF_NAMESPACE_ID::Any&
Option::HasBitSetters::value(const Option* msg) {
Option::_Internal::value(const Option* msg) {
return *msg->value_;
}
void Option::unsafe_arena_set_allocated_value(
@ -2760,7 +2760,7 @@ Option::Option(const Option& from)
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from.name().size() > 0) {
if (!from.name().empty()) {
name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name(),
GetArenaNoVirtual());
}
@ -2937,7 +2937,7 @@ void Option::SerializeWithCachedSizes(
// .google.protobuf.Any value = 2;
if (this->has_value()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteMessageMaybeToArray(
2, HasBitSetters::value(this), output);
2, _Internal::value(this), output);
}
if (_internal_metadata_.have_unknown_fields()) {
@ -2968,7 +2968,7 @@ void Option::SerializeWithCachedSizes(
if (this->has_value()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessageToArray(
2, HasBitSetters::value(this), target);
2, _Internal::value(this), target);
}
if (_internal_metadata_.have_unknown_fields()) {

@ -383,7 +383,7 @@ class PROTOBUF_EXPORT Type :
// @@protoc_insertion_point(class_scope:google.protobuf.Type)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -747,7 +747,7 @@ class PROTOBUF_EXPORT Field :
// @@protoc_insertion_point(class_scope:google.protobuf.Field)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -954,7 +954,7 @@ class PROTOBUF_EXPORT Enum :
// @@protoc_insertion_point(class_scope:google.protobuf.Enum)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -1132,7 +1132,7 @@ class PROTOBUF_EXPORT EnumValue :
// @@protoc_insertion_point(class_scope:google.protobuf.EnumValue)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -1302,7 +1302,7 @@ class PROTOBUF_EXPORT Option :
// @@protoc_insertion_point(class_scope:google.protobuf.Option)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;

@ -49,10 +49,12 @@ class JsonObjectWriterTest : public ::testing::Test {
out_stream_(new CodedOutputStream(str_stream_)),
ow_(nullptr) {}
virtual ~JsonObjectWriterTest() {
delete ow_;
~JsonObjectWriterTest() override { delete ow_; }
std::string CloseStreamAndGetString() {
delete out_stream_;
delete str_stream_;
return output_;
}
std::string output_;
@ -64,7 +66,7 @@ class JsonObjectWriterTest : public ::testing::Test {
TEST_F(JsonObjectWriterTest, EmptyRootObject) {
ow_ = new JsonObjectWriter("", out_stream_);
ow_->StartObject("")->EndObject();
EXPECT_EQ("{}", output_.substr(0, out_stream_->ByteCount()));
EXPECT_EQ("{}", CloseStreamAndGetString());
}
TEST_F(JsonObjectWriterTest, EmptyObject) {
@ -74,14 +76,13 @@ TEST_F(JsonObjectWriterTest, EmptyObject) {
->StartObject("empty")
->EndObject()
->EndObject();
EXPECT_EQ("{\"test\":\"value\",\"empty\":{}}",
output_.substr(0, out_stream_->ByteCount()));
EXPECT_EQ("{\"test\":\"value\",\"empty\":{}}", CloseStreamAndGetString());
}
TEST_F(JsonObjectWriterTest, EmptyRootList) {
ow_ = new JsonObjectWriter("", out_stream_);
ow_->StartList("")->EndList();
EXPECT_EQ("[]", output_.substr(0, out_stream_->ByteCount()));
EXPECT_EQ("[]", CloseStreamAndGetString());
}
TEST_F(JsonObjectWriterTest, EmptyList) {
@ -91,14 +92,13 @@ TEST_F(JsonObjectWriterTest, EmptyList) {
->StartList("empty")
->EndList()
->EndObject();
EXPECT_EQ("{\"test\":\"value\",\"empty\":[]}",
output_.substr(0, out_stream_->ByteCount()));
EXPECT_EQ("{\"test\":\"value\",\"empty\":[]}", CloseStreamAndGetString());
}
TEST_F(JsonObjectWriterTest, EmptyObjectKey) {
ow_ = new JsonObjectWriter("", out_stream_);
ow_->StartObject("")->RenderString("", "value")->EndObject();
EXPECT_EQ("{\"\":\"value\"}", output_.substr(0, out_stream_->ByteCount()));
EXPECT_EQ("{\"\":\"value\"}", CloseStreamAndGetString());
}
TEST_F(JsonObjectWriterTest, ObjectInObject) {
@ -108,8 +108,7 @@ TEST_F(JsonObjectWriterTest, ObjectInObject) {
->RenderString("field", "value")
->EndObject()
->EndObject();
EXPECT_EQ("{\"nested\":{\"field\":\"value\"}}",
output_.substr(0, out_stream_->ByteCount()));
EXPECT_EQ("{\"nested\":{\"field\":\"value\"}}", CloseStreamAndGetString());
}
TEST_F(JsonObjectWriterTest, ListInObject) {
@ -119,8 +118,7 @@ TEST_F(JsonObjectWriterTest, ListInObject) {
->RenderString("", "value")
->EndList()
->EndObject();
EXPECT_EQ("{\"nested\":[\"value\"]}",
output_.substr(0, out_stream_->ByteCount()));
EXPECT_EQ("{\"nested\":[\"value\"]}", CloseStreamAndGetString());
}
TEST_F(JsonObjectWriterTest, ObjectInList) {
@ -130,8 +128,7 @@ TEST_F(JsonObjectWriterTest, ObjectInList) {
->RenderString("field", "value")
->EndObject()
->EndList();
EXPECT_EQ("[{\"field\":\"value\"}]",
output_.substr(0, out_stream_->ByteCount()));
EXPECT_EQ("[{\"field\":\"value\"}]", CloseStreamAndGetString());
}
TEST_F(JsonObjectWriterTest, ListInList) {
@ -141,7 +138,7 @@ TEST_F(JsonObjectWriterTest, ListInList) {
->RenderString("", "value")
->EndList()
->EndList();
EXPECT_EQ("[[\"value\"]]", output_.substr(0, out_stream_->ByteCount()));
EXPECT_EQ("[[\"value\"]]", CloseStreamAndGetString());
}
TEST_F(JsonObjectWriterTest, RenderPrimitives) {
@ -171,7 +168,7 @@ TEST_F(JsonObjectWriterTest, RenderPrimitives) {
"\"string\":\"string\","
"\"emptybytes\":\"\","
"\"emptystring\":\"\"}",
output_.substr(0, out_stream_->ByteCount()));
CloseStreamAndGetString());
}
TEST_F(JsonObjectWriterTest, BytesEncodesAsNonWebSafeBase64) {
@ -181,8 +178,7 @@ TEST_F(JsonObjectWriterTest, BytesEncodesAsNonWebSafeBase64) {
ow_ = new JsonObjectWriter("", out_stream_);
ow_->StartObject("")->RenderBytes("bytes", s)->EndObject();
// Non-web-safe would encode this as "/+8="
EXPECT_EQ("{\"bytes\":\"/+8=\"}",
output_.substr(0, out_stream_->ByteCount()));
EXPECT_EQ("{\"bytes\":\"/+8=\"}", CloseStreamAndGetString());
}
TEST_F(JsonObjectWriterTest, PrettyPrintList) {
@ -205,7 +201,7 @@ TEST_F(JsonObjectWriterTest, PrettyPrintList) {
" ],\n"
" \"empty\": []\n"
"}\n",
output_.substr(0, out_stream_->ByteCount()));
CloseStreamAndGetString());
}
TEST_F(JsonObjectWriterTest, PrettyPrintObject) {
@ -228,7 +224,7 @@ TEST_F(JsonObjectWriterTest, PrettyPrintObject) {
" },\n"
" \"empty\": {}\n"
"}\n",
output_.substr(0, out_stream_->ByteCount()));
CloseStreamAndGetString());
}
TEST_F(JsonObjectWriterTest, PrettyPrintEmptyObjectInEmptyList) {
@ -245,7 +241,7 @@ TEST_F(JsonObjectWriterTest, PrettyPrintEmptyObjectInEmptyList) {
" {}\n"
" ]\n"
"}\n",
output_.substr(0, out_stream_->ByteCount()));
CloseStreamAndGetString());
}
TEST_F(JsonObjectWriterTest, PrettyPrintDoubleIndent) {
@ -259,14 +255,14 @@ TEST_F(JsonObjectWriterTest, PrettyPrintDoubleIndent) {
" \"bool\": true,\n"
" \"int\": 42\n"
"}\n",
output_.substr(0, out_stream_->ByteCount()));
CloseStreamAndGetString());
}
TEST_F(JsonObjectWriterTest, StringsEscapedAndEnclosedInDoubleQuotes) {
ow_ = new JsonObjectWriter("", out_stream_);
ow_->StartObject("")->RenderString("string", "'<>&amp;\\\"\r\n")->EndObject();
EXPECT_EQ("{\"string\":\"'\\u003c\\u003e&amp;\\\\\\\"\\r\\n\"}",
output_.substr(0, out_stream_->ByteCount()));
CloseStreamAndGetString());
}
TEST_F(JsonObjectWriterTest, Stringification) {
@ -286,7 +282,7 @@ TEST_F(JsonObjectWriterTest, Stringification) {
"\"float_pos\":\"Infinity\","
"\"double_neg\":\"-Infinity\","
"\"float_neg\":\"-Infinity\"}",
output_.substr(0, out_stream_->ByteCount()));
CloseStreamAndGetString());
}
TEST_F(JsonObjectWriterTest, TestRegularByteEncoding) {
@ -297,8 +293,7 @@ TEST_F(JsonObjectWriterTest, TestRegularByteEncoding) {
// Test that we get regular (non websafe) base64 encoding on byte fields by
// default.
EXPECT_EQ("{\"bytes\":\"A+/A\"}",
output_.substr(0, out_stream_->ByteCount()));
EXPECT_EQ("{\"bytes\":\"A+/A\"}", CloseStreamAndGetString());
}
TEST_F(JsonObjectWriterTest, TestWebsafeByteEncoding) {
@ -309,8 +304,7 @@ TEST_F(JsonObjectWriterTest, TestWebsafeByteEncoding) {
->EndObject();
// Test that we get websafe base64 encoding when explicitly asked.
EXPECT_EQ("{\"bytes\":\"A-_AEA==\"}",
output_.substr(0, out_stream_->ByteCount()));
EXPECT_EQ("{\"bytes\":\"A-_AEA==\"}", CloseStreamAndGetString());
}
} // namespace converter

@ -307,7 +307,7 @@ PROTOBUF_NAMESPACE_OPEN
void DoubleValue::InitAsDefaultInstance() {
}
class DoubleValue::HasBitSetters {
class DoubleValue::_Internal {
public:
};
@ -592,7 +592,7 @@ void DoubleValue::InternalSwap(DoubleValue* other) {
void FloatValue::InitAsDefaultInstance() {
}
class FloatValue::HasBitSetters {
class FloatValue::_Internal {
public:
};
@ -877,7 +877,7 @@ void FloatValue::InternalSwap(FloatValue* other) {
void Int64Value::InitAsDefaultInstance() {
}
class Int64Value::HasBitSetters {
class Int64Value::_Internal {
public:
};
@ -1164,7 +1164,7 @@ void Int64Value::InternalSwap(Int64Value* other) {
void UInt64Value::InitAsDefaultInstance() {
}
class UInt64Value::HasBitSetters {
class UInt64Value::_Internal {
public:
};
@ -1451,7 +1451,7 @@ void UInt64Value::InternalSwap(UInt64Value* other) {
void Int32Value::InitAsDefaultInstance() {
}
class Int32Value::HasBitSetters {
class Int32Value::_Internal {
public:
};
@ -1738,7 +1738,7 @@ void Int32Value::InternalSwap(Int32Value* other) {
void UInt32Value::InitAsDefaultInstance() {
}
class UInt32Value::HasBitSetters {
class UInt32Value::_Internal {
public:
};
@ -2025,7 +2025,7 @@ void UInt32Value::InternalSwap(UInt32Value* other) {
void BoolValue::InitAsDefaultInstance() {
}
class BoolValue::HasBitSetters {
class BoolValue::_Internal {
public:
};
@ -2310,7 +2310,7 @@ void BoolValue::InternalSwap(BoolValue* other) {
void StringValue::InitAsDefaultInstance() {
}
class StringValue::HasBitSetters {
class StringValue::_Internal {
public:
};
@ -2335,7 +2335,7 @@ StringValue::StringValue(const StringValue& from)
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from.value().size() > 0) {
if (!from.value().empty()) {
value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.value(),
GetArenaNoVirtual());
}
@ -2617,7 +2617,7 @@ void StringValue::InternalSwap(StringValue* other) {
void BytesValue::InitAsDefaultInstance() {
}
class BytesValue::HasBitSetters {
class BytesValue::_Internal {
public:
};
@ -2642,7 +2642,7 @@ BytesValue::BytesValue(const BytesValue& from)
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from.value().size() > 0) {
if (!from.value().empty()) {
value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.value(),
GetArenaNoVirtual());
}

@ -227,7 +227,7 @@ class PROTOBUF_EXPORT DoubleValue :
// @@protoc_insertion_point(class_scope:google.protobuf.DoubleValue)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -368,7 +368,7 @@ class PROTOBUF_EXPORT FloatValue :
// @@protoc_insertion_point(class_scope:google.protobuf.FloatValue)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -509,7 +509,7 @@ class PROTOBUF_EXPORT Int64Value :
// @@protoc_insertion_point(class_scope:google.protobuf.Int64Value)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -650,7 +650,7 @@ class PROTOBUF_EXPORT UInt64Value :
// @@protoc_insertion_point(class_scope:google.protobuf.UInt64Value)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -791,7 +791,7 @@ class PROTOBUF_EXPORT Int32Value :
// @@protoc_insertion_point(class_scope:google.protobuf.Int32Value)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -932,7 +932,7 @@ class PROTOBUF_EXPORT UInt32Value :
// @@protoc_insertion_point(class_scope:google.protobuf.UInt32Value)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -1073,7 +1073,7 @@ class PROTOBUF_EXPORT BoolValue :
// @@protoc_insertion_point(class_scope:google.protobuf.BoolValue)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -1229,7 +1229,7 @@ class PROTOBUF_EXPORT StringValue :
// @@protoc_insertion_point(class_scope:google.protobuf.StringValue)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
@ -1385,7 +1385,7 @@ class PROTOBUF_EXPORT BytesValue :
// @@protoc_insertion_point(class_scope:google.protobuf.BytesValue)
private:
class HasBitSetters;
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;

Loading…
Cancel
Save