Sync from Piper @314226556
PROTOBUF_SYNC_PIPER
diff --git a/cmake/README.md b/cmake/README.md
index ed30d24..89d00c1 100644
--- a/cmake/README.md
+++ b/cmake/README.md
@@ -343,23 +343,3 @@
nevertheless. So, we disable it. Unfortunately, this warning will also be
produced when compiling code which merely uses protocol buffers, meaning you
may have to disable it in your code too.
-
-Cross-compiling
-===============
-
-When cross-compiling you will need to disable building the tests which are ON
-by default. You can do so by specifying the following flags when configuring
-your build:
-
- -Dprotobuf_BUILD_TESTS=OFF
-
-Alternatively you can compile (or download) 'protoc' for your host machine
-prior to configuring your target build. To specify an existing 'protoc' binary
-for your build, specify the following flag:
-
- -DWITH_PROTOC=<path to your protoc binary>
-
-You can also save compilation time by disabling building 'protoc' for your
-target build:
-
- -Dprotobuf_BUILD_PROTOC_BINARIES=OFF
diff --git a/conformance/failure_list_python.txt b/conformance/failure_list_python.txt
index f551227..3f7a811 100644
--- a/conformance/failure_list_python.txt
+++ b/conformance/failure_list_python.txt
@@ -28,4 +28,3 @@
Required.Proto3.JsonInput.FloatFieldTooLarge
Required.Proto3.JsonInput.FloatFieldTooSmall
Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotBool
-Required.Proto3.JsonInput.TimestampJsonInputLowercaseT
diff --git a/conformance/failure_list_python_cpp.txt b/conformance/failure_list_python_cpp.txt
index 59a969d..df16455 100644
--- a/conformance/failure_list_python_cpp.txt
+++ b/conformance/failure_list_python_cpp.txt
@@ -19,4 +19,3 @@
Required.Proto3.JsonInput.FloatFieldTooLarge
Required.Proto3.JsonInput.FloatFieldTooSmall
Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotBool
-Required.Proto3.JsonInput.TimestampJsonInputLowercaseT
diff --git a/js/message.js b/js/message.js
index c1736b3..f190894 100644
--- a/js/message.js
+++ b/js/message.js
@@ -417,7 +417,7 @@
*/
jspb.Message.isArray_ = function(o) {
return jspb.Message.ASSUME_LOCAL_ARRAYS ? o instanceof Array :
- goog.isArray(o);
+ Array.isArray(o);
};
/**
@@ -1433,7 +1433,7 @@
if (this.wrappers_) {
for (var fieldNumber in this.wrappers_) {
var val = this.wrappers_[fieldNumber];
- if (goog.isArray(val)) {
+ if (Array.isArray(val)) {
for (var i = 0; i < val.length; i++) {
if (val[i]) {
val[i].toArray();
@@ -1823,7 +1823,7 @@
*/
jspb.Message.clone_ = function(obj) {
var o;
- if (goog.isArray(obj)) {
+ if (Array.isArray(obj)) {
// Allocate array of correct size.
var clonedArray = new Array(obj.length);
// Use array iteration where possible because it is faster than for-in.
diff --git a/python/google/protobuf/internal/json_format_test.py b/python/google/protobuf/internal/json_format_test.py
index d828272..104b947 100755
--- a/python/google/protobuf/internal/json_format_test.py
+++ b/python/google/protobuf/internal/json_format_test.py
@@ -269,7 +269,6 @@
}
self.assertEqual(expected_dict, message_dict)
-
def testExtensionSerializationJsonMatchesProto3Spec(self):
"""See go/proto3-json-spec for spec.
"""
@@ -295,7 +294,6 @@
'}}') % (ext1_text, ext2_text)
self.assertEqual(json.loads(golden_text), json.loads(message_text))
-
def testJsonEscapeString(self):
message = json_format_proto3_pb2.TestMessage()
if sys.version_info[0] < 3:
@@ -1036,6 +1034,15 @@
OverflowError,
'date value out of range',
json_format.MessageToJson, message)
+ # Lower case t does not accept.
+ text = '{"value": "0001-01-01t00:00:00Z"}'
+ with self.assertRaises(json_format.ParseError) as e:
+ json_format.Parse(text, message)
+ self.assertEqual(
+ 'Failed to parse value field: '
+ 'time data \'0001-01-01t00:00:00\' does not match format '
+ '\'%Y-%m-%dT%H:%M:%S\', lowercase \'t\' is not accepted.',
+ str(e.exception))
def testInvalidOneof(self):
message = json_format_proto3_pb2.TestOneof()
diff --git a/python/google/protobuf/internal/well_known_types.py b/python/google/protobuf/internal/well_known_types.py
index 308fbfe..cb646a7 100644
--- a/python/google/protobuf/internal/well_known_types.py
+++ b/python/google/protobuf/internal/well_known_types.py
@@ -160,6 +160,10 @@
else:
second_value = time_value[:point_position]
nano_value = time_value[point_position + 1:]
+ if 't' in second_value:
+ raise ValueError(
+ 'time data \'{0}\' does not match format \'%Y-%m-%dT%H:%M:%S\', '
+ 'lowercase \'t\' is not accepted'.format(second_value))
date_object = datetime.strptime(second_value, _TIMESTAMPFOMAT)
td = date_object - datetime(1970, 1, 1)
seconds = td.seconds + td.days * _SECONDS_PER_DAY
diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h
index cd1ae9f..08913bf 100644
--- a/src/google/protobuf/any.pb.h
+++ b/src/google/protobuf/any.pb.h
@@ -225,15 +225,6 @@
std::string* mutable_type_url();
std::string* release_type_url();
void set_allocated_type_url(std::string* type_url);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_type_url();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_type_url(
- std::string* type_url);
private:
const std::string& _internal_type_url() const;
void _internal_set_type_url(const std::string& value);
@@ -250,15 +241,6 @@
std::string* mutable_value();
std::string* release_value();
void set_allocated_value(std::string* value);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_value();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_value(
- std::string* value);
private:
const std::string& _internal_value() const;
void _internal_set_value(const std::string& value);
@@ -350,25 +332,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.type_url)
}
-inline std::string* Any::unsafe_arena_release_type_url() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Any.type_url)
- GOOGLE_DCHECK(GetArena() != nullptr);
-
- return type_url_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void Any::unsafe_arena_set_allocated_type_url(
- std::string* type_url) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (type_url != nullptr) {
-
- } else {
-
- }
- type_url_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- type_url, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Any.type_url)
-}
// bytes value = 2;
inline void Any::clear_value() {
@@ -431,25 +394,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.value)
}
-inline std::string* Any::unsafe_arena_release_value() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Any.value)
- GOOGLE_DCHECK(GetArena() != nullptr);
-
- return value_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void Any::unsafe_arena_set_allocated_value(
- std::string* value) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (value != nullptr) {
-
- } else {
-
- }
- value_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- value, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Any.value)
-}
#ifdef __GNUC__
#pragma GCC diagnostic pop
diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h
index 2e307b4..3e199b6 100644
--- a/src/google/protobuf/api.pb.h
+++ b/src/google/protobuf/api.pb.h
@@ -261,15 +261,6 @@
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_name();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- std::string* name);
private:
const std::string& _internal_name() const;
void _internal_set_name(const std::string& value);
@@ -286,15 +277,6 @@
std::string* mutable_version();
std::string* release_version();
void set_allocated_version(std::string* version);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_version();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_version(
- std::string* version);
private:
const std::string& _internal_version() const;
void _internal_set_version(const std::string& value);
@@ -496,15 +478,6 @@
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_name();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- std::string* name);
private:
const std::string& _internal_name() const;
void _internal_set_name(const std::string& value);
@@ -521,15 +494,6 @@
std::string* mutable_request_type_url();
std::string* release_request_type_url();
void set_allocated_request_type_url(std::string* request_type_url);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_request_type_url();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_request_type_url(
- std::string* request_type_url);
private:
const std::string& _internal_request_type_url() const;
void _internal_set_request_type_url(const std::string& value);
@@ -546,15 +510,6 @@
std::string* mutable_response_type_url();
std::string* release_response_type_url();
void set_allocated_response_type_url(std::string* response_type_url);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_response_type_url();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_response_type_url(
- std::string* response_type_url);
private:
const std::string& _internal_response_type_url() const;
void _internal_set_response_type_url(const std::string& value);
@@ -733,15 +688,6 @@
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_name();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- std::string* name);
private:
const std::string& _internal_name() const;
void _internal_set_name(const std::string& value);
@@ -758,15 +704,6 @@
std::string* mutable_root();
std::string* release_root();
void set_allocated_root(std::string* root);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_root();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_root(
- std::string* root);
private:
const std::string& _internal_root() const;
void _internal_set_root(const std::string& value);
@@ -857,25 +794,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.name)
}
-inline std::string* Api::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Api.name)
- GOOGLE_DCHECK(GetArena() != nullptr);
-
- return name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void Api::unsafe_arena_set_allocated_name(
- std::string* name) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (name != nullptr) {
-
- } else {
-
- }
- name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- name, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Api.name)
-}
// repeated .google.protobuf.Method methods = 2;
inline int Api::_internal_methods_size() const {
@@ -1013,25 +931,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.version)
}
-inline std::string* Api::unsafe_arena_release_version() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Api.version)
- GOOGLE_DCHECK(GetArena() != nullptr);
-
- return version_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void Api::unsafe_arena_set_allocated_version(
- std::string* version) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (version != nullptr) {
-
- } else {
-
- }
- version_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- version, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Api.version)
-}
// .google.protobuf.SourceContext source_context = 5;
inline bool Api::_internal_has_source_context() const {
@@ -1234,25 +1133,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.name)
}
-inline std::string* Method::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Method.name)
- GOOGLE_DCHECK(GetArena() != nullptr);
-
- return name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void Method::unsafe_arena_set_allocated_name(
- std::string* name) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (name != nullptr) {
-
- } else {
-
- }
- name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- name, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Method.name)
-}
// string request_type_url = 2;
inline void Method::clear_request_type_url() {
@@ -1315,25 +1195,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.request_type_url)
}
-inline std::string* Method::unsafe_arena_release_request_type_url() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Method.request_type_url)
- GOOGLE_DCHECK(GetArena() != nullptr);
-
- return request_type_url_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void Method::unsafe_arena_set_allocated_request_type_url(
- std::string* request_type_url) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (request_type_url != nullptr) {
-
- } else {
-
- }
- request_type_url_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- request_type_url, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Method.request_type_url)
-}
// bool request_streaming = 3;
inline void Method::clear_request_streaming() {
@@ -1416,25 +1277,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.response_type_url)
}
-inline std::string* Method::unsafe_arena_release_response_type_url() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Method.response_type_url)
- GOOGLE_DCHECK(GetArena() != nullptr);
-
- return response_type_url_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void Method::unsafe_arena_set_allocated_response_type_url(
- std::string* response_type_url) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (response_type_url != nullptr) {
-
- } else {
-
- }
- response_type_url_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- response_type_url, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Method.response_type_url)
-}
// bool response_streaming = 5;
inline void Method::clear_response_streaming() {
@@ -1577,25 +1419,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.name)
}
-inline std::string* Mixin::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Mixin.name)
- GOOGLE_DCHECK(GetArena() != nullptr);
-
- return name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void Mixin::unsafe_arena_set_allocated_name(
- std::string* name) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (name != nullptr) {
-
- } else {
-
- }
- name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- name, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Mixin.name)
-}
// string root = 2;
inline void Mixin::clear_root() {
@@ -1658,25 +1481,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.root)
}
-inline std::string* Mixin::unsafe_arena_release_root() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Mixin.root)
- GOOGLE_DCHECK(GetArena() != nullptr);
-
- return root_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void Mixin::unsafe_arena_set_allocated_root(
- std::string* root) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (root != nullptr) {
-
- } else {
-
- }
- root_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- root, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Mixin.root)
-}
#ifdef __GNUC__
#pragma GCC diagnostic pop
diff --git a/src/google/protobuf/arena_unittest.cc b/src/google/protobuf/arena_unittest.cc
index 5fa4b0c..8578420 100644
--- a/src/google/protobuf/arena_unittest.cc
+++ b/src/google/protobuf/arena_unittest.cc
@@ -858,23 +858,6 @@
}
}
-TEST(ArenaTest, UnsafeArenaReleaseAdd) {
- // Use unsafe_arena_release() and unsafe_arena_set_allocated() to transfer an
- // arena-allocated string from one message to another.
- const char kContent[] = "Test content";
-
- Arena arena;
- TestAllTypes* message1 = Arena::CreateMessage<TestAllTypes>(&arena);
- TestAllTypes* message2 = Arena::CreateMessage<TestAllTypes>(&arena);
- std::string* arena_string = Arena::Create<std::string>(&arena);
- *arena_string = kContent;
-
- message1->unsafe_arena_set_allocated_optional_string(arena_string);
- message2->unsafe_arena_set_allocated_optional_string(
- message1->unsafe_arena_release_optional_string());
- EXPECT_EQ(kContent, message2->optional_string());
-}
-
TEST(ArenaTest, UnsafeArenaAddAllocated) {
Arena arena;
TestAllTypes* message = Arena::CreateMessage<TestAllTypes>(&arena);
@@ -885,43 +868,20 @@
}
}
-TEST(ArenaTest, UnsafeArenaRelease) {
- Arena arena;
- TestAllTypes* message = Arena::CreateMessage<TestAllTypes>(&arena);
-
- std::string* s = new std::string("test string");
- message->unsafe_arena_set_allocated_optional_string(s);
- EXPECT_TRUE(message->has_optional_string());
- EXPECT_EQ("test string", message->optional_string());
- s = message->unsafe_arena_release_optional_string();
- EXPECT_FALSE(message->has_optional_string());
- delete s;
-
- s = new std::string("test string");
- message->unsafe_arena_set_allocated_oneof_string(s);
- EXPECT_TRUE(message->has_oneof_string());
- EXPECT_EQ("test string", message->oneof_string());
- s = message->unsafe_arena_release_oneof_string();
- EXPECT_FALSE(message->has_oneof_string());
- delete s;
-}
-
TEST(ArenaTest, OneofMerge) {
Arena arena;
TestAllTypes* message0 = Arena::CreateMessage<TestAllTypes>(&arena);
TestAllTypes* message1 = Arena::CreateMessage<TestAllTypes>(&arena);
- message0->unsafe_arena_set_allocated_oneof_string(new std::string("x"));
+ message0->set_oneof_string("x");
ASSERT_TRUE(message0->has_oneof_string());
- message1->unsafe_arena_set_allocated_oneof_string(new std::string("y"));
+ message1->set_oneof_string("y");
ASSERT_TRUE(message1->has_oneof_string());
EXPECT_EQ("x", message0->oneof_string());
EXPECT_EQ("y", message1->oneof_string());
message0->MergeFrom(*message1);
EXPECT_EQ("y", message0->oneof_string());
EXPECT_EQ("y", message1->oneof_string());
- delete message0->unsafe_arena_release_oneof_string();
- delete message1->unsafe_arena_release_oneof_string();
}
TEST(ArenaTest, ArenaOneofReflection) {
@@ -1345,19 +1305,6 @@
}
}
-TEST(ArenaTest, UnsafeSetAllocatedOnArena) {
- Arena arena;
- TestAllTypes* message = Arena::CreateMessage<TestAllTypes>(&arena);
- EXPECT_FALSE(message->has_optional_string());
-
- std::string owned_string = "test with long enough content to heap-allocate";
- message->unsafe_arena_set_allocated_optional_string(&owned_string);
- EXPECT_TRUE(message->has_optional_string());
-
- message->unsafe_arena_set_allocated_optional_string(NULL);
- EXPECT_FALSE(message->has_optional_string());
-}
-
// A helper utility class to only contain static hook functions, some
// counters to be used to verify the counters have been called and a cookie
// value to be verified.
diff --git a/src/google/protobuf/compiler/code_generator.h b/src/google/protobuf/compiler/code_generator.h
index 1bc8dfc..21131d5 100644
--- a/src/google/protobuf/compiler/code_generator.h
+++ b/src/google/protobuf/compiler/code_generator.h
@@ -110,7 +110,7 @@
// Implement this to indicate what features this code generator supports.
// This should be a bitwise OR of features from the Features enum in
// plugin.proto.
- virtual uint64 GetSupportedFeatures() const { return 0; }
+ virtual uint64_t GetSupportedFeatures() const { return 0; }
// This is no longer used, but this class is part of the opensource protobuf
// library, so it has to remain to keep vtables the same for the current
diff --git a/src/google/protobuf/compiler/cpp/cpp_generator.h b/src/google/protobuf/compiler/cpp/cpp_generator.h
index 85a5aab..97e848d 100644
--- a/src/google/protobuf/compiler/cpp/cpp_generator.h
+++ b/src/google/protobuf/compiler/cpp/cpp_generator.h
@@ -84,7 +84,7 @@
GeneratorContext* generator_context,
std::string* error) const override;
- uint64 GetSupportedFeatures() const override {
+ uint64_t GetSupportedFeatures() const override {
// We don't fully support this yet, but this is needed to unblock the tests,
// and we will have full support before the experimental flag is removed.
return FEATURE_PROTO3_OPTIONAL;
diff --git a/src/google/protobuf/compiler/cpp/cpp_string_field.cc b/src/google/protobuf/compiler/cpp/cpp_string_field.cc
index ca365e7..5cf82f6 100644
--- a/src/google/protobuf/compiler/cpp/cpp_string_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_string_field.cc
@@ -179,23 +179,6 @@
"$deprecated_attr$void ${1$set_allocated_$name$$}$(std::string* "
"$name$);\n",
descriptor_);
- if (options_.opensource_runtime) {
- if (SupportsArenas(descriptor_)) {
- format(
- "$GOOGLE_PROTOBUF$_RUNTIME_DEPRECATED(\"The unsafe_arena_ accessors "
- "for\"\n"
- "\" string fields are deprecated and will be removed in a\"\n"
- "\" future release.\")\n"
- "std::string* ${1$unsafe_arena_release_$name$$}$();\n"
- "$GOOGLE_PROTOBUF$_RUNTIME_DEPRECATED(\"The unsafe_arena_ accessors "
- "for\"\n"
- "\" string fields are deprecated and will be removed in a\"\n"
- "\" future release.\")\n"
- "void ${1$unsafe_arena_set_allocated_$name$$}$(\n"
- " std::string* $name$);\n",
- descriptor_);
- }
- }
format(
"private:\n"
"const std::string& _internal_$name$() const;\n"
@@ -307,32 +290,6 @@
" GetArena());\n"
" // @@protoc_insertion_point(field_set_allocated:$full_name$)\n"
"}\n");
- if (options_.opensource_runtime) {
- format(
- "inline std::string* $classname$::unsafe_arena_release_$name$() {\n"
- "$annotate_accessor$"
- " // "
- "@@protoc_insertion_point(field_unsafe_arena_release:$full_name$)\n"
- " $DCHK$(GetArena() != nullptr);\n"
- " $clear_hasbit$\n"
- " return $name$_.UnsafeArenaRelease($default_variable$,\n"
- " GetArena());\n"
- "}\n"
- "inline void $classname$::unsafe_arena_set_allocated_$name$(\n"
- "$annotate_accessor$"
- " std::string* $name$) {\n"
- " $DCHK$(GetArena() != nullptr);\n"
- " if ($name$ != nullptr) {\n"
- " $set_hasbit$\n"
- " } else {\n"
- " $clear_hasbit$\n"
- " }\n"
- " $name$_.UnsafeArenaSetAllocated($default_variable$,\n"
- " $name$, GetArena());\n"
- " // @@protoc_insertion_point(field_unsafe_arena_set_allocated:"
- "$full_name$)\n"
- "}\n");
- }
} else {
// No-arena case.
format(
@@ -761,38 +718,6 @@
" }\n"
" // @@protoc_insertion_point(field_set_allocated:$full_name$)\n"
"}\n");
- if (options_.opensource_runtime) {
- format(
- "inline std::string* $classname$::unsafe_arena_release_$name$() {\n"
- "$annotate_accessor$"
- " // "
- "@@protoc_insertion_point(field_unsafe_arena_release:$full_name$)\n"
- " $DCHK$(GetArena() != nullptr);\n"
- " if (_internal_has_$name$()) {\n"
- " clear_has_$oneof_name$();\n"
- " return $field_member$.UnsafeArenaRelease(\n"
- " $default_variable$, GetArena());\n"
- " } else {\n"
- " return nullptr;\n"
- " }\n"
- "}\n"
- "inline void $classname$::unsafe_arena_set_allocated_$name$("
- "std::string* $name$) {\n"
- "$annotate_accessor$"
- " $DCHK$(GetArena() != nullptr);\n"
- " if (!_internal_has_$name$()) {\n"
- " $field_member$.UnsafeSetDefault($default_variable$);\n"
- " }\n"
- " clear_$oneof_name$();\n"
- " if ($name$) {\n"
- " set_has_$name$();\n"
- " $field_member$.UnsafeArenaSetAllocated($default_variable$, "
- "$name$, GetArena());\n"
- " }\n"
- " // @@protoc_insertion_point(field_unsafe_arena_set_allocated:"
- "$full_name$)\n"
- "}\n");
- }
} else {
// No-arena case.
format(
diff --git a/src/google/protobuf/compiler/java/java_generator.cc b/src/google/protobuf/compiler/java/java_generator.cc
index 11b04b8..29ae2cf 100644
--- a/src/google/protobuf/compiler/java/java_generator.cc
+++ b/src/google/protobuf/compiler/java/java_generator.cc
@@ -58,7 +58,7 @@
JavaGenerator::JavaGenerator() {}
JavaGenerator::~JavaGenerator() {}
-uint64 JavaGenerator::GetSupportedFeatures() const {
+uint64_t JavaGenerator::GetSupportedFeatures() const {
return CodeGenerator::Feature::FEATURE_PROTO3_OPTIONAL;
}
diff --git a/src/google/protobuf/compiler/java/java_generator.h b/src/google/protobuf/compiler/java/java_generator.h
index a4e1708..6315e7c 100644
--- a/src/google/protobuf/compiler/java/java_generator.h
+++ b/src/google/protobuf/compiler/java/java_generator.h
@@ -60,7 +60,7 @@
bool Generate(const FileDescriptor* file, const std::string& parameter,
GeneratorContext* context, std::string* error) const override;
- uint64 GetSupportedFeatures() const override;
+ uint64_t GetSupportedFeatures() const override;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(JavaGenerator);
diff --git a/src/google/protobuf/compiler/mock_code_generator.cc b/src/google/protobuf/compiler/mock_code_generator.cc
index 8b82901..0b85056 100644
--- a/src/google/protobuf/compiler/mock_code_generator.cc
+++ b/src/google/protobuf/compiler/mock_code_generator.cc
@@ -87,7 +87,7 @@
MockCodeGenerator::~MockCodeGenerator() {}
-uint64 MockCodeGenerator::GetSupportedFeatures() const {
+uint64_t MockCodeGenerator::GetSupportedFeatures() const {
uint64 all_features = CodeGenerator::FEATURE_PROTO3_OPTIONAL;
return all_features & ~suppressed_features_;
}
diff --git a/src/google/protobuf/compiler/mock_code_generator.h b/src/google/protobuf/compiler/mock_code_generator.h
index 70a840e..9a72258 100644
--- a/src/google/protobuf/compiler/mock_code_generator.h
+++ b/src/google/protobuf/compiler/mock_code_generator.h
@@ -109,7 +109,7 @@
bool Generate(const FileDescriptor* file, const std::string& parameter,
GeneratorContext* context, std::string* error) const override;
- uint64 GetSupportedFeatures() const override;
+ uint64_t GetSupportedFeatures() const override;
void SuppressFeatures(uint64 features);
private:
diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h
index 2ada7cb..f4a0449 100644
--- a/src/google/protobuf/compiler/plugin.pb.h
+++ b/src/google/protobuf/compiler/plugin.pb.h
@@ -251,15 +251,6 @@
std::string* mutable_suffix();
std::string* release_suffix();
void set_allocated_suffix(std::string* suffix);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_suffix();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_suffix(
- std::string* suffix);
private:
const std::string& _internal_suffix() const;
void _internal_set_suffix(const std::string& value);
@@ -503,15 +494,6 @@
std::string* mutable_parameter();
std::string* release_parameter();
void set_allocated_parameter(std::string* parameter);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_parameter();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_parameter(
- std::string* parameter);
private:
const std::string& _internal_parameter() const;
void _internal_set_parameter(const std::string& value);
@@ -691,15 +673,6 @@
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_name();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- std::string* name);
private:
const std::string& _internal_name() const;
void _internal_set_name(const std::string& value);
@@ -720,15 +693,6 @@
std::string* mutable_insertion_point();
std::string* release_insertion_point();
void set_allocated_insertion_point(std::string* insertion_point);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_insertion_point();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_insertion_point(
- std::string* insertion_point);
private:
const std::string& _internal_insertion_point() const;
void _internal_set_insertion_point(const std::string& value);
@@ -749,15 +713,6 @@
std::string* mutable_content();
std::string* release_content();
void set_allocated_content(std::string* content);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_content();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_content(
- std::string* content);
private:
const std::string& _internal_content() const;
void _internal_set_content(const std::string& value);
@@ -968,15 +923,6 @@
std::string* mutable_error();
std::string* release_error();
void set_allocated_error(std::string* error);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_error();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_error(
- std::string* error);
private:
const std::string& _internal_error() const;
void _internal_set_error(const std::string& value);
@@ -1178,25 +1124,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.Version.suffix)
}
-inline std::string* Version::unsafe_arena_release_suffix() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.compiler.Version.suffix)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000001u;
- return suffix_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void Version::unsafe_arena_set_allocated_suffix(
- std::string* suffix) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (suffix != nullptr) {
- _has_bits_[0] |= 0x00000001u;
- } else {
- _has_bits_[0] &= ~0x00000001u;
- }
- suffix_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- suffix, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.compiler.Version.suffix)
-}
// -------------------------------------------------------------------
@@ -1349,25 +1276,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorRequest.parameter)
}
-inline std::string* CodeGeneratorRequest::unsafe_arena_release_parameter() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.compiler.CodeGeneratorRequest.parameter)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000001u;
- return parameter_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void CodeGeneratorRequest::unsafe_arena_set_allocated_parameter(
- std::string* parameter) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (parameter != nullptr) {
- _has_bits_[0] |= 0x00000001u;
- } else {
- _has_bits_[0] &= ~0x00000001u;
- }
- parameter_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- parameter, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.compiler.CodeGeneratorRequest.parameter)
-}
// repeated .google.protobuf.FileDescriptorProto proto_file = 15;
inline int CodeGeneratorRequest::_internal_proto_file_size() const {
@@ -1565,25 +1473,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.name)
}
-inline std::string* CodeGeneratorResponse_File::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.compiler.CodeGeneratorResponse.File.name)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000001u;
- return name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void CodeGeneratorResponse_File::unsafe_arena_set_allocated_name(
- std::string* name) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (name != nullptr) {
- _has_bits_[0] |= 0x00000001u;
- } else {
- _has_bits_[0] &= ~0x00000001u;
- }
- name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- name, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.name)
-}
// optional string insertion_point = 2;
inline bool CodeGeneratorResponse_File::_internal_has_insertion_point() const {
@@ -1658,25 +1547,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
}
-inline std::string* CodeGeneratorResponse_File::unsafe_arena_release_insertion_point() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000002u;
- return insertion_point_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void CodeGeneratorResponse_File::unsafe_arena_set_allocated_insertion_point(
- std::string* insertion_point) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (insertion_point != nullptr) {
- _has_bits_[0] |= 0x00000002u;
- } else {
- _has_bits_[0] &= ~0x00000002u;
- }
- insertion_point_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- insertion_point, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
-}
// optional string content = 15;
inline bool CodeGeneratorResponse_File::_internal_has_content() const {
@@ -1751,25 +1621,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.content)
}
-inline std::string* CodeGeneratorResponse_File::unsafe_arena_release_content() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.compiler.CodeGeneratorResponse.File.content)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000004u;
- return content_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void CodeGeneratorResponse_File::unsafe_arena_set_allocated_content(
- std::string* content) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (content != nullptr) {
- _has_bits_[0] |= 0x00000004u;
- } else {
- _has_bits_[0] &= ~0x00000004u;
- }
- content_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- content, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.content)
-}
// -------------------------------------------------------------------
@@ -1848,25 +1699,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.error)
}
-inline std::string* CodeGeneratorResponse::unsafe_arena_release_error() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.compiler.CodeGeneratorResponse.error)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000001u;
- return error_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void CodeGeneratorResponse::unsafe_arena_set_allocated_error(
- std::string* error) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (error != nullptr) {
- _has_bits_[0] |= 0x00000001u;
- } else {
- _has_bits_[0] &= ~0x00000001u;
- }
- error_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- error, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.error)
-}
// optional uint64 supported_features = 2;
inline bool CodeGeneratorResponse::_internal_has_supported_features() const {
diff --git a/src/google/protobuf/compiler/python/python_generator.cc b/src/google/protobuf/compiler/python/python_generator.cc
index 88804bd..a95b37f 100644
--- a/src/google/protobuf/compiler/python/python_generator.cc
+++ b/src/google/protobuf/compiler/python/python_generator.cc
@@ -301,7 +301,7 @@
Generator::~Generator() {}
-uint64 Generator::GetSupportedFeatures() const {
+uint64_t Generator::GetSupportedFeatures() const {
return CodeGenerator::Feature::FEATURE_PROTO3_OPTIONAL;
}
diff --git a/src/google/protobuf/compiler/python/python_generator.h b/src/google/protobuf/compiler/python/python_generator.h
index fb1aee1..ed1c995 100644
--- a/src/google/protobuf/compiler/python/python_generator.h
+++ b/src/google/protobuf/compiler/python/python_generator.h
@@ -73,7 +73,7 @@
GeneratorContext* generator_context,
std::string* error) const override;
- uint64 GetSupportedFeatures() const override;
+ uint64_t GetSupportedFeatures() const override;
private:
void PrintImports() const;
diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc
index 5001222..9a448ff 100644
--- a/src/google/protobuf/descriptor.cc
+++ b/src/google/protobuf/descriptor.cc
@@ -434,14 +434,14 @@
const Symbol kNullSymbol;
-typedef HASH_MAP<const char*, Symbol, HASH_FXN<const char*>, streq>
+typedef HASH_MAP<StringPiece, Symbol, HASH_FXN<StringPiece>>
SymbolsByNameMap;
typedef HASH_MAP<PointerStringPair, Symbol, PointerStringPairHash>
SymbolsByParentMap;
-typedef HASH_MAP<const char*, const FileDescriptor*, HASH_FXN<const char*>,
- streq>
+typedef HASH_MAP<StringPiece, const FileDescriptor*,
+ HASH_FXN<StringPiece>>
FilesByNameMap;
typedef HASH_MAP<PointerStringPair, const FieldDescriptor*,
@@ -576,16 +576,16 @@
// Find symbols. This returns a null Symbol (symbol.IsNull() is true)
// if not found.
- inline Symbol FindSymbol(const std::string& key) const;
+ inline Symbol FindSymbol(StringPiece key) const;
// This implements the body of DescriptorPool::Find*ByName(). It should
// really be a private method of DescriptorPool, but that would require
// declaring Symbol in descriptor.h, which would drag all kinds of other
// stuff into the header. Yay C++.
- Symbol FindByNameHelper(const DescriptorPool* pool, const std::string& name);
+ Symbol FindByNameHelper(const DescriptorPool* pool, StringPiece name);
// These return nullptr if not found.
- inline const FileDescriptor* FindFile(const std::string& key) const;
+ inline const FileDescriptor* FindFile(StringPiece key) const;
inline const FieldDescriptor* FindExtension(const Descriptor* extendee,
int number) const;
inline void FindAllExtensions(const Descriptor* extendee,
@@ -619,7 +619,7 @@
// Allocate a string which will be destroyed when the pool is destroyed.
// The string is initialized to the given value for convenience.
- std::string* AllocateString(const std::string& value);
+ std::string* AllocateString(StringPiece value);
// Allocate empty string which will be destroyed when the pool is destroyed.
std::string* AllocateEmptyString();
@@ -715,9 +715,9 @@
inline const FieldDescriptor* FindFieldByNumber(const Descriptor* parent,
int number) const;
inline const FieldDescriptor* FindFieldByLowercaseName(
- const void* parent, const std::string& lowercase_name) const;
+ const void* parent, StringPiece lowercase_name) const;
inline const FieldDescriptor* FindFieldByCamelcaseName(
- const void* parent, const std::string& camelcase_name) const;
+ const void* parent, StringPiece camelcase_name) const;
inline const EnumValueDescriptor* FindEnumValueByNumber(
const EnumDescriptor* parent, int number) const;
// This creates a new EnumValueDescriptor if not found, in a thread-safe way.
@@ -884,8 +884,8 @@
// -------------------------------------------------------------------
-inline Symbol DescriptorPool::Tables::FindSymbol(const std::string& key) const {
- const Symbol* result = FindOrNull(symbols_by_name_, key.c_str());
+inline Symbol DescriptorPool::Tables::FindSymbol(StringPiece key) const {
+ const Symbol* result = FindOrNull(symbols_by_name_, key);
if (result == nullptr) {
return kNullSymbol;
} else {
@@ -912,7 +912,7 @@
}
Symbol DescriptorPool::Tables::FindByNameHelper(const DescriptorPool* pool,
- const std::string& name) {
+ StringPiece name) {
if (pool->mutex_ != nullptr) {
// Fast path: the Symbol is already cached. This is just a hash lookup.
ReaderMutexLock lock(pool->mutex_);
@@ -944,8 +944,8 @@
}
inline const FileDescriptor* DescriptorPool::Tables::FindFile(
- const std::string& key) const {
- return FindPtrOrNull(files_by_name_, key.c_str());
+ StringPiece key) const {
+ return FindPtrOrNull(files_by_name_, key);
}
inline const FieldDescriptor* FileDescriptorTables::FindFieldByNumber(
@@ -982,12 +982,12 @@
}
inline const FieldDescriptor* FileDescriptorTables::FindFieldByLowercaseName(
- const void* parent, const std::string& lowercase_name) const {
+ const void* parent, StringPiece lowercase_name) const {
internal::call_once(
fields_by_lowercase_name_once_,
&FileDescriptorTables::FieldsByLowercaseNamesLazyInitStatic, this);
return FindPtrOrNull(fields_by_lowercase_name_,
- PointerStringPair(parent, lowercase_name.c_str()));
+ PointerStringPair(parent, lowercase_name));
}
void FileDescriptorTables::FieldsByCamelcaseNamesLazyInitStatic(
@@ -1006,12 +1006,12 @@
}
inline const FieldDescriptor* FileDescriptorTables::FindFieldByCamelcaseName(
- const void* parent, const std::string& camelcase_name) const {
+ const void* parent, StringPiece camelcase_name) const {
internal::call_once(
fields_by_camelcase_name_once_,
FileDescriptorTables::FieldsByCamelcaseNamesLazyInitStatic, this);
return FindPtrOrNull(fields_by_camelcase_name_,
- PointerStringPair(parent, camelcase_name.c_str()));
+ PointerStringPair(parent, camelcase_name));
}
inline const EnumValueDescriptor* FileDescriptorTables::FindEnumValueByNumber(
@@ -1181,7 +1181,7 @@
return reinterpret_cast<Type*>(AllocateBytes(sizeof(Type) * count));
}
-std::string* DescriptorPool::Tables::AllocateString(const std::string& value) {
+std::string* DescriptorPool::Tables::AllocateString(StringPiece value) {
std::string* result = new std::string(value);
strings_.emplace_back(result);
return result;
@@ -1293,16 +1293,16 @@
enforce_dependencies_ = false;
}
-void DescriptorPool::AddUnusedImportTrackFile(const std::string& file_name,
+void DescriptorPool::AddUnusedImportTrackFile(ConstStringParam file_name,
bool is_error) {
- unused_import_track_files_[file_name] = is_error;
+ unused_import_track_files_[std::string(file_name)] = is_error;
}
void DescriptorPool::ClearUnusedImportTrackFiles() {
unused_import_track_files_.clear();
}
-bool DescriptorPool::InternalIsFileLoaded(const std::string& filename) const {
+bool DescriptorPool::InternalIsFileLoaded(ConstStringParam filename) const {
MutexLockMaybe lock(mutex_);
return tables_->FindFile(filename) != nullptr;
}
@@ -1379,7 +1379,7 @@
// there's nothing more important to do (read: never).
const FileDescriptor* DescriptorPool::FindFileByName(
- const std::string& name) const {
+ ConstStringParam name) const {
MutexLockMaybe lock(mutex_);
if (fallback_database_ != nullptr) {
tables_->known_bad_symbols_.clear();
@@ -1399,7 +1399,7 @@
}
const FileDescriptor* DescriptorPool::FindFileContainingSymbol(
- const std::string& symbol_name) const {
+ ConstStringParam symbol_name) const {
MutexLockMaybe lock(mutex_);
if (fallback_database_ != nullptr) {
tables_->known_bad_symbols_.clear();
@@ -1420,13 +1420,13 @@
}
const Descriptor* DescriptorPool::FindMessageTypeByName(
- const std::string& name) const {
+ ConstStringParam name) const {
Symbol result = tables_->FindByNameHelper(this, name);
return (result.type == Symbol::MESSAGE) ? result.descriptor : nullptr;
}
const FieldDescriptor* DescriptorPool::FindFieldByName(
- const std::string& name) const {
+ ConstStringParam name) const {
Symbol result = tables_->FindByNameHelper(this, name);
if (result.type == Symbol::FIELD &&
!result.field_descriptor->is_extension()) {
@@ -1437,7 +1437,7 @@
}
const FieldDescriptor* DescriptorPool::FindExtensionByName(
- const std::string& name) const {
+ ConstStringParam name) const {
Symbol result = tables_->FindByNameHelper(this, name);
if (result.type == Symbol::FIELD && result.field_descriptor->is_extension()) {
return result.field_descriptor;
@@ -1447,32 +1447,32 @@
}
const OneofDescriptor* DescriptorPool::FindOneofByName(
- const std::string& name) const {
+ ConstStringParam name) const {
Symbol result = tables_->FindByNameHelper(this, name);
return (result.type == Symbol::ONEOF) ? result.oneof_descriptor : nullptr;
}
const EnumDescriptor* DescriptorPool::FindEnumTypeByName(
- const std::string& name) const {
+ ConstStringParam name) const {
Symbol result = tables_->FindByNameHelper(this, name);
return (result.type == Symbol::ENUM) ? result.enum_descriptor : nullptr;
}
const EnumValueDescriptor* DescriptorPool::FindEnumValueByName(
- const std::string& name) const {
+ ConstStringParam name) const {
Symbol result = tables_->FindByNameHelper(this, name);
return (result.type == Symbol::ENUM_VALUE) ? result.enum_value_descriptor
: nullptr;
}
const ServiceDescriptor* DescriptorPool::FindServiceByName(
- const std::string& name) const {
+ ConstStringParam name) const {
Symbol result = tables_->FindByNameHelper(this, name);
return (result.type == Symbol::SERVICE) ? result.service_descriptor : nullptr;
}
const MethodDescriptor* DescriptorPool::FindMethodByName(
- const std::string& name) const {
+ ConstStringParam name) const {
Symbol result = tables_->FindByNameHelper(this, name);
return (result.type == Symbol::METHOD) ? result.method_descriptor : nullptr;
}
@@ -1529,7 +1529,7 @@
}
const FieldDescriptor* DescriptorPool::FindExtensionByPrintableName(
- const Descriptor* extendee, const std::string& printable_name) const {
+ const Descriptor* extendee, ConstStringParam printable_name) const {
if (extendee->extension_range_count() == 0) return nullptr;
const FieldDescriptor* result = FindExtensionByName(printable_name);
if (result != nullptr && result->containing_type() == extendee) {
@@ -1600,7 +1600,7 @@
}
const FieldDescriptor* Descriptor::FindFieldByLowercaseName(
- const std::string& key) const {
+ ConstStringParam key) const {
const FieldDescriptor* result =
file()->tables_->FindFieldByLowercaseName(this, key);
if (result == nullptr || result->is_extension()) {
@@ -1611,7 +1611,7 @@
}
const FieldDescriptor* Descriptor::FindFieldByCamelcaseName(
- const std::string& key) const {
+ ConstStringParam key) const {
const FieldDescriptor* result =
file()->tables_->FindFieldByCamelcaseName(this, key);
if (result == nullptr || result->is_extension()) {
@@ -1621,8 +1621,7 @@
}
}
-const FieldDescriptor* Descriptor::FindFieldByName(
- const std::string& key) const {
+const FieldDescriptor* Descriptor::FindFieldByName(ConstStringParam key) const {
Symbol result =
file()->tables_->FindNestedSymbolOfType(this, key, Symbol::FIELD);
if (!result.IsNull() && !result.field_descriptor->is_extension()) {
@@ -1632,8 +1631,7 @@
}
}
-const OneofDescriptor* Descriptor::FindOneofByName(
- const std::string& key) const {
+const OneofDescriptor* Descriptor::FindOneofByName(ConstStringParam key) const {
Symbol result =
file()->tables_->FindNestedSymbolOfType(this, key, Symbol::ONEOF);
if (!result.IsNull()) {
@@ -1644,7 +1642,7 @@
}
const FieldDescriptor* Descriptor::FindExtensionByName(
- const std::string& key) const {
+ ConstStringParam key) const {
Symbol result =
file()->tables_->FindNestedSymbolOfType(this, key, Symbol::FIELD);
if (!result.IsNull() && result.field_descriptor->is_extension()) {
@@ -1655,7 +1653,7 @@
}
const FieldDescriptor* Descriptor::FindExtensionByLowercaseName(
- const std::string& key) const {
+ ConstStringParam key) const {
const FieldDescriptor* result =
file()->tables_->FindFieldByLowercaseName(this, key);
if (result == nullptr || !result->is_extension()) {
@@ -1666,7 +1664,7 @@
}
const FieldDescriptor* Descriptor::FindExtensionByCamelcaseName(
- const std::string& key) const {
+ ConstStringParam key) const {
const FieldDescriptor* result =
file()->tables_->FindFieldByCamelcaseName(this, key);
if (result == nullptr || !result->is_extension()) {
@@ -1676,8 +1674,7 @@
}
}
-const Descriptor* Descriptor::FindNestedTypeByName(
- const std::string& key) const {
+const Descriptor* Descriptor::FindNestedTypeByName(ConstStringParam key) const {
Symbol result =
file()->tables_->FindNestedSymbolOfType(this, key, Symbol::MESSAGE);
if (!result.IsNull()) {
@@ -1688,7 +1685,7 @@
}
const EnumDescriptor* Descriptor::FindEnumTypeByName(
- const std::string& key) const {
+ ConstStringParam key) const {
Symbol result =
file()->tables_->FindNestedSymbolOfType(this, key, Symbol::ENUM);
if (!result.IsNull()) {
@@ -1699,7 +1696,7 @@
}
const EnumValueDescriptor* Descriptor::FindEnumValueByName(
- const std::string& key) const {
+ ConstStringParam key) const {
Symbol result =
file()->tables_->FindNestedSymbolOfType(this, key, Symbol::ENUM_VALUE);
if (!result.IsNull()) {
@@ -1742,7 +1739,7 @@
}
const MethodDescriptor* ServiceDescriptor::FindMethodByName(
- const std::string& key) const {
+ ConstStringParam key) const {
Symbol result =
file()->tables_->FindNestedSymbolOfType(this, key, Symbol::METHOD);
if (!result.IsNull()) {
@@ -1753,7 +1750,7 @@
}
const Descriptor* FileDescriptor::FindMessageTypeByName(
- const std::string& key) const {
+ ConstStringParam key) const {
Symbol result = tables_->FindNestedSymbolOfType(this, key, Symbol::MESSAGE);
if (!result.IsNull()) {
return result.descriptor;
@@ -1763,7 +1760,7 @@
}
const EnumDescriptor* FileDescriptor::FindEnumTypeByName(
- const std::string& key) const {
+ ConstStringParam key) const {
Symbol result = tables_->FindNestedSymbolOfType(this, key, Symbol::ENUM);
if (!result.IsNull()) {
return result.enum_descriptor;
@@ -1773,7 +1770,7 @@
}
const EnumValueDescriptor* FileDescriptor::FindEnumValueByName(
- const std::string& key) const {
+ ConstStringParam key) const {
Symbol result =
tables_->FindNestedSymbolOfType(this, key, Symbol::ENUM_VALUE);
if (!result.IsNull()) {
@@ -1784,7 +1781,7 @@
}
const ServiceDescriptor* FileDescriptor::FindServiceByName(
- const std::string& key) const {
+ ConstStringParam key) const {
Symbol result = tables_->FindNestedSymbolOfType(this, key, Symbol::SERVICE);
if (!result.IsNull()) {
return result.service_descriptor;
@@ -1794,7 +1791,7 @@
}
const FieldDescriptor* FileDescriptor::FindExtensionByName(
- const std::string& key) const {
+ ConstStringParam key) const {
Symbol result = tables_->FindNestedSymbolOfType(this, key, Symbol::FIELD);
if (!result.IsNull() && result.field_descriptor->is_extension()) {
return result.field_descriptor;
@@ -1804,7 +1801,7 @@
}
const FieldDescriptor* FileDescriptor::FindExtensionByLowercaseName(
- const std::string& key) const {
+ ConstStringParam key) const {
const FieldDescriptor* result = tables_->FindFieldByLowercaseName(this, key);
if (result == nullptr || !result->is_extension()) {
return nullptr;
@@ -1814,7 +1811,7 @@
}
const FieldDescriptor* FileDescriptor::FindExtensionByCamelcaseName(
- const std::string& key) const {
+ ConstStringParam key) const {
const FieldDescriptor* result = tables_->FindFieldByCamelcaseName(this, key);
if (result == nullptr || !result->is_extension()) {
return nullptr;
@@ -1871,22 +1868,23 @@
// -------------------------------------------------------------------
bool DescriptorPool::TryFindFileInFallbackDatabase(
- const std::string& name) const {
+ StringPiece name) const {
if (fallback_database_ == nullptr) return false;
- if (tables_->known_bad_files_.count(name) > 0) return false;
+ auto name_string = std::string(name);
+ if (tables_->known_bad_files_.count(name_string) > 0) return false;
FileDescriptorProto file_proto;
- if (!fallback_database_->FindFileByName(name, &file_proto) ||
+ if (!fallback_database_->FindFileByName(name_string, &file_proto) ||
BuildFileFromDatabase(file_proto) == nullptr) {
- tables_->known_bad_files_.insert(name);
+ tables_->known_bad_files_.insert(std::move(name_string));
return false;
}
return true;
}
-bool DescriptorPool::IsSubSymbolOfBuiltType(const std::string& name) const {
- std::string prefix = name;
+bool DescriptorPool::IsSubSymbolOfBuiltType(StringPiece name) const {
+ auto prefix = std::string(name);
for (;;) {
std::string::size_type dot_pos = prefix.find_last_of('.');
if (dot_pos == std::string::npos) {
@@ -1908,10 +1906,11 @@
}
bool DescriptorPool::TryFindSymbolInFallbackDatabase(
- const std::string& name) const {
+ StringPiece name) const {
if (fallback_database_ == nullptr) return false;
- if (tables_->known_bad_symbols_.count(name) > 0) return false;
+ auto name_string = std::string(name);
+ if (tables_->known_bad_symbols_.count(name_string) > 0) return false;
FileDescriptorProto file_proto;
if ( // We skip looking in the fallback database if the name is a sub-symbol
@@ -1933,7 +1932,7 @@
IsSubSymbolOfBuiltType(name)
// Look up file containing this symbol in fallback database.
- || !fallback_database_->FindFileContainingSymbol(name, &file_proto)
+ || !fallback_database_->FindFileContainingSymbol(name_string, &file_proto)
// Check if we've already built this file. If so, it apparently doesn't
// contain the symbol we're looking for. Some DescriptorDatabases
@@ -1942,7 +1941,7 @@
// Build the file.
|| BuildFileFromDatabase(file_proto) == nullptr) {
- tables_->known_bad_symbols_.insert(name);
+ tables_->known_bad_symbols_.insert(std::move(name_string));
return false;
}
@@ -3864,7 +3863,7 @@
return result;
}
-static bool ValidateQualifiedName(const std::string& name) {
+static bool ValidateQualifiedName(StringPiece name) {
bool last_was_period = false;
for (int i = 0; i < name.size(); i++) {
@@ -3884,14 +3883,14 @@
return !name.empty() && !last_was_period;
}
-Symbol DescriptorPool::NewPlaceholder(const std::string& name,
+Symbol DescriptorPool::NewPlaceholder(StringPiece name,
PlaceholderType placeholder_type) const {
MutexLockMaybe lock(mutex_);
return NewPlaceholderWithMutexHeld(name, placeholder_type);
}
Symbol DescriptorPool::NewPlaceholderWithMutexHeld(
- const std::string& name, PlaceholderType placeholder_type) const {
+ StringPiece name, PlaceholderType placeholder_type) const {
if (mutex_) {
mutex_->AssertHeld();
}
@@ -3989,13 +3988,13 @@
}
FileDescriptor* DescriptorPool::NewPlaceholderFile(
- const std::string& name) const {
+ StringPiece name) const {
MutexLockMaybe lock(mutex_);
return NewPlaceholderFileWithMutexHeld(name);
}
FileDescriptor* DescriptorPool::NewPlaceholderFileWithMutexHeld(
- const std::string& name) const {
+ StringPiece name) const {
if (mutex_) {
mutex_->AssertHeld();
}
@@ -7269,9 +7268,9 @@
}
}
-Symbol DescriptorPool::CrossLinkOnDemandHelper(const std::string& name,
+Symbol DescriptorPool::CrossLinkOnDemandHelper(StringPiece name,
bool expecting_enum) const {
- std::string lookup_name = name;
+ auto lookup_name = std::string(name);
if (!lookup_name.empty() && lookup_name[0] == '.') {
lookup_name = lookup_name.substr(1);
}
@@ -7399,7 +7398,7 @@
descriptor_ = descriptor;
}
-void LazyDescriptor::SetLazy(const std::string& name,
+void LazyDescriptor::SetLazy(StringPiece name,
const FileDescriptor* file) {
// verify Init() has been called and Set hasn't been called yet.
GOOGLE_CHECK(!descriptor_);
diff --git a/src/google/protobuf/descriptor.h b/src/google/protobuf/descriptor.h
index f0d2064..078f24a 100644
--- a/src/google/protobuf/descriptor.h
+++ b/src/google/protobuf/descriptor.h
@@ -203,7 +203,7 @@
// build time if the symbol wasn't found and building of the file containing
// that type is delayed because lazily_build_dependencies_ is set on the pool.
// Should not be called after Set() has been called.
- void SetLazy(const std::string& name, const FileDescriptor* file);
+ void SetLazy(StringPiece name, const FileDescriptor* file);
// Returns the current value of the descriptor, thread-safe. If SetLazy(...)
// has been called, will do a one-time cross link of the type specified,
@@ -321,20 +321,20 @@
// exists.
const FieldDescriptor* FindFieldByNumber(int number) const;
// Looks up a field by name. Returns nullptr if no such field exists.
- const FieldDescriptor* FindFieldByName(const std::string& name) const;
+ const FieldDescriptor* FindFieldByName(ConstStringParam name) const;
// Looks up a field by lowercased name (as returned by lowercase_name()).
// This lookup may be ambiguous if multiple field names differ only by case,
// in which case the field returned is chosen arbitrarily from the matches.
const FieldDescriptor* FindFieldByLowercaseName(
- const std::string& lowercase_name) const;
+ ConstStringParam lowercase_name) const;
// Looks up a field by camel-case name (as returned by camelcase_name()).
// This lookup may be ambiguous if multiple field names differ in a way that
// leads them to have identical camel-case names, in which case the field
// returned is chosen arbitrarily from the matches.
const FieldDescriptor* FindFieldByCamelcaseName(
- const std::string& camelcase_name) const;
+ ConstStringParam camelcase_name) const;
// The number of oneofs in this message type.
int oneof_decl_count() const;
@@ -347,7 +347,7 @@
const OneofDescriptor* oneof_decl(int index) const;
// Looks up a oneof by name. Returns nullptr if no such oneof exists.
- const OneofDescriptor* FindOneofByName(const std::string& name) const;
+ const OneofDescriptor* FindOneofByName(ConstStringParam name) const;
// Nested type stuff -----------------------------------------------
@@ -359,7 +359,7 @@
// Looks up a nested type by name. Returns nullptr if no such nested type
// exists.
- const Descriptor* FindNestedTypeByName(const std::string& name) const;
+ const Descriptor* FindNestedTypeByName(ConstStringParam name) const;
// Enum stuff ------------------------------------------------------
@@ -371,11 +371,11 @@
// Looks up an enum type by name. Returns nullptr if no such enum type
// exists.
- const EnumDescriptor* FindEnumTypeByName(const std::string& name) const;
+ const EnumDescriptor* FindEnumTypeByName(ConstStringParam name) const;
// Looks up an enum value by name, among all enum types in this message.
// Returns nullptr if no such value exists.
- const EnumValueDescriptor* FindEnumValueByName(const std::string& name) const;
+ const EnumValueDescriptor* FindEnumValueByName(ConstStringParam name) const;
// Extensions ------------------------------------------------------
@@ -439,17 +439,17 @@
// Looks up a named extension (which extends some *other* message type)
// defined within this message type's scope.
- const FieldDescriptor* FindExtensionByName(const std::string& name) const;
+ const FieldDescriptor* FindExtensionByName(ConstStringParam name) const;
// Similar to FindFieldByLowercaseName(), but finds extensions defined within
// this message type's scope.
const FieldDescriptor* FindExtensionByLowercaseName(
- const std::string& name) const;
+ ConstStringParam name) const;
// Similar to FindFieldByCamelcaseName(), but finds extensions defined within
// this message type's scope.
const FieldDescriptor* FindExtensionByCamelcaseName(
- const std::string& name) const;
+ ConstStringParam name) const;
// Reserved fields -------------------------------------------------
@@ -479,7 +479,7 @@
const std::string& reserved_name(int index) const;
// Returns true if the field name is reserved.
- bool IsReservedName(const std::string& name) const;
+ bool IsReservedName(ConstStringParam name) const;
// Source Location ---------------------------------------------------
@@ -1088,7 +1088,7 @@
const std::string& reserved_name(int index) const;
// Returns true if the field name is reserved.
- bool IsReservedName(const std::string& name) const;
+ bool IsReservedName(ConstStringParam name) const;
// Source Location ---------------------------------------------------
@@ -1267,7 +1267,7 @@
const MethodDescriptor* method(int index) const;
// Look up a MethodDescriptor by name.
- const MethodDescriptor* FindMethodByName(const std::string& name) const;
+ const MethodDescriptor* FindMethodByName(ConstStringParam name) const;
// See Descriptor::CopyTo().
void CopyTo(ServiceDescriptorProto* proto) const;
@@ -1488,25 +1488,25 @@
static const char* SyntaxName(Syntax syntax);
// Find a top-level message type by name. Returns nullptr if not found.
- const Descriptor* FindMessageTypeByName(const std::string& name) const;
+ const Descriptor* FindMessageTypeByName(ConstStringParam name) const;
// Find a top-level enum type by name. Returns nullptr if not found.
- const EnumDescriptor* FindEnumTypeByName(const std::string& name) const;
+ const EnumDescriptor* FindEnumTypeByName(ConstStringParam name) const;
// Find an enum value defined in any top-level enum by name. Returns nullptr
// if not found.
- const EnumValueDescriptor* FindEnumValueByName(const std::string& name) const;
+ const EnumValueDescriptor* FindEnumValueByName(ConstStringParam name) const;
// Find a service definition by name. Returns nullptr if not found.
- const ServiceDescriptor* FindServiceByName(const std::string& name) const;
+ const ServiceDescriptor* FindServiceByName(ConstStringParam name) const;
// Find a top-level extension definition by name. Returns nullptr if not
// found.
- const FieldDescriptor* FindExtensionByName(const std::string& name) const;
+ const FieldDescriptor* FindExtensionByName(ConstStringParam name) const;
// Similar to FindExtensionByName(), but searches by lowercased-name. See
// Descriptor::FindFieldByLowercaseName().
const FieldDescriptor* FindExtensionByLowercaseName(
- const std::string& name) const;
+ ConstStringParam name) const;
// Similar to FindExtensionByName(), but searches by camelcased-name. See
// Descriptor::FindFieldByCamelcaseName().
const FieldDescriptor* FindExtensionByCamelcaseName(
- const std::string& name) const;
+ ConstStringParam name) const;
// See Descriptor::CopyTo().
// Notes:
@@ -1669,28 +1669,28 @@
// Find a FileDescriptor in the pool by file name. Returns nullptr if not
// found.
- const FileDescriptor* FindFileByName(const std::string& name) const;
+ const FileDescriptor* FindFileByName(ConstStringParam name) const;
// Find the FileDescriptor in the pool which defines the given symbol.
// If any of the Find*ByName() methods below would succeed, then this is
// equivalent to calling that method and calling the result's file() method.
// Otherwise this returns nullptr.
const FileDescriptor* FindFileContainingSymbol(
- const std::string& symbol_name) const;
+ ConstStringParam symbol_name) const;
// Looking up descriptors ------------------------------------------
// These find descriptors by fully-qualified name. These will find both
// top-level descriptors and nested descriptors. They return nullptr if not
// found.
- const Descriptor* FindMessageTypeByName(const std::string& name) const;
- const FieldDescriptor* FindFieldByName(const std::string& name) const;
- const FieldDescriptor* FindExtensionByName(const std::string& name) const;
- const OneofDescriptor* FindOneofByName(const std::string& name) const;
- const EnumDescriptor* FindEnumTypeByName(const std::string& name) const;
- const EnumValueDescriptor* FindEnumValueByName(const std::string& name) const;
- const ServiceDescriptor* FindServiceByName(const std::string& name) const;
- const MethodDescriptor* FindMethodByName(const std::string& name) const;
+ const Descriptor* FindMessageTypeByName(ConstStringParam name) const;
+ const FieldDescriptor* FindFieldByName(ConstStringParam name) const;
+ const FieldDescriptor* FindExtensionByName(ConstStringParam name) const;
+ const OneofDescriptor* FindOneofByName(ConstStringParam name) const;
+ const EnumDescriptor* FindEnumTypeByName(ConstStringParam name) const;
+ const EnumValueDescriptor* FindEnumValueByName(ConstStringParam name) const;
+ const ServiceDescriptor* FindServiceByName(ConstStringParam name) const;
+ const MethodDescriptor* FindMethodByName(ConstStringParam name) const;
// Finds an extension of the given type by number. The extendee must be
// a member of this DescriptorPool or one of its underlays.
@@ -1703,7 +1703,7 @@
// or one of its underlays. Returns nullptr if there is no known message
// extension with the given printable name.
const FieldDescriptor* FindExtensionByPrintableName(
- const Descriptor* extendee, const std::string& printable_name) const;
+ const Descriptor* extendee, ConstStringParam printable_name) const;
// Finds extensions of extendee. The extensions will be appended to
// out in an undefined order. Only extensions defined directly in
@@ -1876,11 +1876,11 @@
// For internal (unit test) use only: Returns true if a FileDescriptor has
// been constructed for the given file, false otherwise. Useful for testing
// lazy descriptor initialization behavior.
- bool InternalIsFileLoaded(const std::string& filename) const;
+ bool InternalIsFileLoaded(ConstStringParam filename) const;
// Add a file to unused_import_track_files_. DescriptorBuilder will log
// warnings or errors for those files if there is any unused import.
- void AddUnusedImportTrackFile(const std::string& file_name,
+ void AddUnusedImportTrackFile(ConstStringParam file_name,
bool is_error = false);
void ClearUnusedImportTrackFiles();
@@ -1899,14 +1899,14 @@
// Return true if the given name is a sub-symbol of any non-package
// descriptor that already exists in the descriptor pool. (The full
// definition of such types is already known.)
- bool IsSubSymbolOfBuiltType(const std::string& name) const;
+ bool IsSubSymbolOfBuiltType(StringPiece name) const;
// Tries to find something in the fallback database and link in the
// corresponding proto file. Returns true if successful, in which case
// the caller should search for the thing again. These are declared
// const because they are called by (semantically) const methods.
- bool TryFindFileInFallbackDatabase(const std::string& name) const;
- bool TryFindSymbolInFallbackDatabase(const std::string& name) const;
+ bool TryFindFileInFallbackDatabase(StringPiece name) const;
+ bool TryFindSymbolInFallbackDatabase(StringPiece name) const;
bool TryFindExtensionInFallbackDatabase(const Descriptor* containing_type,
int field_number) const;
@@ -1927,13 +1927,12 @@
// symbol is defined if necessary. Will create a placeholder if the type
// doesn't exist in the fallback database, or the file doesn't build
// successfully.
- Symbol CrossLinkOnDemandHelper(const std::string& name,
+ Symbol CrossLinkOnDemandHelper(StringPiece name,
bool expecting_enum) const;
// Create a placeholder FileDescriptor of the specified name
- FileDescriptor* NewPlaceholderFile(const std::string& name) const;
- FileDescriptor* NewPlaceholderFileWithMutexHeld(
- const std::string& name) const;
+ FileDescriptor* NewPlaceholderFile(StringPiece name) const;
+ FileDescriptor* NewPlaceholderFileWithMutexHeld(StringPiece name) const;
enum PlaceholderType {
PLACEHOLDER_MESSAGE,
@@ -1941,9 +1940,9 @@
PLACEHOLDER_EXTENDABLE_MESSAGE
};
// Create a placeholder Descriptor of the specified name
- Symbol NewPlaceholder(const std::string& name,
+ Symbol NewPlaceholder(StringPiece name,
PlaceholderType placeholder_type) const;
- Symbol NewPlaceholderWithMutexHeld(const std::string& name,
+ Symbol NewPlaceholderWithMutexHeld(StringPiece name,
PlaceholderType placeholder_type) const;
// If fallback_database_ is nullptr, this is nullptr. Otherwise, this is a
@@ -2126,9 +2125,9 @@
return FindReservedRangeContainingNumber(number) != nullptr;
}
-inline bool Descriptor::IsReservedName(const std::string& name) const {
+inline bool Descriptor::IsReservedName(ConstStringParam name) const {
for (int i = 0; i < reserved_name_count(); i++) {
- if (name == reserved_name(i)) {
+ if (name == static_cast<ConstStringParam>(reserved_name(i))) {
return true;
}
}
@@ -2145,9 +2144,9 @@
return FindReservedRangeContainingNumber(number) != nullptr;
}
-inline bool EnumDescriptor::IsReservedName(const std::string& name) const {
+inline bool EnumDescriptor::IsReservedName(ConstStringParam name) const {
for (int i = 0; i < reserved_name_count(); i++) {
- if (name == reserved_name(i)) {
+ if (name == static_cast<ConstStringParam>(reserved_name(i))) {
return true;
}
}
diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h
index da02ab4..fd0ed66 100644
--- a/src/google/protobuf/descriptor.pb.h
+++ b/src/google/protobuf/descriptor.pb.h
@@ -770,15 +770,6 @@
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_name();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- std::string* name);
private:
const std::string& _internal_name() const;
void _internal_set_name(const std::string& value);
@@ -799,15 +790,6 @@
std::string* mutable_package();
std::string* release_package();
void set_allocated_package(std::string* package);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_package();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_package(
- std::string* package);
private:
const std::string& _internal_package() const;
void _internal_set_package(const std::string& value);
@@ -828,15 +810,6 @@
std::string* mutable_syntax();
std::string* release_syntax();
void set_allocated_syntax(std::string* syntax);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_syntax();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_syntax(
- std::string* syntax);
private:
const std::string& _internal_syntax() const;
void _internal_set_syntax(const std::string& value);
@@ -1550,15 +1523,6 @@
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_name();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- std::string* name);
private:
const std::string& _internal_name() const;
void _internal_set_name(const std::string& value);
@@ -2002,15 +1966,6 @@
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_name();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- std::string* name);
private:
const std::string& _internal_name() const;
void _internal_set_name(const std::string& value);
@@ -2031,15 +1986,6 @@
std::string* mutable_extendee();
std::string* release_extendee();
void set_allocated_extendee(std::string* extendee);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_extendee();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_extendee(
- std::string* extendee);
private:
const std::string& _internal_extendee() const;
void _internal_set_extendee(const std::string& value);
@@ -2060,15 +2006,6 @@
std::string* mutable_type_name();
std::string* release_type_name();
void set_allocated_type_name(std::string* type_name);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_type_name();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_type_name(
- std::string* type_name);
private:
const std::string& _internal_type_name() const;
void _internal_set_type_name(const std::string& value);
@@ -2089,15 +2026,6 @@
std::string* mutable_default_value();
std::string* release_default_value();
void set_allocated_default_value(std::string* default_value);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_default_value();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_default_value(
- std::string* default_value);
private:
const std::string& _internal_default_value() const;
void _internal_set_default_value(const std::string& value);
@@ -2118,15 +2046,6 @@
std::string* mutable_json_name();
std::string* release_json_name();
void set_allocated_json_name(std::string* json_name);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_json_name();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_json_name(
- std::string* json_name);
private:
const std::string& _internal_json_name() const;
void _internal_set_json_name(const std::string& value);
@@ -2377,15 +2296,6 @@
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_name();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- std::string* name);
private:
const std::string& _internal_name() const;
void _internal_set_name(const std::string& value);
@@ -2791,15 +2701,6 @@
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_name();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- std::string* name);
private:
const std::string& _internal_name() const;
void _internal_set_name(const std::string& value);
@@ -2980,15 +2881,6 @@
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_name();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- std::string* name);
private:
const std::string& _internal_name() const;
void _internal_set_name(const std::string& value);
@@ -3198,15 +3090,6 @@
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_name();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- std::string* name);
private:
const std::string& _internal_name() const;
void _internal_set_name(const std::string& value);
@@ -3388,15 +3271,6 @@
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_name();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- std::string* name);
private:
const std::string& _internal_name() const;
void _internal_set_name(const std::string& value);
@@ -3417,15 +3291,6 @@
std::string* mutable_input_type();
std::string* release_input_type();
void set_allocated_input_type(std::string* input_type);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_input_type();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_input_type(
- std::string* input_type);
private:
const std::string& _internal_input_type() const;
void _internal_set_input_type(const std::string& value);
@@ -3446,15 +3311,6 @@
std::string* mutable_output_type();
std::string* release_output_type();
void set_allocated_output_type(std::string* output_type);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_output_type();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_output_type(
- std::string* output_type);
private:
const std::string& _internal_output_type() const;
void _internal_set_output_type(const std::string& value);
@@ -3730,15 +3586,6 @@
std::string* mutable_java_package();
std::string* release_java_package();
void set_allocated_java_package(std::string* java_package);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_java_package();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_java_package(
- std::string* java_package);
private:
const std::string& _internal_java_package() const;
void _internal_set_java_package(const std::string& value);
@@ -3759,15 +3606,6 @@
std::string* mutable_java_outer_classname();
std::string* release_java_outer_classname();
void set_allocated_java_outer_classname(std::string* java_outer_classname);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_java_outer_classname();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_java_outer_classname(
- std::string* java_outer_classname);
private:
const std::string& _internal_java_outer_classname() const;
void _internal_set_java_outer_classname(const std::string& value);
@@ -3788,15 +3626,6 @@
std::string* mutable_go_package();
std::string* release_go_package();
void set_allocated_go_package(std::string* go_package);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_go_package();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_go_package(
- std::string* go_package);
private:
const std::string& _internal_go_package() const;
void _internal_set_go_package(const std::string& value);
@@ -3817,15 +3646,6 @@
std::string* mutable_objc_class_prefix();
std::string* release_objc_class_prefix();
void set_allocated_objc_class_prefix(std::string* objc_class_prefix);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_objc_class_prefix();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_objc_class_prefix(
- std::string* objc_class_prefix);
private:
const std::string& _internal_objc_class_prefix() const;
void _internal_set_objc_class_prefix(const std::string& value);
@@ -3846,15 +3666,6 @@
std::string* mutable_csharp_namespace();
std::string* release_csharp_namespace();
void set_allocated_csharp_namespace(std::string* csharp_namespace);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_csharp_namespace();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_csharp_namespace(
- std::string* csharp_namespace);
private:
const std::string& _internal_csharp_namespace() const;
void _internal_set_csharp_namespace(const std::string& value);
@@ -3875,15 +3686,6 @@
std::string* mutable_swift_prefix();
std::string* release_swift_prefix();
void set_allocated_swift_prefix(std::string* swift_prefix);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_swift_prefix();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_swift_prefix(
- std::string* swift_prefix);
private:
const std::string& _internal_swift_prefix() const;
void _internal_set_swift_prefix(const std::string& value);
@@ -3904,15 +3706,6 @@
std::string* mutable_php_class_prefix();
std::string* release_php_class_prefix();
void set_allocated_php_class_prefix(std::string* php_class_prefix);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_php_class_prefix();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_php_class_prefix(
- std::string* php_class_prefix);
private:
const std::string& _internal_php_class_prefix() const;
void _internal_set_php_class_prefix(const std::string& value);
@@ -3933,15 +3726,6 @@
std::string* mutable_php_namespace();
std::string* release_php_namespace();
void set_allocated_php_namespace(std::string* php_namespace);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_php_namespace();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_php_namespace(
- std::string* php_namespace);
private:
const std::string& _internal_php_namespace() const;
void _internal_set_php_namespace(const std::string& value);
@@ -3962,15 +3746,6 @@
std::string* mutable_php_metadata_namespace();
std::string* release_php_metadata_namespace();
void set_allocated_php_metadata_namespace(std::string* php_metadata_namespace);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_php_metadata_namespace();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_php_metadata_namespace(
- std::string* php_metadata_namespace);
private:
const std::string& _internal_php_metadata_namespace() const;
void _internal_set_php_metadata_namespace(const std::string& value);
@@ -3991,15 +3766,6 @@
std::string* mutable_ruby_package();
std::string* release_ruby_package();
void set_allocated_ruby_package(std::string* ruby_package);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_ruby_package();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_ruby_package(
- std::string* ruby_package);
private:
const std::string& _internal_ruby_package() const;
void _internal_set_ruby_package(const std::string& value);
@@ -5744,15 +5510,6 @@
std::string* mutable_name_part();
std::string* release_name_part();
void set_allocated_name_part(std::string* name_part);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_name_part();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name_part(
- std::string* name_part);
private:
const std::string& _internal_name_part() const;
void _internal_set_name_part(const std::string& value);
@@ -5952,15 +5709,6 @@
std::string* mutable_identifier_value();
std::string* release_identifier_value();
void set_allocated_identifier_value(std::string* identifier_value);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_identifier_value();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_identifier_value(
- std::string* identifier_value);
private:
const std::string& _internal_identifier_value() const;
void _internal_set_identifier_value(const std::string& value);
@@ -5981,15 +5729,6 @@
std::string* mutable_string_value();
std::string* release_string_value();
void set_allocated_string_value(std::string* string_value);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_string_value();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_string_value(
- std::string* string_value);
private:
const std::string& _internal_string_value() const;
void _internal_set_string_value(const std::string& value);
@@ -6010,15 +5749,6 @@
std::string* mutable_aggregate_value();
std::string* release_aggregate_value();
void set_allocated_aggregate_value(std::string* aggregate_value);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_aggregate_value();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_aggregate_value(
- std::string* aggregate_value);
private:
const std::string& _internal_aggregate_value() const;
void _internal_set_aggregate_value(const std::string& value);
@@ -6292,15 +6022,6 @@
std::string* mutable_leading_comments();
std::string* release_leading_comments();
void set_allocated_leading_comments(std::string* leading_comments);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_leading_comments();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_leading_comments(
- std::string* leading_comments);
private:
const std::string& _internal_leading_comments() const;
void _internal_set_leading_comments(const std::string& value);
@@ -6321,15 +6042,6 @@
std::string* mutable_trailing_comments();
std::string* release_trailing_comments();
void set_allocated_trailing_comments(std::string* trailing_comments);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_trailing_comments();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_trailing_comments(
- std::string* trailing_comments);
private:
const std::string& _internal_trailing_comments() const;
void _internal_set_trailing_comments(const std::string& value);
@@ -6672,15 +6384,6 @@
std::string* mutable_source_file();
std::string* release_source_file();
void set_allocated_source_file(std::string* source_file);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_source_file();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_source_file(
- std::string* source_file);
private:
const std::string& _internal_source_file() const;
void _internal_set_source_file(const std::string& value);
@@ -7011,25 +6714,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.name)
}
-inline std::string* FileDescriptorProto::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileDescriptorProto.name)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000001u;
- return name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void FileDescriptorProto::unsafe_arena_set_allocated_name(
- std::string* name) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (name != nullptr) {
- _has_bits_[0] |= 0x00000001u;
- } else {
- _has_bits_[0] &= ~0x00000001u;
- }
- name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- name, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileDescriptorProto.name)
-}
// optional string package = 2;
inline bool FileDescriptorProto::_internal_has_package() const {
@@ -7104,25 +6788,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.package)
}
-inline std::string* FileDescriptorProto::unsafe_arena_release_package() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileDescriptorProto.package)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000002u;
- return package_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void FileDescriptorProto::unsafe_arena_set_allocated_package(
- std::string* package) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (package != nullptr) {
- _has_bits_[0] |= 0x00000002u;
- } else {
- _has_bits_[0] &= ~0x00000002u;
- }
- package_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- package, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileDescriptorProto.package)
-}
// repeated string dependency = 3;
inline int FileDescriptorProto::_internal_dependency_size() const {
@@ -7687,25 +7352,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.syntax)
}
-inline std::string* FileDescriptorProto::unsafe_arena_release_syntax() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileDescriptorProto.syntax)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000004u;
- return syntax_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void FileDescriptorProto::unsafe_arena_set_allocated_syntax(
- std::string* syntax) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (syntax != nullptr) {
- _has_bits_[0] |= 0x00000004u;
- } else {
- _has_bits_[0] &= ~0x00000004u;
- }
- syntax_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- syntax, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileDescriptorProto.syntax)
-}
// -------------------------------------------------------------------
@@ -7987,25 +7633,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.DescriptorProto.name)
}
-inline std::string* DescriptorProto::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.DescriptorProto.name)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000001u;
- return name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void DescriptorProto::unsafe_arena_set_allocated_name(
- std::string* name) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (name != nullptr) {
- _has_bits_[0] |= 0x00000001u;
- } else {
- _has_bits_[0] &= ~0x00000001u;
- }
- name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- name, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.DescriptorProto.name)
-}
// repeated .google.protobuf.FieldDescriptorProto field = 2;
inline int DescriptorProto::_internal_field_size() const {
@@ -8557,25 +8184,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.name)
}
-inline std::string* FieldDescriptorProto::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FieldDescriptorProto.name)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000001u;
- return name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void FieldDescriptorProto::unsafe_arena_set_allocated_name(
- std::string* name) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (name != nullptr) {
- _has_bits_[0] |= 0x00000001u;
- } else {
- _has_bits_[0] &= ~0x00000001u;
- }
- name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- name, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FieldDescriptorProto.name)
-}
// optional int32 number = 3;
inline bool FieldDescriptorProto::_internal_has_number() const {
@@ -8736,25 +8344,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.type_name)
}
-inline std::string* FieldDescriptorProto::unsafe_arena_release_type_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FieldDescriptorProto.type_name)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000004u;
- return type_name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void FieldDescriptorProto::unsafe_arena_set_allocated_type_name(
- std::string* type_name) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (type_name != nullptr) {
- _has_bits_[0] |= 0x00000004u;
- } else {
- _has_bits_[0] &= ~0x00000004u;
- }
- type_name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- type_name, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FieldDescriptorProto.type_name)
-}
// optional string extendee = 2;
inline bool FieldDescriptorProto::_internal_has_extendee() const {
@@ -8829,25 +8418,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.extendee)
}
-inline std::string* FieldDescriptorProto::unsafe_arena_release_extendee() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FieldDescriptorProto.extendee)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000002u;
- return extendee_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void FieldDescriptorProto::unsafe_arena_set_allocated_extendee(
- std::string* extendee) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (extendee != nullptr) {
- _has_bits_[0] |= 0x00000002u;
- } else {
- _has_bits_[0] &= ~0x00000002u;
- }
- extendee_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- extendee, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FieldDescriptorProto.extendee)
-}
// optional string default_value = 7;
inline bool FieldDescriptorProto::_internal_has_default_value() const {
@@ -8922,25 +8492,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.default_value)
}
-inline std::string* FieldDescriptorProto::unsafe_arena_release_default_value() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FieldDescriptorProto.default_value)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000008u;
- return default_value_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void FieldDescriptorProto::unsafe_arena_set_allocated_default_value(
- std::string* default_value) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (default_value != nullptr) {
- _has_bits_[0] |= 0x00000008u;
- } else {
- _has_bits_[0] &= ~0x00000008u;
- }
- default_value_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- default_value, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FieldDescriptorProto.default_value)
-}
// optional int32 oneof_index = 9;
inline bool FieldDescriptorProto::_internal_has_oneof_index() const {
@@ -9043,25 +8594,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.json_name)
}
-inline std::string* FieldDescriptorProto::unsafe_arena_release_json_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FieldDescriptorProto.json_name)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000010u;
- return json_name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void FieldDescriptorProto::unsafe_arena_set_allocated_json_name(
- std::string* json_name) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (json_name != nullptr) {
- _has_bits_[0] |= 0x00000010u;
- } else {
- _has_bits_[0] &= ~0x00000010u;
- }
- json_name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- json_name, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FieldDescriptorProto.json_name)
-}
// optional .google.protobuf.FieldOptions options = 8;
inline bool FieldDescriptorProto::_internal_has_options() const {
@@ -9251,25 +8783,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.OneofDescriptorProto.name)
}
-inline std::string* OneofDescriptorProto::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.OneofDescriptorProto.name)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000001u;
- return name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void OneofDescriptorProto::unsafe_arena_set_allocated_name(
- std::string* name) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (name != nullptr) {
- _has_bits_[0] |= 0x00000001u;
- } else {
- _has_bits_[0] &= ~0x00000001u;
- }
- name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- name, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.OneofDescriptorProto.name)
-}
// optional .google.protobuf.OneofOptions options = 2;
inline bool OneofDescriptorProto::_internal_has_options() const {
@@ -9491,25 +9004,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumDescriptorProto.name)
}
-inline std::string* EnumDescriptorProto::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.EnumDescriptorProto.name)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000001u;
- return name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void EnumDescriptorProto::unsafe_arena_set_allocated_name(
- std::string* name) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (name != nullptr) {
- _has_bits_[0] |= 0x00000001u;
- } else {
- _has_bits_[0] &= ~0x00000001u;
- }
- name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- name, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.EnumDescriptorProto.name)
-}
// repeated .google.protobuf.EnumValueDescriptorProto value = 2;
inline int EnumDescriptorProto::_internal_value_size() const {
@@ -9823,25 +9317,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValueDescriptorProto.name)
}
-inline std::string* EnumValueDescriptorProto::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.EnumValueDescriptorProto.name)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000001u;
- return name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void EnumValueDescriptorProto::unsafe_arena_set_allocated_name(
- std::string* name) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (name != nullptr) {
- _has_bits_[0] |= 0x00000001u;
- } else {
- _has_bits_[0] &= ~0x00000001u;
- }
- name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- name, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.EnumValueDescriptorProto.name)
-}
// optional int32 number = 2;
inline bool EnumValueDescriptorProto::_internal_has_number() const {
@@ -10031,25 +9506,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.ServiceDescriptorProto.name)
}
-inline std::string* ServiceDescriptorProto::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.ServiceDescriptorProto.name)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000001u;
- return name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void ServiceDescriptorProto::unsafe_arena_set_allocated_name(
- std::string* name) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (name != nullptr) {
- _has_bits_[0] |= 0x00000001u;
- } else {
- _has_bits_[0] &= ~0x00000001u;
- }
- name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- name, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.ServiceDescriptorProto.name)
-}
// repeated .google.protobuf.MethodDescriptorProto method = 2;
inline int ServiceDescriptorProto::_internal_method_size() const {
@@ -10250,25 +9706,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.name)
}
-inline std::string* MethodDescriptorProto::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.MethodDescriptorProto.name)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000001u;
- return name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void MethodDescriptorProto::unsafe_arena_set_allocated_name(
- std::string* name) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (name != nullptr) {
- _has_bits_[0] |= 0x00000001u;
- } else {
- _has_bits_[0] &= ~0x00000001u;
- }
- name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- name, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.MethodDescriptorProto.name)
-}
// optional string input_type = 2;
inline bool MethodDescriptorProto::_internal_has_input_type() const {
@@ -10343,25 +9780,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.input_type)
}
-inline std::string* MethodDescriptorProto::unsafe_arena_release_input_type() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.MethodDescriptorProto.input_type)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000002u;
- return input_type_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void MethodDescriptorProto::unsafe_arena_set_allocated_input_type(
- std::string* input_type) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (input_type != nullptr) {
- _has_bits_[0] |= 0x00000002u;
- } else {
- _has_bits_[0] &= ~0x00000002u;
- }
- input_type_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- input_type, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.MethodDescriptorProto.input_type)
-}
// optional string output_type = 3;
inline bool MethodDescriptorProto::_internal_has_output_type() const {
@@ -10436,25 +9854,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.output_type)
}
-inline std::string* MethodDescriptorProto::unsafe_arena_release_output_type() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.MethodDescriptorProto.output_type)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000004u;
- return output_type_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void MethodDescriptorProto::unsafe_arena_set_allocated_output_type(
- std::string* output_type) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (output_type != nullptr) {
- _has_bits_[0] |= 0x00000004u;
- } else {
- _has_bits_[0] &= ~0x00000004u;
- }
- output_type_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- output_type, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.MethodDescriptorProto.output_type)
-}
// optional .google.protobuf.MethodOptions options = 4;
inline bool MethodDescriptorProto::_internal_has_options() const {
@@ -10672,25 +10071,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.java_package)
}
-inline std::string* FileOptions::unsafe_arena_release_java_package() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.java_package)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000001u;
- return java_package_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void FileOptions::unsafe_arena_set_allocated_java_package(
- std::string* java_package) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (java_package != nullptr) {
- _has_bits_[0] |= 0x00000001u;
- } else {
- _has_bits_[0] &= ~0x00000001u;
- }
- java_package_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- java_package, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.java_package)
-}
// optional string java_outer_classname = 8;
inline bool FileOptions::_internal_has_java_outer_classname() const {
@@ -10765,25 +10145,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.java_outer_classname)
}
-inline std::string* FileOptions::unsafe_arena_release_java_outer_classname() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.java_outer_classname)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000002u;
- return java_outer_classname_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void FileOptions::unsafe_arena_set_allocated_java_outer_classname(
- std::string* java_outer_classname) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (java_outer_classname != nullptr) {
- _has_bits_[0] |= 0x00000002u;
- } else {
- _has_bits_[0] &= ~0x00000002u;
- }
- java_outer_classname_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- java_outer_classname, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.java_outer_classname)
-}
// optional bool java_multiple_files = 10 [default = false];
inline bool FileOptions::_internal_has_java_multiple_files() const {
@@ -10971,25 +10332,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.go_package)
}
-inline std::string* FileOptions::unsafe_arena_release_go_package() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.go_package)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000004u;
- return go_package_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void FileOptions::unsafe_arena_set_allocated_go_package(
- std::string* go_package) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (go_package != nullptr) {
- _has_bits_[0] |= 0x00000004u;
- } else {
- _has_bits_[0] &= ~0x00000004u;
- }
- go_package_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- go_package, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.go_package)
-}
// optional bool cc_generic_services = 16 [default = false];
inline bool FileOptions::_internal_has_cc_generic_services() const {
@@ -11232,25 +10574,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.objc_class_prefix)
}
-inline std::string* FileOptions::unsafe_arena_release_objc_class_prefix() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.objc_class_prefix)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000008u;
- return objc_class_prefix_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void FileOptions::unsafe_arena_set_allocated_objc_class_prefix(
- std::string* objc_class_prefix) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (objc_class_prefix != nullptr) {
- _has_bits_[0] |= 0x00000008u;
- } else {
- _has_bits_[0] &= ~0x00000008u;
- }
- objc_class_prefix_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- objc_class_prefix, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.objc_class_prefix)
-}
// optional string csharp_namespace = 37;
inline bool FileOptions::_internal_has_csharp_namespace() const {
@@ -11325,25 +10648,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.csharp_namespace)
}
-inline std::string* FileOptions::unsafe_arena_release_csharp_namespace() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.csharp_namespace)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000010u;
- return csharp_namespace_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void FileOptions::unsafe_arena_set_allocated_csharp_namespace(
- std::string* csharp_namespace) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (csharp_namespace != nullptr) {
- _has_bits_[0] |= 0x00000010u;
- } else {
- _has_bits_[0] &= ~0x00000010u;
- }
- csharp_namespace_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- csharp_namespace, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.csharp_namespace)
-}
// optional string swift_prefix = 39;
inline bool FileOptions::_internal_has_swift_prefix() const {
@@ -11418,25 +10722,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.swift_prefix)
}
-inline std::string* FileOptions::unsafe_arena_release_swift_prefix() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.swift_prefix)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000020u;
- return swift_prefix_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void FileOptions::unsafe_arena_set_allocated_swift_prefix(
- std::string* swift_prefix) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (swift_prefix != nullptr) {
- _has_bits_[0] |= 0x00000020u;
- } else {
- _has_bits_[0] &= ~0x00000020u;
- }
- swift_prefix_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- swift_prefix, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.swift_prefix)
-}
// optional string php_class_prefix = 40;
inline bool FileOptions::_internal_has_php_class_prefix() const {
@@ -11511,25 +10796,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_class_prefix)
}
-inline std::string* FileOptions::unsafe_arena_release_php_class_prefix() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.php_class_prefix)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000040u;
- return php_class_prefix_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void FileOptions::unsafe_arena_set_allocated_php_class_prefix(
- std::string* php_class_prefix) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (php_class_prefix != nullptr) {
- _has_bits_[0] |= 0x00000040u;
- } else {
- _has_bits_[0] &= ~0x00000040u;
- }
- php_class_prefix_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- php_class_prefix, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.php_class_prefix)
-}
// optional string php_namespace = 41;
inline bool FileOptions::_internal_has_php_namespace() const {
@@ -11604,25 +10870,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_namespace)
}
-inline std::string* FileOptions::unsafe_arena_release_php_namespace() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.php_namespace)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000080u;
- return php_namespace_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void FileOptions::unsafe_arena_set_allocated_php_namespace(
- std::string* php_namespace) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (php_namespace != nullptr) {
- _has_bits_[0] |= 0x00000080u;
- } else {
- _has_bits_[0] &= ~0x00000080u;
- }
- php_namespace_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- php_namespace, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.php_namespace)
-}
// optional string php_metadata_namespace = 44;
inline bool FileOptions::_internal_has_php_metadata_namespace() const {
@@ -11697,25 +10944,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_metadata_namespace)
}
-inline std::string* FileOptions::unsafe_arena_release_php_metadata_namespace() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.php_metadata_namespace)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000100u;
- return php_metadata_namespace_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void FileOptions::unsafe_arena_set_allocated_php_metadata_namespace(
- std::string* php_metadata_namespace) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (php_metadata_namespace != nullptr) {
- _has_bits_[0] |= 0x00000100u;
- } else {
- _has_bits_[0] &= ~0x00000100u;
- }
- php_metadata_namespace_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- php_metadata_namespace, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.php_metadata_namespace)
-}
// optional string ruby_package = 45;
inline bool FileOptions::_internal_has_ruby_package() const {
@@ -11790,25 +11018,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.ruby_package)
}
-inline std::string* FileOptions::unsafe_arena_release_ruby_package() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.FileOptions.ruby_package)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000200u;
- return ruby_package_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void FileOptions::unsafe_arena_set_allocated_ruby_package(
- std::string* ruby_package) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (ruby_package != nullptr) {
- _has_bits_[0] |= 0x00000200u;
- } else {
- _has_bits_[0] &= ~0x00000200u;
- }
- ruby_package_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- ruby_package, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.FileOptions.ruby_package)
-}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
inline int FileOptions::_internal_uninterpreted_option_size() const {
@@ -12678,25 +11887,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.NamePart.name_part)
}
-inline std::string* UninterpretedOption_NamePart::unsafe_arena_release_name_part() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.UninterpretedOption.NamePart.name_part)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000001u;
- return name_part_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void UninterpretedOption_NamePart::unsafe_arena_set_allocated_name_part(
- std::string* name_part) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (name_part != nullptr) {
- _has_bits_[0] |= 0x00000001u;
- } else {
- _has_bits_[0] &= ~0x00000001u;
- }
- name_part_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- name_part, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.UninterpretedOption.NamePart.name_part)
-}
// required bool is_extension = 2;
inline bool UninterpretedOption_NamePart::_internal_has_is_extension() const {
@@ -12842,25 +12032,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.identifier_value)
}
-inline std::string* UninterpretedOption::unsafe_arena_release_identifier_value() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.UninterpretedOption.identifier_value)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000001u;
- return identifier_value_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void UninterpretedOption::unsafe_arena_set_allocated_identifier_value(
- std::string* identifier_value) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (identifier_value != nullptr) {
- _has_bits_[0] |= 0x00000001u;
- } else {
- _has_bits_[0] &= ~0x00000001u;
- }
- identifier_value_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- identifier_value, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.UninterpretedOption.identifier_value)
-}
// optional uint64 positive_int_value = 4;
inline bool UninterpretedOption::_internal_has_positive_int_value() const {
@@ -13019,25 +12190,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.string_value)
}
-inline std::string* UninterpretedOption::unsafe_arena_release_string_value() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.UninterpretedOption.string_value)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000002u;
- return string_value_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void UninterpretedOption::unsafe_arena_set_allocated_string_value(
- std::string* string_value) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (string_value != nullptr) {
- _has_bits_[0] |= 0x00000002u;
- } else {
- _has_bits_[0] &= ~0x00000002u;
- }
- string_value_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- string_value, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.UninterpretedOption.string_value)
-}
// optional string aggregate_value = 8;
inline bool UninterpretedOption::_internal_has_aggregate_value() const {
@@ -13112,25 +12264,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.aggregate_value)
}
-inline std::string* UninterpretedOption::unsafe_arena_release_aggregate_value() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.UninterpretedOption.aggregate_value)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000004u;
- return aggregate_value_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void UninterpretedOption::unsafe_arena_set_allocated_aggregate_value(
- std::string* aggregate_value) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (aggregate_value != nullptr) {
- _has_bits_[0] |= 0x00000004u;
- } else {
- _has_bits_[0] &= ~0x00000004u;
- }
- aggregate_value_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- aggregate_value, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.UninterpretedOption.aggregate_value)
-}
// -------------------------------------------------------------------
@@ -13303,25 +12436,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceCodeInfo.Location.leading_comments)
}
-inline std::string* SourceCodeInfo_Location::unsafe_arena_release_leading_comments() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.SourceCodeInfo.Location.leading_comments)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000001u;
- return leading_comments_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void SourceCodeInfo_Location::unsafe_arena_set_allocated_leading_comments(
- std::string* leading_comments) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (leading_comments != nullptr) {
- _has_bits_[0] |= 0x00000001u;
- } else {
- _has_bits_[0] &= ~0x00000001u;
- }
- leading_comments_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- leading_comments, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.SourceCodeInfo.Location.leading_comments)
-}
// optional string trailing_comments = 4;
inline bool SourceCodeInfo_Location::_internal_has_trailing_comments() const {
@@ -13396,25 +12510,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceCodeInfo.Location.trailing_comments)
}
-inline std::string* SourceCodeInfo_Location::unsafe_arena_release_trailing_comments() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.SourceCodeInfo.Location.trailing_comments)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000002u;
- return trailing_comments_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void SourceCodeInfo_Location::unsafe_arena_set_allocated_trailing_comments(
- std::string* trailing_comments) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (trailing_comments != nullptr) {
- _has_bits_[0] |= 0x00000002u;
- } else {
- _has_bits_[0] &= ~0x00000002u;
- }
- trailing_comments_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- trailing_comments, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.SourceCodeInfo.Location.trailing_comments)
-}
// repeated string leading_detached_comments = 6;
inline int SourceCodeInfo_Location::_internal_leading_detached_comments_size() const {
@@ -13657,25 +12752,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
}
-inline std::string* GeneratedCodeInfo_Annotation::unsafe_arena_release_source_file() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
- GOOGLE_DCHECK(GetArena() != nullptr);
- _has_bits_[0] &= ~0x00000001u;
- return source_file_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void GeneratedCodeInfo_Annotation::unsafe_arena_set_allocated_source_file(
- std::string* source_file) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (source_file != nullptr) {
- _has_bits_[0] |= 0x00000001u;
- } else {
- _has_bits_[0] &= ~0x00000001u;
- }
- source_file_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- source_file, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
-}
// optional int32 begin = 3;
inline bool GeneratedCodeInfo_Annotation::_internal_has_begin() const {
diff --git a/src/google/protobuf/descriptor_database.cc b/src/google/protobuf/descriptor_database.cc
index dbe1dc1..a332dab 100644
--- a/src/google/protobuf/descriptor_database.cc
+++ b/src/google/protobuf/descriptor_database.cc
@@ -390,8 +390,6 @@
// -------------------------------------------------------------------
class EncodedDescriptorDatabase::DescriptorIndex {
- using String = std::string;
-
public:
using Value = std::pair<const void*, int>;
// Helpers to recursively add particular descriptors and all their contents
@@ -410,15 +408,13 @@
private:
friend class EncodedDescriptorDatabase;
- bool AddSymbol(StringPiece package, StringPiece symbol,
- Value value);
+ bool AddSymbol(StringPiece symbol);
template <typename DescProto>
bool AddNestedExtensions(StringPiece filename,
- const DescProto& message_type, Value value);
+ const DescProto& message_type);
template <typename FieldProto>
- bool AddExtension(StringPiece filename, const FieldProto& field,
- Value value);
+ bool AddExtension(StringPiece filename, const FieldProto& field);
// All the maps below have two representations:
// - a std::set<> where we insert initially.
@@ -429,47 +425,80 @@
void EnsureFlat();
+ using String = std::string;
+
+ String EncodeString(StringPiece str) const { return String(str); }
+ StringPiece DecodeString(const String& str, int) const { return str; }
+
+ struct EncodedEntry {
+ // Do not use `Value` here to avoid the padding of that object.
+ const void* data;
+ int size;
+ // Keep the package here instead of each SymbolEntry to save space.
+ String encoded_package;
+
+ Value value() const { return {data, size}; }
+ };
+ std::vector<EncodedEntry> all_values_;
+
struct FileEntry {
- String name;
- Value data;
+ int data_offset;
+ String encoded_name;
+
+ StringPiece name(const DescriptorIndex& index) const {
+ return index.DecodeString(encoded_name, data_offset);
+ }
};
struct FileCompare {
+ const DescriptorIndex& index;
+
bool operator()(const FileEntry& a, const FileEntry& b) const {
- return a.name < b.name;
+ return a.name(index) < b.name(index);
}
bool operator()(const FileEntry& a, StringPiece b) const {
- return a.name < b;
+ return a.name(index) < b;
}
bool operator()(StringPiece a, const FileEntry& b) const {
- return a < b.name;
+ return a < b.name(index);
}
};
- std::set<FileEntry, FileCompare> by_name_;
+ std::set<FileEntry, FileCompare> by_name_{FileCompare{*this}};
std::vector<FileEntry> by_name_flat_;
struct SymbolEntry {
- String package;
- String symbol;
- Value data;
+ int data_offset;
+ String encoded_symbol;
- std::string AsString() const {
- return StrCat(package, package.empty() ? "" : ".", symbol);
+ StringPiece package(const DescriptorIndex& index) const {
+ return index.DecodeString(index.all_values_[data_offset].encoded_package,
+ data_offset);
+ }
+ StringPiece symbol(const DescriptorIndex& index) const {
+ return index.DecodeString(encoded_symbol, data_offset);
+ }
+
+ std::string AsString(const DescriptorIndex& index) const {
+ auto p = package(index);
+ return StrCat(p, p.empty() ? "" : ".", symbol(index));
}
};
struct SymbolCompare {
- static std::string AsString(const SymbolEntry& entry) {
- return entry.AsString();
+ const DescriptorIndex& index;
+
+ std::string AsString(const SymbolEntry& entry) const {
+ return entry.AsString(index);
}
static StringPiece AsString(StringPiece str) { return str; }
- static std::pair<StringPiece, StringPiece> GetParts(
- const SymbolEntry& entry) {
- if (entry.package.empty()) return {entry.symbol, StringPiece{}};
- return {entry.package, entry.symbol};
+ std::pair<StringPiece, StringPiece> GetParts(
+ const SymbolEntry& entry) const {
+ auto package = entry.package(index);
+ if (package.empty()) return {entry.symbol(index), StringPiece{}};
+ return {package, entry.symbol(index)};
}
- static std::pair<StringPiece, StringPiece> GetParts(
- StringPiece str) {
+ std::pair<StringPiece, StringPiece> GetParts(
+ StringPiece str) const {
return {str, {}};
}
@@ -490,29 +519,35 @@
return AsString(lhs) < AsString(rhs);
}
};
- std::set<SymbolEntry, SymbolCompare> by_symbol_;
+ std::set<SymbolEntry, SymbolCompare> by_symbol_{SymbolCompare{*this}};
std::vector<SymbolEntry> by_symbol_flat_;
struct ExtensionEntry {
- String extendee;
+ int data_offset;
+ String encoded_extendee;
+ StringPiece extendee(const DescriptorIndex& index) const {
+ return index.DecodeString(encoded_extendee, data_offset).substr(1);
+ }
int extension_number;
- Value data;
};
struct ExtensionCompare {
+ const DescriptorIndex& index;
+
bool operator()(const ExtensionEntry& a, const ExtensionEntry& b) const {
- return std::tie(a.extendee, a.extension_number) <
- std::tie(b.extendee, b.extension_number);
+ return std::make_tuple(a.extendee(index), a.extension_number) <
+ std::make_tuple(b.extendee(index), b.extension_number);
}
bool operator()(const ExtensionEntry& a,
std::tuple<StringPiece, int> b) const {
- return std::tie(a.extendee, a.extension_number) < b;
+ return std::make_tuple(a.extendee(index), a.extension_number) < b;
}
bool operator()(std::tuple<StringPiece, int> a,
const ExtensionEntry& b) const {
- return a < std::tie(b.extendee, b.extension_number);
+ return a < std::make_tuple(b.extendee(index), b.extension_number);
}
};
- std::set<ExtensionEntry, ExtensionCompare> by_extension_;
+ std::set<ExtensionEntry, ExtensionCompare> by_extension_{
+ ExtensionCompare{*this}};
std::vector<ExtensionEntry> by_extension_flat_;
};
@@ -591,40 +626,51 @@
template <typename FileProto>
bool EncodedDescriptorDatabase::DescriptorIndex::AddFile(const FileProto& file,
Value value) {
- if (!InsertIfNotPresent(&by_name_, FileEntry{file.name(), value}) ||
+ // We push `value` into the array first. This is important because the AddXXX
+ // functions below will expect it to be there.
+ all_values_.push_back({value.first, value.second});
+
+ if (!ValidateSymbolName(file.package())) {
+ GOOGLE_LOG(ERROR) << "Invalid package name: " << file.package();
+ return false;
+ }
+ all_values_.back().encoded_package = EncodeString(file.package());
+
+ if (!InsertIfNotPresent(
+ &by_name_, FileEntry{static_cast<int>(all_values_.size() - 1),
+ EncodeString(file.name())}) ||
std::binary_search(by_name_flat_.begin(), by_name_flat_.end(),
file.name(), by_name_.key_comp())) {
GOOGLE_LOG(ERROR) << "File already exists in database: " << file.name();
return false;
}
- StringPiece package = file.package();
for (const auto& message_type : file.message_type()) {
- if (!AddSymbol(package, message_type.name(), value)) return false;
- if (!AddNestedExtensions(file.name(), message_type, value)) return false;
+ if (!AddSymbol(message_type.name())) return false;
+ if (!AddNestedExtensions(file.name(), message_type)) return false;
}
for (const auto& enum_type : file.enum_type()) {
- if (!AddSymbol(package, enum_type.name(), value)) return false;
+ if (!AddSymbol(enum_type.name())) return false;
}
for (const auto& extension : file.extension()) {
- if (!AddSymbol(package, extension.name(), value)) return false;
- if (!AddExtension(file.name(), extension, value)) return false;
+ if (!AddSymbol(extension.name())) return false;
+ if (!AddExtension(file.name(), extension)) return false;
}
for (const auto& service : file.service()) {
- if (!AddSymbol(package, service.name(), value)) return false;
+ if (!AddSymbol(service.name())) return false;
}
return true;
}
-template <typename Iter, typename Iter2>
+template <typename Iter, typename Iter2, typename Index>
static bool CheckForMutualSubsymbols(StringPiece symbol_name, Iter* iter,
- Iter2 end) {
+ Iter2 end, const Index& index) {
if (*iter != end) {
- if (IsSubSymbol((*iter)->AsString(), symbol_name)) {
+ if (IsSubSymbol((*iter)->AsString(index), symbol_name)) {
GOOGLE_LOG(ERROR) << "Symbol name \"" << symbol_name
<< "\" conflicts with the existing symbol \""
- << (*iter)->AsString() << "\".";
+ << (*iter)->AsString(index) << "\".";
return false;
}
@@ -635,10 +681,10 @@
// to increment it.
++*iter;
- if (*iter != end && IsSubSymbol(symbol_name, (*iter)->AsString())) {
+ if (*iter != end && IsSubSymbol(symbol_name, (*iter)->AsString(index))) {
GOOGLE_LOG(ERROR) << "Symbol name \"" << symbol_name
<< "\" conflicts with the existing symbol \""
- << (*iter)->AsString() << "\".";
+ << (*iter)->AsString(index) << "\".";
return false;
}
}
@@ -646,22 +692,24 @@
}
bool EncodedDescriptorDatabase::DescriptorIndex::AddSymbol(
- StringPiece package, StringPiece symbol, Value value) {
- SymbolEntry entry = {String(package), String(symbol), value};
- std::string entry_as_string = entry.AsString();
+ StringPiece symbol) {
+ SymbolEntry entry = {static_cast<int>(all_values_.size() - 1),
+ EncodeString(symbol)};
+ std::string entry_as_string = entry.AsString(*this);
// We need to make sure not to violate our map invariant.
// If the symbol name is invalid it could break our lookup algorithm (which
// relies on the fact that '.' sorts before all other characters that are
// valid in symbol names).
- if (!ValidateSymbolName(package) || !ValidateSymbolName(symbol)) {
+ if (!ValidateSymbolName(symbol)) {
GOOGLE_LOG(ERROR) << "Invalid symbol name: " << entry_as_string;
return false;
}
auto iter = FindLastLessOrEqual(&by_symbol_, entry);
- if (!CheckForMutualSubsymbols(entry_as_string, &iter, by_symbol_.end())) {
+ if (!CheckForMutualSubsymbols(entry_as_string, &iter, by_symbol_.end(),
+ *this)) {
return false;
}
@@ -669,7 +717,7 @@
auto flat_iter =
FindLastLessOrEqual(&by_symbol_flat_, entry, by_symbol_.key_comp());
if (!CheckForMutualSubsymbols(entry_as_string, &flat_iter,
- by_symbol_flat_.end())) {
+ by_symbol_flat_.end(), *this)) {
return false;
}
@@ -684,25 +732,26 @@
template <typename DescProto>
bool EncodedDescriptorDatabase::DescriptorIndex::AddNestedExtensions(
- StringPiece filename, const DescProto& message_type, Value value) {
+ StringPiece filename, const DescProto& message_type) {
for (const auto& nested_type : message_type.nested_type()) {
- if (!AddNestedExtensions(filename, nested_type, value)) return false;
+ if (!AddNestedExtensions(filename, nested_type)) return false;
}
for (const auto& extension : message_type.extension()) {
- if (!AddExtension(filename, extension, value)) return false;
+ if (!AddExtension(filename, extension)) return false;
}
return true;
}
template <typename FieldProto>
bool EncodedDescriptorDatabase::DescriptorIndex::AddExtension(
- StringPiece filename, const FieldProto& field, Value value) {
+ StringPiece filename, const FieldProto& field) {
if (!field.extendee().empty() && field.extendee()[0] == '.') {
// The extension is fully-qualified. We can use it as a lookup key in
// the by_symbol_ table.
- if (!InsertIfNotPresent(&by_extension_,
- ExtensionEntry{field.extendee().substr(1),
- field.number(), value}) ||
+ if (!InsertIfNotPresent(
+ &by_extension_,
+ ExtensionEntry{static_cast<int>(all_values_.size() - 1),
+ EncodeString(field.extendee()), field.number()}) ||
std::binary_search(
by_extension_flat_.begin(), by_extension_flat_.end(),
std::make_pair(field.extendee().substr(1), field.number()),
@@ -733,8 +782,9 @@
auto iter =
FindLastLessOrEqual(&by_symbol_flat_, name, by_symbol_.key_comp());
- return iter != by_symbol_flat_.end() && IsSubSymbol(iter->AsString(), name)
- ? iter->data
+ return iter != by_symbol_flat_.end() &&
+ IsSubSymbol(iter->AsString(*this), name)
+ ? all_values_[iter->data_offset].value()
: Value();
}
@@ -746,10 +796,11 @@
auto it = std::lower_bound(
by_extension_flat_.begin(), by_extension_flat_.end(),
std::make_tuple(containing_type, field_number), by_extension_.key_comp());
- return it == by_extension_flat_.end() || it->extendee != containing_type ||
+ return it == by_extension_flat_.end() ||
+ it->extendee(*this) != containing_type ||
it->extension_number != field_number
? std::make_pair(nullptr, 0)
- : it->data;
+ : all_values_[it->data_offset].value();
}
template <typename T, typename Less>
@@ -763,6 +814,7 @@
}
void EncodedDescriptorDatabase::DescriptorIndex::EnsureFlat() {
+ all_values_.shrink_to_fit();
// Merge each of the sets into their flat counterpart.
MergeIntoFlat(&by_name_, &by_name_flat_);
MergeIntoFlat(&by_symbol_, &by_symbol_flat_);
@@ -777,7 +829,8 @@
auto it = std::lower_bound(
by_extension_flat_.begin(), by_extension_flat_.end(),
std::make_tuple(containing_type, 0), by_extension_.key_comp());
- for (; it != by_extension_flat_.end() && it->extendee == containing_type;
+ for (;
+ it != by_extension_flat_.end() && it->extendee(*this) == containing_type;
++it) {
output->push_back(it->extension_number);
success = true;
@@ -791,11 +844,11 @@
output->resize(by_name_.size() + by_name_flat_.size());
int i = 0;
for (const auto& entry : by_name_) {
- (*output)[i] = std::string(entry.name);
+ (*output)[i] = std::string(entry.name(*this));
i++;
}
for (const auto& entry : by_name_flat_) {
- (*output)[i] = std::string(entry.name);
+ (*output)[i] = std::string(entry.name(*this));
i++;
}
}
@@ -807,9 +860,9 @@
auto it = std::lower_bound(by_name_flat_.begin(), by_name_flat_.end(),
filename, by_name_.key_comp());
- return it == by_name_flat_.end() || it->name != filename
+ return it == by_name_flat_.end() || it->name(*this) != filename
? std::make_pair(nullptr, 0)
- : it->data;
+ : all_values_[it->data_offset].value();
}
diff --git a/src/google/protobuf/generated_enum_reflection.h b/src/google/protobuf/generated_enum_reflection.h
index 989b5a8..5debc0a 100644
--- a/src/google/protobuf/generated_enum_reflection.h
+++ b/src/google/protobuf/generated_enum_reflection.h
@@ -72,10 +72,10 @@
// an enum name of the given type, returning true and filling in value on
// success, or returning false and leaving value unchanged on failure.
PROTOBUF_EXPORT bool ParseNamedEnum(const EnumDescriptor* descriptor,
- StringPiece name, int* value);
+ ConstStringParam name, int* value);
template <typename EnumType>
-bool ParseNamedEnum(const EnumDescriptor* descriptor, StringPiece name,
+bool ParseNamedEnum(const EnumDescriptor* descriptor, ConstStringParam name,
EnumType* value) {
int tmp;
if (!ParseNamedEnum(descriptor, name, &tmp)) return false;
diff --git a/src/google/protobuf/generated_message_reflection.cc b/src/google/protobuf/generated_message_reflection.cc
index be1e740..5483eda 100644
--- a/src/google/protobuf/generated_message_reflection.cc
+++ b/src/google/protobuf/generated_message_reflection.cc
@@ -82,7 +82,7 @@
namespace internal {
-bool ParseNamedEnum(const EnumDescriptor* descriptor, StringPiece name,
+bool ParseNamedEnum(const EnumDescriptor* descriptor, ConstStringParam name,
int* value) {
const EnumValueDescriptor* d = descriptor->FindValueByName(name);
if (d == nullptr) return false;
diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h
index 786fcf9..a1722db 100644
--- a/src/google/protobuf/map.h
+++ b/src/google/protobuf/map.h
@@ -343,8 +343,8 @@
}
~Map() {
- clear();
if (arena_ == nullptr) {
+ clear();
delete elements_;
}
}
@@ -1218,7 +1218,7 @@
first = erase(first);
}
}
- void clear() { erase(begin(), end()); }
+ void clear() { elements_->clear(); }
// Assign
Map& operator=(const Map& other) {
diff --git a/src/google/protobuf/message.cc b/src/google/protobuf/message.cc
index d35dfff..cfea396 100644
--- a/src/google/protobuf/message.cc
+++ b/src/google/protobuf/message.cc
@@ -171,7 +171,7 @@
#define HASH_MAP std::unordered_map
-#define HASH_FXN hash
+#define STR_HASH_FXN hash<const char*>
class GeneratedMessageFactory : public MessageFactory {
@@ -186,8 +186,8 @@
private:
// Only written at static init time, so does not require locking.
- HASH_MAP<const char*, const google::protobuf::internal::DescriptorTable*,
- HASH_FXN<const char*>, streq>
+ HASH_MAP<const char*, const google::protobuf::internal::DescriptorTable*, STR_HASH_FXN,
+ streq>
file_map_;
internal::WrappedMutex mutex_;
diff --git a/src/google/protobuf/parse_context.h b/src/google/protobuf/parse_context.h
index c0427bc..c5e3fda 100644
--- a/src/google/protobuf/parse_context.h
+++ b/src/google/protobuf/parse_context.h
@@ -744,11 +744,9 @@
void* object, const char* ptr, ParseContext* ctx);
template <typename T>
-PROTOBUF_EXPORT_TEMPLATE_DEFINE
-PROTOBUF_MUST_USE_RESULT const
- char* PackedEnumParser(void* object, const char* ptr, ParseContext* ctx,
- bool (*is_valid)(int), InternalMetadata* metadata,
- int field_num) {
+PROTOBUF_MUST_USE_RESULT const char* PackedEnumParser(
+ void* object, const char* ptr, ParseContext* ctx, bool (*is_valid)(int),
+ InternalMetadata* metadata, int field_num) {
return ctx->ReadPackedVarint(
ptr, [object, is_valid, metadata, field_num](uint64 val) {
if (is_valid(val)) {
@@ -760,12 +758,10 @@
}
template <typename T>
-PROTOBUF_EXPORT_TEMPLATE_DEFINE
-PROTOBUF_MUST_USE_RESULT const
- char* PackedEnumParserArg(void* object, const char* ptr, ParseContext* ctx,
- bool (*is_valid)(const void*, int),
- const void* data, InternalMetadata* metadata,
- int field_num) {
+PROTOBUF_MUST_USE_RESULT const char* PackedEnumParserArg(
+ void* object, const char* ptr, ParseContext* ctx,
+ bool (*is_valid)(const void*, int), const void* data,
+ InternalMetadata* metadata, int field_num) {
return ctx->ReadPackedVarint(
ptr, [object, is_valid, data, metadata, field_num](uint64 val) {
if (is_valid(data, val)) {
diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc
index 786ff4e..c92a3d5 100644
--- a/src/google/protobuf/port_def.inc
+++ b/src/google/protobuf/port_def.inc
@@ -358,40 +358,40 @@
#if defined(PROTOBUF_USE_DLLS)
#if defined(_MSC_VER)
#ifdef LIBPROTOBUF_EXPORTS
- #define PROTOBUF_EXPORT __declspec(dllexport)
- #define PROTOBUF_EXPORT_TEMPLATE_DECLARE
- #define PROTOBUF_EXPORT_TEMPLATE_DEFINE __declspec(dllexport)
- #else
- #define PROTOBUF_EXPORT __declspec(dllimport)
- #define PROTOBUF_EXPORT_TEMPLATE_DECLARE
- #define PROTOBUF_EXPORT_TEMPLATE_DEFINE __declspec(dllimport)
- #endif
- #ifdef LIBPROTOC_EXPORTS
- #define PROTOC_EXPORT __declspec(dllexport)
- #else
- #define PROTOC_EXPORT __declspec(dllimport)
- #endif
- #else // defined(_MSC_VER)
- #ifdef LIBPROTOBUF_EXPORTS
- #define PROTOBUF_EXPORT __attribute__((visibility("default")))
- #define PROTOBUF_EXPORT_TEMPLATE_DECLARE __attribute__((visibility("default")))
- #define PROTOBUF_EXPORT_TEMPLATE_DEFINE
- #else
- #define PROTOBUF_EXPORT
- #define PROTOBUF_EXPORT_TEMPLATE_DECLARE
- #define PROTOBUF_EXPORT_TEMPLATE_DEFINE
- #endif
- #ifdef LIBPROTOC_EXPORTS
- #define PROTOC_EXPORT __attribute__((visibility("default")))
- #else
- #define PROTOC_EXPORT
- #endif
- #endif
+#define PROTOBUF_EXPORT __declspec(dllexport)
+#define PROTOBUF_EXPORT_TEMPLATE_DECLARE
+#define PROTOBUF_EXPORT_TEMPLATE_DEFINE __declspec(dllexport)
+#else
+#define PROTOBUF_EXPORT __declspec(dllimport)
+#define PROTOBUF_EXPORT_TEMPLATE_DECLARE
+#define PROTOBUF_EXPORT_TEMPLATE_DEFINE __declspec(dllimport)
+#endif
+#ifdef LIBPROTOC_EXPORTS
+#define PROTOC_EXPORT __declspec(dllexport)
+#else
+#define PROTOC_EXPORT __declspec(dllimport)
+#endif
+#else // defined(_MSC_VER)
+#ifdef LIBPROTOBUF_EXPORTS
+#define PROTOBUF_EXPORT __attribute__((visibility("default")))
+#define PROTOBUF_EXPORT_TEMPLATE_DECLARE __attribute__((visibility("default")))
+#define PROTOBUF_EXPORT_TEMPLATE_DEFINE
+#else
+#define PROTOBUF_EXPORT
+#define PROTOBUF_EXPORT_TEMPLATE_DECLARE
+#define PROTOBUF_EXPORT_TEMPLATE_DEFINE
+#endif
+#ifdef LIBPROTOC_EXPORTS
+#define PROTOC_EXPORT __attribute__((visibility("default")))
+#else
+#define PROTOC_EXPORT
+#endif
+#endif
#else // defined(PROTOBUF_USE_DLLS)
#define PROTOBUF_EXPORT
#define PROTOC_EXPORT
- #define PROTOBUF_EXPORT_TEMPLATE_DECLARE
- #define PROTOBUF_EXPORT_TEMPLATE_DEFINE
+#define PROTOBUF_EXPORT_TEMPLATE_DECLARE
+#define PROTOBUF_EXPORT_TEMPLATE_DEFINE
#endif
// Windows declares several inconvenient macro names. We #undef them and then
@@ -521,4 +521,6 @@
// ownership of arena. However, we cannot do that for nested messages. In order
// to tell how many usages of nested messages affected by message owned arena,
// we need to simulate the arena ownership.
-#define PROTOBUF_MESSAGE_OWNED_ARENA_EXPERIMENT
+// This experiment is purely for the purpose of gathering data. All code guarded
+// by this flag is supposed to be removed after this experiment.
+// #define PROTOBUF_MESSAGE_OWNED_ARENA_EXPERIMENT
diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h
index 4e9cb3a..c0326de 100644
--- a/src/google/protobuf/source_context.pb.h
+++ b/src/google/protobuf/source_context.pb.h
@@ -191,15 +191,6 @@
std::string* mutable_file_name();
std::string* release_file_name();
void set_allocated_file_name(std::string* file_name);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_file_name();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_file_name(
- std::string* file_name);
private:
const std::string& _internal_file_name() const;
void _internal_set_file_name(const std::string& value);
@@ -289,25 +280,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceContext.file_name)
}
-inline std::string* SourceContext::unsafe_arena_release_file_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.SourceContext.file_name)
- GOOGLE_DCHECK(GetArena() != nullptr);
-
- return file_name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void SourceContext::unsafe_arena_set_allocated_file_name(
- std::string* file_name) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (file_name != nullptr) {
-
- } else {
-
- }
- file_name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- file_name, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.SourceContext.file_name)
-}
#ifdef __GNUC__
#pragma GCC diagnostic pop
diff --git a/src/google/protobuf/struct.pb.h b/src/google/protobuf/struct.pb.h
index 6fe41f2..c0fdf90 100644
--- a/src/google/protobuf/struct.pb.h
+++ b/src/google/protobuf/struct.pb.h
@@ -456,15 +456,6 @@
std::string* mutable_string_value();
std::string* release_string_value();
void set_allocated_string_value(std::string* string_value);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_string_value();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_string_value(
- std::string* string_value);
private:
const std::string& _internal_string_value() const;
void _internal_set_string_value(const std::string& value);
@@ -918,29 +909,6 @@
}
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.string_value)
}
-inline std::string* Value::unsafe_arena_release_string_value() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Value.string_value)
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (_internal_has_string_value()) {
- clear_has_kind();
- return kind_.string_value_.UnsafeArenaRelease(
- &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- } else {
- return nullptr;
- }
-}
-inline void Value::unsafe_arena_set_allocated_string_value(std::string* string_value) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (!_internal_has_string_value()) {
- kind_.string_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
- }
- clear_kind();
- if (string_value) {
- set_has_string_value();
- kind_.string_value_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), string_value, GetArena());
- }
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Value.string_value)
-}
// bool bool_value = 4;
inline bool Value::_internal_has_bool_value() const {
diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h
index 0fd679a..ca99dfd 100644
--- a/src/google/protobuf/stubs/common.h
+++ b/src/google/protobuf/stubs/common.h
@@ -43,9 +43,10 @@
#include <string>
#include <vector>
-#include <google/protobuf/stubs/port.h>
#include <google/protobuf/stubs/macros.h>
#include <google/protobuf/stubs/platform_macros.h>
+#include <google/protobuf/stubs/port.h>
+#include <google/protobuf/stubs/stringpiece.h>
#ifndef PROTOBUF_USE_EXCEPTIONS
#if defined(_MSC_VER) && defined(_CPPUNWIND)
@@ -129,12 +130,12 @@
// structurally_valid.cc.
PROTOBUF_EXPORT bool IsStructurallyValidUTF8(const char* buf, int len);
-inline bool IsStructurallyValidUTF8(const std::string& str) {
+inline bool IsStructurallyValidUTF8(StringPiece str) {
return IsStructurallyValidUTF8(str.data(), static_cast<int>(str.length()));
}
// Returns initial number of bytes of structurally valid UTF-8.
-PROTOBUF_EXPORT int UTF8SpnStructurallyValid(const StringPiece& str);
+PROTOBUF_EXPORT int UTF8SpnStructurallyValid(StringPiece str);
// Coerce UTF-8 byte string in src_str to be
// a structurally-valid equal-length string by selectively
@@ -148,8 +149,7 @@
//
// Optimized for: all structurally valid and no byte copying is done.
//
-PROTOBUF_EXPORT char* UTF8CoerceToStructurallyValid(const StringPiece& str,
- char* dst,
+PROTOBUF_EXPORT char* UTF8CoerceToStructurallyValid(StringPiece str, char* dst,
char replace_char);
} // namespace internal
diff --git a/src/google/protobuf/stubs/hash.h b/src/google/protobuf/stubs/hash.h
index a093b40..e2d2392 100644
--- a/src/google/protobuf/stubs/hash.h
+++ b/src/google/protobuf/stubs/hash.h
@@ -33,9 +33,8 @@
#ifndef GOOGLE_PROTOBUF_STUBS_HASH_H__
#define GOOGLE_PROTOBUF_STUBS_HASH_H__
-#include <string.h>
-#include <google/protobuf/stubs/common.h>
-
+#include <cstring>
+#include <string>
#include <unordered_map>
#include <unordered_set>
@@ -78,14 +77,14 @@
};
template <>
-struct hash<string> {
- inline size_t operator()(const string& key) const {
+struct hash<std::string> {
+ inline size_t operator()(const std::string& key) const {
return hash<const char*>()(key.c_str());
}
static const size_t bucket_size = 4;
static const size_t min_buckets = 8;
- inline bool operator()(const string& a, const string& b) const {
+ inline bool operator()(const std::string& a, const std::string& b) const {
return a < b;
}
};
diff --git a/src/google/protobuf/stubs/stringpiece.cc b/src/google/protobuf/stubs/stringpiece.cc
index fc2f521..353c78c 100644
--- a/src/google/protobuf/stubs/stringpiece.cc
+++ b/src/google/protobuf/stubs/stringpiece.cc
@@ -64,11 +64,11 @@
GOOGLE_DCHECK_GE(len, 0);
}
-void StringPiece::CopyToString(string* target) const {
+void StringPiece::CopyToString(std::string* target) const {
target->assign(ptr_, length_);
}
-void StringPiece::AppendToString(string* target) const {
+void StringPiece::AppendToString(std::string* target) const {
target->append(ptr_, length_);
}
diff --git a/src/google/protobuf/stubs/stringpiece.h b/src/google/protobuf/stubs/stringpiece.h
index 2ae3881..fbcb20a 100644
--- a/src/google/protobuf/stubs/stringpiece.h
+++ b/src/google/protobuf/stubs/stringpiece.h
@@ -148,7 +148,6 @@
#include <limits>
#include <string>
-#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/hash.h>
#include <google/protobuf/port_def.inc>
@@ -165,7 +164,7 @@
// is 32 bits in LP32, 64 bits in LP64, 64 bits in LLP64
// future changes intended: http://go/64BitStringPiece
//
-typedef string::difference_type stringpiece_ssize_type;
+typedef std::string::difference_type stringpiece_ssize_type;
// STRINGPIECE_CHECK_SIZE protects us from 32-bit overflows.
// TODO(mec): delete this after stringpiece_ssize_type goes 64 bit.
@@ -302,25 +301,21 @@
return 0;
}
- string as_string() const {
- return ToString();
- }
+ std::string as_string() const { return ToString(); }
// We also define ToString() here, since many other string-like
// interfaces name the routine that converts to a C++ string
// "ToString", and it's confusing to have the method that does that
// for a StringPiece be called "as_string()". We also leave the
// "as_string()" method defined here for existing code.
- string ToString() const {
- if (ptr_ == nullptr) return string();
- return string(data(), static_cast<size_type>(size()));
+ std::string ToString() const {
+ if (ptr_ == nullptr) return "";
+ return std::string(data(), static_cast<size_type>(size()));
}
- operator string() const {
- return ToString();
- }
+ explicit operator std::string() const { return ToString(); }
- void CopyToString(string* target) const;
- void AppendToString(string* target) const;
+ void CopyToString(std::string* target) const;
+ void AppendToString(std::string* target) const;
bool starts_with(StringPiece x) const {
return (length_ >= x.length_) &&
@@ -466,7 +461,7 @@
return std::string(data_, static_cast<size_t>(size_));
}
- operator string() const { return ToString(); }
+ explicit operator std::string() const { return ToString(); }
private:
const char* data_;
diff --git a/src/google/protobuf/stubs/structurally_valid.cc b/src/google/protobuf/stubs/structurally_valid.cc
index 4d424a1..9a476c3 100644
--- a/src/google/protobuf/stubs/structurally_valid.cc
+++ b/src/google/protobuf/stubs/structurally_valid.cc
@@ -561,7 +561,7 @@
return (bytes_consumed == len);
}
-int UTF8SpnStructurallyValid(const StringPiece& str) {
+int UTF8SpnStructurallyValid(StringPiece str) {
if (!module_initialized_) return str.size();
int bytes_consumed = 0;
@@ -582,8 +582,7 @@
//
// Fast case: all is structurally valid and no byte copying is done.
//
-char* UTF8CoerceToStructurallyValid(const StringPiece& src_str,
- char* idst,
+char* UTF8CoerceToStructurallyValid(StringPiece src_str, char* idst,
const char replace_char) {
const char* isrc = src_str.data();
const int len = src_str.length();
diff --git a/src/google/protobuf/stubs/strutil.cc b/src/google/protobuf/stubs/strutil.cc
index 24ae286..2722594 100644
--- a/src/google/protobuf/stubs/strutil.cc
+++ b/src/google/protobuf/stubs/strutil.cc
@@ -176,10 +176,8 @@
// the characters in the string, not the entire string as a single delimiter.
// ----------------------------------------------------------------------
template <typename ITR>
-static inline
-void SplitStringToIteratorUsing(const string& full,
- const char* delim,
- ITR& result) {
+static inline void SplitStringToIteratorUsing(StringPiece full,
+ const char *delim, ITR &result) {
// Optimize the common case where delim is a single character.
if (delim[0] != '\0' && delim[1] == '\0') {
char c = delim[0];
@@ -191,7 +189,7 @@
} else {
const char* start = p;
while (++p != end && *p != c);
- *result++ = string(start, p - start);
+ *result++ = std::string(start, p - start);
}
}
return;
@@ -202,17 +200,17 @@
while (begin_index != string::npos) {
end_index = full.find_first_of(delim, begin_index);
if (end_index == string::npos) {
- *result++ = full.substr(begin_index);
+ *result++ = std::string(full.substr(begin_index));
return;
}
- *result++ = full.substr(begin_index, (end_index - begin_index));
+ *result++ =
+ std::string(full.substr(begin_index, (end_index - begin_index)));
begin_index = full.find_first_not_of(delim, end_index);
}
}
-void SplitStringUsing(const string& full,
- const char* delim,
- std::vector<string>* result) {
+void SplitStringUsing(StringPiece full, const char *delim,
+ std::vector<string> *result) {
std::back_insert_iterator< std::vector<string> > it(*result);
SplitStringToIteratorUsing(full, delim, it);
}
@@ -228,29 +226,28 @@
//
// If "pieces" is negative for some reason, it returns the whole string
// ----------------------------------------------------------------------
-template <typename StringType, typename ITR>
-static inline
-void SplitStringToIteratorAllowEmpty(const StringType& full,
- const char* delim,
- int pieces,
- ITR& result) {
+template <typename ITR>
+static inline void SplitStringToIteratorAllowEmpty(StringPiece full,
+ const char *delim,
+ int pieces, ITR &result) {
string::size_type begin_index, end_index;
begin_index = 0;
for (int i = 0; (i < pieces-1) || (pieces == 0); i++) {
end_index = full.find_first_of(delim, begin_index);
if (end_index == string::npos) {
- *result++ = full.substr(begin_index);
+ *result++ = std::string(full.substr(begin_index));
return;
}
- *result++ = full.substr(begin_index, (end_index - begin_index));
+ *result++ =
+ std::string(full.substr(begin_index, (end_index - begin_index)));
begin_index = end_index + 1;
}
- *result++ = full.substr(begin_index);
+ *result++ = std::string(full.substr(begin_index));
}
-void SplitStringAllowEmpty(const string& full, const char* delim,
- std::vector<string>* result) {
+void SplitStringAllowEmpty(StringPiece full, const char *delim,
+ std::vector<string> *result) {
std::back_insert_iterator<std::vector<string> > it(*result);
SplitStringToIteratorAllowEmpty(full, delim, 0, it);
}
diff --git a/src/google/protobuf/stubs/strutil.h b/src/google/protobuf/stubs/strutil.h
index 981cb6e..c070a05 100644
--- a/src/google/protobuf/stubs/strutil.h
+++ b/src/google/protobuf/stubs/strutil.h
@@ -113,12 +113,6 @@
// prefix string if the prefix matches, otherwise the original
// string.
// ----------------------------------------------------------------------
-inline bool HasPrefixString(const string& str,
- const string& prefix) {
- return str.size() >= prefix.size() &&
- str.compare(0, prefix.size(), prefix) == 0;
-}
-
inline bool HasPrefixString(StringPiece str, StringPiece prefix) {
return str.size() >= prefix.size() &&
memcmp(str.data(), prefix.data(), prefix.size()) == 0;
@@ -140,10 +134,10 @@
// suffix string if the suffix matches, otherwise the original
// string.
// ----------------------------------------------------------------------
-inline bool HasSuffixString(const string& str,
- const string& suffix) {
+inline bool HasSuffixString(StringPiece str, StringPiece suffix) {
return str.size() >= suffix.size() &&
- str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0;
+ memcmp(str.data() + str.size() - suffix.size(), suffix.data(),
+ suffix.size()) == 0;
}
inline string StripSuffixString(const string& str, const string& suffix) {
@@ -219,7 +213,7 @@
// to 'result'. If there are consecutive delimiters, this function skips
// over all of them.
// ----------------------------------------------------------------------
-PROTOBUF_EXPORT void SplitStringUsing(const string& full, const char* delim,
+PROTOBUF_EXPORT void SplitStringUsing(StringPiece full, const char* delim,
std::vector<string>* res);
// Split a string using one or more byte delimiters, presented
@@ -230,16 +224,15 @@
//
// If "full" is the empty string, yields an empty string as the only value.
// ----------------------------------------------------------------------
-PROTOBUF_EXPORT void SplitStringAllowEmpty(const string& full,
- const char* delim,
+PROTOBUF_EXPORT void SplitStringAllowEmpty(StringPiece full, const char* delim,
std::vector<string>* result);
// ----------------------------------------------------------------------
// Split()
// Split a string using a character delimiter.
// ----------------------------------------------------------------------
-inline std::vector<string> Split(
- const string& full, const char* delim, bool skip_empty = true) {
+inline std::vector<string> Split(StringPiece full, const char* delim,
+ bool skip_empty = true) {
std::vector<string> result;
if (skip_empty) {
SplitStringUsing(full, delim, &result);
diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h
index 0d149f7..ea57370 100644
--- a/src/google/protobuf/type.pb.h
+++ b/src/google/protobuf/type.pb.h
@@ -369,15 +369,6 @@
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_name();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- std::string* name);
private:
const std::string& _internal_name() const;
void _internal_set_name(const std::string& value);
@@ -679,15 +670,6 @@
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_name();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- std::string* name);
private:
const std::string& _internal_name() const;
void _internal_set_name(const std::string& value);
@@ -704,15 +686,6 @@
std::string* mutable_type_url();
std::string* release_type_url();
void set_allocated_type_url(std::string* type_url);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_type_url();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_type_url(
- std::string* type_url);
private:
const std::string& _internal_type_url() const;
void _internal_set_type_url(const std::string& value);
@@ -729,15 +702,6 @@
std::string* mutable_json_name();
std::string* release_json_name();
void set_allocated_json_name(std::string* json_name);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_json_name();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_json_name(
- std::string* json_name);
private:
const std::string& _internal_json_name() const;
void _internal_set_json_name(const std::string& value);
@@ -754,15 +718,6 @@
std::string* mutable_default_value();
std::string* release_default_value();
void set_allocated_default_value(std::string* default_value);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_default_value();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_default_value(
- std::string* default_value);
private:
const std::string& _internal_default_value() const;
void _internal_set_default_value(const std::string& value);
@@ -1001,15 +956,6 @@
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_name();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- std::string* name);
private:
const std::string& _internal_name() const;
void _internal_set_name(const std::string& value);
@@ -1205,15 +1151,6 @@
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_name();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- std::string* name);
private:
const std::string& _internal_name() const;
void _internal_set_name(const std::string& value);
@@ -1370,15 +1307,6 @@
std::string* mutable_name();
std::string* release_name();
void set_allocated_name(std::string* name);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_name();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_name(
- std::string* name);
private:
const std::string& _internal_name() const;
void _internal_set_name(const std::string& value);
@@ -1487,25 +1415,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Type.name)
}
-inline std::string* Type::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Type.name)
- GOOGLE_DCHECK(GetArena() != nullptr);
-
- return name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void Type::unsafe_arena_set_allocated_name(
- std::string* name) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (name != nullptr) {
-
- } else {
-
- }
- name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- name, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Type.name)
-}
// repeated .google.protobuf.Field fields = 2;
inline int Type::_internal_fields_size() const {
@@ -1881,25 +1790,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.name)
}
-inline std::string* Field::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.name)
- GOOGLE_DCHECK(GetArena() != nullptr);
-
- return name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void Field::unsafe_arena_set_allocated_name(
- std::string* name) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (name != nullptr) {
-
- } else {
-
- }
- name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- name, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Field.name)
-}
// string type_url = 6;
inline void Field::clear_type_url() {
@@ -1962,25 +1852,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.type_url)
}
-inline std::string* Field::unsafe_arena_release_type_url() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.type_url)
- GOOGLE_DCHECK(GetArena() != nullptr);
-
- return type_url_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void Field::unsafe_arena_set_allocated_type_url(
- std::string* type_url) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (type_url != nullptr) {
-
- } else {
-
- }
- type_url_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- type_url, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Field.type_url)
-}
// int32 oneof_index = 7;
inline void Field::clear_oneof_index() {
@@ -2122,25 +1993,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.json_name)
}
-inline std::string* Field::unsafe_arena_release_json_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.json_name)
- GOOGLE_DCHECK(GetArena() != nullptr);
-
- return json_name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void Field::unsafe_arena_set_allocated_json_name(
- std::string* json_name) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (json_name != nullptr) {
-
- } else {
-
- }
- json_name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- json_name, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Field.json_name)
-}
// string default_value = 11;
inline void Field::clear_default_value() {
@@ -2203,25 +2055,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.default_value)
}
-inline std::string* Field::unsafe_arena_release_default_value() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Field.default_value)
- GOOGLE_DCHECK(GetArena() != nullptr);
-
- return default_value_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void Field::unsafe_arena_set_allocated_default_value(
- std::string* default_value) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (default_value != nullptr) {
-
- } else {
-
- }
- default_value_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- default_value, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Field.default_value)
-}
// -------------------------------------------------------------------
@@ -2288,25 +2121,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Enum.name)
}
-inline std::string* Enum::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Enum.name)
- GOOGLE_DCHECK(GetArena() != nullptr);
-
- return name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void Enum::unsafe_arena_set_allocated_name(
- std::string* name) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (name != nullptr) {
-
- } else {
-
- }
- name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- name, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Enum.name)
-}
// repeated .google.protobuf.EnumValue enumvalue = 2;
inline int Enum::_internal_enumvalue_size() const {
@@ -2548,25 +2362,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValue.name)
}
-inline std::string* EnumValue::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.EnumValue.name)
- GOOGLE_DCHECK(GetArena() != nullptr);
-
- return name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void EnumValue::unsafe_arena_set_allocated_name(
- std::string* name) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (name != nullptr) {
-
- } else {
-
- }
- name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- name, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.EnumValue.name)
-}
// int32 number = 2;
inline void EnumValue::clear_number() {
@@ -2692,25 +2487,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Option.name)
}
-inline std::string* Option::unsafe_arena_release_name() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.Option.name)
- GOOGLE_DCHECK(GetArena() != nullptr);
-
- return name_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void Option::unsafe_arena_set_allocated_name(
- std::string* name) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (name != nullptr) {
-
- } else {
-
- }
- name_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- name, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Option.name)
-}
// .google.protobuf.Any value = 2;
inline bool Option::_internal_has_value() const {
diff --git a/src/google/protobuf/util/field_mask_util.h b/src/google/protobuf/util/field_mask_util.h
index cc2148d..3ca9359 100644
--- a/src/google/protobuf/util/field_mask_util.h
+++ b/src/google/protobuf/util/field_mask_util.h
@@ -106,7 +106,7 @@
template <typename T>
static void AddPathToFieldMask(StringPiece path, FieldMask* mask) {
GOOGLE_CHECK(IsValidPath<T>(path)) << path;
- mask->add_paths(path);
+ mask->add_paths(std::string(path));
}
// Creates a FieldMask with all fields of type T. This FieldMask only
diff --git a/src/google/protobuf/util/internal/expecting_objectwriter.h b/src/google/protobuf/util/internal/expecting_objectwriter.h
index 71ecb1d..2cb7f69 100644
--- a/src/google/protobuf/util/internal/expecting_objectwriter.h
+++ b/src/google/protobuf/util/internal/expecting_objectwriter.h
@@ -60,6 +60,7 @@
namespace util {
namespace converter {
+using testing::Eq;
using testing::IsEmpty;
using testing::NanSensitiveDoubleEq;
using testing::NanSensitiveFloatEq;
@@ -100,7 +101,7 @@
virtual ObjectWriter* StartObject(StringPiece name) {
(name.empty() ? EXPECT_CALL(*mock_, StartObject(IsEmpty()))
- : EXPECT_CALL(*mock_, StartObject(StrEq(std::string(name)))))
+ : EXPECT_CALL(*mock_, StartObject(Eq(std::string(name)))))
.WillOnce(Return(mock_))
.RetiresOnSaturation();
return this;
@@ -115,7 +116,7 @@
virtual ObjectWriter* StartList(StringPiece name) {
(name.empty() ? EXPECT_CALL(*mock_, StartList(IsEmpty()))
- : EXPECT_CALL(*mock_, StartList(StrEq(std::string(name)))))
+ : EXPECT_CALL(*mock_, StartList(Eq(std::string(name)))))
.WillOnce(Return(mock_))
.RetiresOnSaturation();
return this;
@@ -131,8 +132,8 @@
virtual ObjectWriter* RenderBool(StringPiece name, bool value) {
(name.empty()
? EXPECT_CALL(*mock_, RenderBool(IsEmpty(), TypedEq<bool>(value)))
- : EXPECT_CALL(*mock_, RenderBool(StrEq(std::string(name)),
- TypedEq<bool>(value))))
+ : EXPECT_CALL(*mock_,
+ RenderBool(Eq(std::string(name)), TypedEq<bool>(value))))
.WillOnce(Return(mock_))
.RetiresOnSaturation();
return this;
@@ -141,7 +142,7 @@
virtual ObjectWriter* RenderInt32(StringPiece name, int32 value) {
(name.empty()
? EXPECT_CALL(*mock_, RenderInt32(IsEmpty(), TypedEq<int32>(value)))
- : EXPECT_CALL(*mock_, RenderInt32(StrEq(std::string(name)),
+ : EXPECT_CALL(*mock_, RenderInt32(Eq(std::string(name)),
TypedEq<int32>(value))))
.WillOnce(Return(mock_))
.RetiresOnSaturation();
@@ -151,7 +152,7 @@
virtual ObjectWriter* RenderUint32(StringPiece name, uint32 value) {
(name.empty()
? EXPECT_CALL(*mock_, RenderUint32(IsEmpty(), TypedEq<uint32>(value)))
- : EXPECT_CALL(*mock_, RenderUint32(StrEq(std::string(name)),
+ : EXPECT_CALL(*mock_, RenderUint32(Eq(std::string(name)),
TypedEq<uint32>(value))))
.WillOnce(Return(mock_))
.RetiresOnSaturation();
@@ -161,7 +162,7 @@
virtual ObjectWriter* RenderInt64(StringPiece name, int64 value) {
(name.empty()
? EXPECT_CALL(*mock_, RenderInt64(IsEmpty(), TypedEq<int64>(value)))
- : EXPECT_CALL(*mock_, RenderInt64(StrEq(std::string(name)),
+ : EXPECT_CALL(*mock_, RenderInt64(Eq(std::string(name)),
TypedEq<int64>(value))))
.WillOnce(Return(mock_))
.RetiresOnSaturation();
@@ -171,7 +172,7 @@
virtual ObjectWriter* RenderUint64(StringPiece name, uint64 value) {
(name.empty()
? EXPECT_CALL(*mock_, RenderUint64(IsEmpty(), TypedEq<uint64>(value)))
- : EXPECT_CALL(*mock_, RenderUint64(StrEq(std::string(name)),
+ : EXPECT_CALL(*mock_, RenderUint64(Eq(std::string(name)),
TypedEq<uint64>(value))))
.WillOnce(Return(mock_))
.RetiresOnSaturation();
@@ -182,7 +183,7 @@
(name.empty()
? EXPECT_CALL(*mock_,
RenderDouble(IsEmpty(), NanSensitiveDoubleEq(value)))
- : EXPECT_CALL(*mock_, RenderDouble(StrEq(std::string(name)),
+ : EXPECT_CALL(*mock_, RenderDouble(Eq(std::string(name)),
NanSensitiveDoubleEq(value))))
.WillOnce(Return(mock_))
.RetiresOnSaturation();
@@ -193,7 +194,7 @@
(name.empty()
? EXPECT_CALL(*mock_,
RenderFloat(IsEmpty(), NanSensitiveFloatEq(value)))
- : EXPECT_CALL(*mock_, RenderFloat(StrEq(std::string(name)),
+ : EXPECT_CALL(*mock_, RenderFloat(Eq(std::string(name)),
NanSensitiveFloatEq(value))))
.WillOnce(Return(mock_))
.RetiresOnSaturation();
@@ -205,7 +206,7 @@
(name.empty() ? EXPECT_CALL(*mock_, RenderString(IsEmpty(),
TypedEq<StringPiece>(
std::string(value))))
- : EXPECT_CALL(*mock_, RenderString(StrEq(std::string(name)),
+ : EXPECT_CALL(*mock_, RenderString(Eq(std::string(name)),
TypedEq<StringPiece>(
std::string(value)))))
.WillOnce(Return(mock_))
@@ -217,7 +218,7 @@
? EXPECT_CALL(*mock_, RenderBytes(IsEmpty(), TypedEq<StringPiece>(
value.ToString())))
: EXPECT_CALL(*mock_,
- RenderBytes(StrEq(name.ToString()),
+ RenderBytes(Eq(std::string(name)),
TypedEq<StringPiece>(value.ToString()))))
.WillOnce(Return(mock_))
.RetiresOnSaturation();
@@ -226,7 +227,7 @@
virtual ObjectWriter* RenderNull(StringPiece name) {
(name.empty() ? EXPECT_CALL(*mock_, RenderNull(IsEmpty()))
- : EXPECT_CALL(*mock_, RenderNull(StrEq(std::string(name))))
+ : EXPECT_CALL(*mock_, RenderNull(Eq(std::string(name))))
.WillOnce(Return(mock_))
.RetiresOnSaturation());
return this;
diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h
index 5a195bb..d6ee3fc 100644
--- a/src/google/protobuf/wrappers.pb.h
+++ b/src/google/protobuf/wrappers.pb.h
@@ -1182,15 +1182,6 @@
std::string* mutable_value();
std::string* release_value();
void set_allocated_value(std::string* value);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_value();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_value(
- std::string* value);
private:
const std::string& _internal_value() const;
void _internal_set_value(const std::string& value);
@@ -1335,15 +1326,6 @@
std::string* mutable_value();
std::string* release_value();
void set_allocated_value(std::string* value);
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- std::string* unsafe_arena_release_value();
- GOOGLE_PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for"
- " string fields are deprecated and will be removed in a"
- " future release.")
- void unsafe_arena_set_allocated_value(
- std::string* value);
private:
const std::string& _internal_value() const;
void _internal_set_value(const std::string& value);
@@ -1601,25 +1583,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.StringValue.value)
}
-inline std::string* StringValue::unsafe_arena_release_value() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.StringValue.value)
- GOOGLE_DCHECK(GetArena() != nullptr);
-
- return value_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void StringValue::unsafe_arena_set_allocated_value(
- std::string* value) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (value != nullptr) {
-
- } else {
-
- }
- value_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- value, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.StringValue.value)
-}
// -------------------------------------------------------------------
@@ -1686,25 +1649,6 @@
GetArena());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.BytesValue.value)
}
-inline std::string* BytesValue::unsafe_arena_release_value() {
- // @@protoc_insertion_point(field_unsafe_arena_release:google.protobuf.BytesValue.value)
- GOOGLE_DCHECK(GetArena() != nullptr);
-
- return value_.UnsafeArenaRelease(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- GetArena());
-}
-inline void BytesValue::unsafe_arena_set_allocated_value(
- std::string* value) {
- GOOGLE_DCHECK(GetArena() != nullptr);
- if (value != nullptr) {
-
- } else {
-
- }
- value_.UnsafeArenaSetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
- value, GetArena());
- // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.BytesValue.value)
-}
#ifdef __GNUC__
#pragma GCC diagnostic pop