Merge pull request #9525 from dlj-NaN/sync-stage
Integrate from Piper for C++, Java, and Python
This commit is contained in:
commit
763d85293d
@ -87,6 +87,7 @@ Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
|
||||
* Remove GetPointer() and explicit nullptr defaults.
|
||||
* add proto_h flag for speeding up large builds
|
||||
* Add missing overload for reference wrapped fields.
|
||||
* Add MergedDescriptorDatabase::FindAllFileNames()
|
||||
|
||||
|
||||
2022-01-28 version 3.19.4 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
|
||||
|
@ -27,8 +27,8 @@ namespace _pbi = _pb::internal;
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
constexpr Any::Any(
|
||||
::_pbi::ConstantInitialized)
|
||||
: type_url_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, value_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
: type_url_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, value_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, _any_metadata_(&type_url_, &value_){}
|
||||
struct AnyDefaultTypeInternal {
|
||||
constexpr AnyDefaultTypeInternal()
|
||||
|
@ -26,8 +26,8 @@ constexpr Api::Api(
|
||||
: methods_()
|
||||
, options_()
|
||||
, mixins_()
|
||||
, name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, version_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, version_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, source_context_(nullptr)
|
||||
, syntax_(0)
|
||||
{}
|
||||
@ -43,9 +43,9 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORIT
|
||||
constexpr Method::Method(
|
||||
::_pbi::ConstantInitialized)
|
||||
: options_()
|
||||
, name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, request_type_url_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, response_type_url_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, request_type_url_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, response_type_url_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, request_streaming_(false)
|
||||
, response_streaming_(false)
|
||||
, syntax_(0)
|
||||
@ -61,8 +61,8 @@ struct MethodDefaultTypeInternal {
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 MethodDefaultTypeInternal _Method_default_instance_;
|
||||
constexpr Mixin::Mixin(
|
||||
::_pbi::ConstantInitialized)
|
||||
: name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, root_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){}
|
||||
: name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, root_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}){}
|
||||
struct MixinDefaultTypeInternal {
|
||||
constexpr MixinDefaultTypeInternal()
|
||||
: _instance(::_pbi::ConstantInitialized{}) {}
|
||||
|
@ -228,8 +228,8 @@ static_assert(std::is_trivial<TaggedStringPtr>::value,
|
||||
// held, and the mutable and ownership invariants for each type.
|
||||
struct PROTOBUF_EXPORT ArenaStringPtr {
|
||||
ArenaStringPtr() = default;
|
||||
explicit constexpr ArenaStringPtr(
|
||||
ExplicitlyConstructedArenaString* default_value)
|
||||
constexpr ArenaStringPtr(ExplicitlyConstructedArenaString* default_value,
|
||||
ConstantInitialized)
|
||||
: tagged_ptr_(default_value) {}
|
||||
|
||||
// Called from generated code / reflection runtime only. Resets value to point
|
||||
|
@ -530,9 +530,11 @@ void StringFieldGenerator::GenerateConstinitInitializer(
|
||||
return;
|
||||
}
|
||||
if (descriptor_->default_value_string().empty()) {
|
||||
format("$name$_(&::$proto_ns$::internal::fixed_address_empty_string)");
|
||||
format(
|
||||
"$name$_(&::_pbi::fixed_address_empty_string, "
|
||||
"::_pbi::ConstantInitialized{})");
|
||||
} else {
|
||||
format("$name$_(nullptr)");
|
||||
format("$name$_(nullptr, ::_pbi::ConstantInitialized{})");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ PROTOBUF_NAMESPACE_OPEN
|
||||
namespace compiler {
|
||||
constexpr Version::Version(
|
||||
::_pbi::ConstantInitialized)
|
||||
: suffix_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
: suffix_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, major_(0)
|
||||
, minor_(0)
|
||||
, patch_(0){}
|
||||
@ -41,7 +41,7 @@ constexpr CodeGeneratorRequest::CodeGeneratorRequest(
|
||||
::_pbi::ConstantInitialized)
|
||||
: file_to_generate_()
|
||||
, proto_file_()
|
||||
, parameter_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, parameter_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, compiler_version_(nullptr){}
|
||||
struct CodeGeneratorRequestDefaultTypeInternal {
|
||||
constexpr CodeGeneratorRequestDefaultTypeInternal()
|
||||
@ -54,9 +54,9 @@ struct CodeGeneratorRequestDefaultTypeInternal {
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 CodeGeneratorRequestDefaultTypeInternal _CodeGeneratorRequest_default_instance_;
|
||||
constexpr CodeGeneratorResponse_File::CodeGeneratorResponse_File(
|
||||
::_pbi::ConstantInitialized)
|
||||
: name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, insertion_point_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, content_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
: name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, insertion_point_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, content_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, generated_code_info_(nullptr){}
|
||||
struct CodeGeneratorResponse_FileDefaultTypeInternal {
|
||||
constexpr CodeGeneratorResponse_FileDefaultTypeInternal()
|
||||
@ -70,7 +70,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORIT
|
||||
constexpr CodeGeneratorResponse::CodeGeneratorResponse(
|
||||
::_pbi::ConstantInitialized)
|
||||
: file_()
|
||||
, error_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, error_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, supported_features_(uint64_t{0u}){}
|
||||
struct CodeGeneratorResponseDefaultTypeInternal {
|
||||
constexpr CodeGeneratorResponseDefaultTypeInternal()
|
||||
|
@ -42,9 +42,9 @@ constexpr FileDescriptorProto::FileDescriptorProto(
|
||||
, extension_()
|
||||
, public_dependency_()
|
||||
, weak_dependency_()
|
||||
, name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, package_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, syntax_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, package_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, syntax_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, options_(nullptr)
|
||||
, source_code_info_(nullptr){}
|
||||
struct FileDescriptorProtoDefaultTypeInternal {
|
||||
@ -93,7 +93,7 @@ constexpr DescriptorProto::DescriptorProto(
|
||||
, oneof_decl_()
|
||||
, reserved_range_()
|
||||
, reserved_name_()
|
||||
, name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, options_(nullptr){}
|
||||
struct DescriptorProtoDefaultTypeInternal {
|
||||
constexpr DescriptorProtoDefaultTypeInternal()
|
||||
@ -118,11 +118,11 @@ struct ExtensionRangeOptionsDefaultTypeInternal {
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ExtensionRangeOptionsDefaultTypeInternal _ExtensionRangeOptions_default_instance_;
|
||||
constexpr FieldDescriptorProto::FieldDescriptorProto(
|
||||
::_pbi::ConstantInitialized)
|
||||
: name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, extendee_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, type_name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, default_value_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, json_name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
: name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, extendee_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, type_name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, default_value_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, json_name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, options_(nullptr)
|
||||
, number_(0)
|
||||
, oneof_index_(0)
|
||||
@ -142,7 +142,7 @@ struct FieldDescriptorProtoDefaultTypeInternal {
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 FieldDescriptorProtoDefaultTypeInternal _FieldDescriptorProto_default_instance_;
|
||||
constexpr OneofDescriptorProto::OneofDescriptorProto(
|
||||
::_pbi::ConstantInitialized)
|
||||
: name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
: name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, options_(nullptr){}
|
||||
struct OneofDescriptorProtoDefaultTypeInternal {
|
||||
constexpr OneofDescriptorProtoDefaultTypeInternal()
|
||||
@ -171,7 +171,7 @@ constexpr EnumDescriptorProto::EnumDescriptorProto(
|
||||
: value_()
|
||||
, reserved_range_()
|
||||
, reserved_name_()
|
||||
, name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, options_(nullptr){}
|
||||
struct EnumDescriptorProtoDefaultTypeInternal {
|
||||
constexpr EnumDescriptorProtoDefaultTypeInternal()
|
||||
@ -184,7 +184,7 @@ struct EnumDescriptorProtoDefaultTypeInternal {
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 EnumDescriptorProtoDefaultTypeInternal _EnumDescriptorProto_default_instance_;
|
||||
constexpr EnumValueDescriptorProto::EnumValueDescriptorProto(
|
||||
::_pbi::ConstantInitialized)
|
||||
: name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
: name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, options_(nullptr)
|
||||
, number_(0){}
|
||||
struct EnumValueDescriptorProtoDefaultTypeInternal {
|
||||
@ -199,7 +199,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORIT
|
||||
constexpr ServiceDescriptorProto::ServiceDescriptorProto(
|
||||
::_pbi::ConstantInitialized)
|
||||
: method_()
|
||||
, name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, options_(nullptr){}
|
||||
struct ServiceDescriptorProtoDefaultTypeInternal {
|
||||
constexpr ServiceDescriptorProtoDefaultTypeInternal()
|
||||
@ -212,9 +212,9 @@ struct ServiceDescriptorProtoDefaultTypeInternal {
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ServiceDescriptorProtoDefaultTypeInternal _ServiceDescriptorProto_default_instance_;
|
||||
constexpr MethodDescriptorProto::MethodDescriptorProto(
|
||||
::_pbi::ConstantInitialized)
|
||||
: name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, input_type_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, output_type_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
: name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, input_type_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, output_type_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, options_(nullptr)
|
||||
, client_streaming_(false)
|
||||
, server_streaming_(false){}
|
||||
@ -230,16 +230,16 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORIT
|
||||
constexpr FileOptions::FileOptions(
|
||||
::_pbi::ConstantInitialized)
|
||||
: uninterpreted_option_()
|
||||
, java_package_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, java_outer_classname_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, go_package_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, objc_class_prefix_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, csharp_namespace_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, swift_prefix_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, php_class_prefix_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, php_namespace_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, php_metadata_namespace_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, ruby_package_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, java_package_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, java_outer_classname_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, go_package_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, objc_class_prefix_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, csharp_namespace_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, swift_prefix_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, php_class_prefix_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, php_namespace_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, php_metadata_namespace_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, ruby_package_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, java_multiple_files_(false)
|
||||
, java_generate_equals_and_hash_(false)
|
||||
, java_string_check_utf8_(false)
|
||||
@ -366,7 +366,7 @@ struct MethodOptionsDefaultTypeInternal {
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 MethodOptionsDefaultTypeInternal _MethodOptions_default_instance_;
|
||||
constexpr UninterpretedOption_NamePart::UninterpretedOption_NamePart(
|
||||
::_pbi::ConstantInitialized)
|
||||
: name_part_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
: name_part_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, is_extension_(false){}
|
||||
struct UninterpretedOption_NamePartDefaultTypeInternal {
|
||||
constexpr UninterpretedOption_NamePartDefaultTypeInternal()
|
||||
@ -380,9 +380,9 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORIT
|
||||
constexpr UninterpretedOption::UninterpretedOption(
|
||||
::_pbi::ConstantInitialized)
|
||||
: name_()
|
||||
, identifier_value_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, string_value_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, aggregate_value_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, identifier_value_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, string_value_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, aggregate_value_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, positive_int_value_(uint64_t{0u})
|
||||
, negative_int_value_(int64_t{0})
|
||||
, double_value_(0){}
|
||||
@ -402,8 +402,8 @@ constexpr SourceCodeInfo_Location::SourceCodeInfo_Location(
|
||||
, span_()
|
||||
, _span_cached_byte_size_(0)
|
||||
, leading_detached_comments_()
|
||||
, leading_comments_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, trailing_comments_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){}
|
||||
, leading_comments_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, trailing_comments_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}){}
|
||||
struct SourceCodeInfo_LocationDefaultTypeInternal {
|
||||
constexpr SourceCodeInfo_LocationDefaultTypeInternal()
|
||||
: _instance(::_pbi::ConstantInitialized{}) {}
|
||||
@ -429,7 +429,7 @@ constexpr GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(
|
||||
::_pbi::ConstantInitialized)
|
||||
: path_()
|
||||
, _path_cached_byte_size_(0)
|
||||
, source_file_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, source_file_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, begin_(0)
|
||||
, end_(0){}
|
||||
struct GeneratedCodeInfo_AnnotationDefaultTypeInternal {
|
||||
|
@ -34,6 +34,7 @@
|
||||
|
||||
#include <google/protobuf/descriptor_database.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
|
||||
#include <google/protobuf/descriptor.pb.h>
|
||||
@ -1027,5 +1028,21 @@ bool MergedDescriptorDatabase::FindAllExtensionNumbers(
|
||||
}
|
||||
|
||||
|
||||
bool MergedDescriptorDatabase::FindAllFileNames(
|
||||
std::vector<std::string>* output) {
|
||||
bool implemented = false;
|
||||
for (DescriptorDatabase* source : sources_) {
|
||||
std::vector<std::string> source_output;
|
||||
if (source->FindAllFileNames(&source_output)) {
|
||||
output->reserve(output->size() + source_output.size());
|
||||
for (auto& source : source_output) {
|
||||
output->push_back(std::move(source));
|
||||
}
|
||||
implemented = true;
|
||||
}
|
||||
}
|
||||
return implemented;
|
||||
}
|
||||
|
||||
} // namespace protobuf
|
||||
} // namespace google
|
||||
|
@ -381,6 +381,10 @@ class PROTOBUF_EXPORT MergedDescriptorDatabase : public DescriptorDatabase {
|
||||
std::vector<int>* output) override;
|
||||
|
||||
|
||||
// This function is best-effort. Returns true if at least one underlying
|
||||
// DescriptorDatabase returns true.
|
||||
bool FindAllFileNames(std::vector<std::string>* output) override;
|
||||
|
||||
private:
|
||||
std::vector<DescriptorDatabase*> sources_;
|
||||
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MergedDescriptorDatabase);
|
||||
|
@ -799,6 +799,13 @@ TEST_F(MergedDescriptorDatabaseTest, FindAllExtensionNumbers) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(MergedDescriptorDatabaseTest, FindAllFileNames) {
|
||||
std::vector<std::string> files;
|
||||
EXPECT_TRUE(forward_merged_.FindAllFileNames(&files));
|
||||
EXPECT_THAT(files, ::testing::UnorderedElementsAre("foo.proto", "bar.proto",
|
||||
"baz.proto", "baz.proto"));
|
||||
}
|
||||
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace protobuf
|
||||
|
@ -338,7 +338,8 @@ class PROTOBUF_EXPORT MapFieldBase {
|
||||
// It uses a linker initialized mutex, so it is not compatible with regular
|
||||
// runtime instances.
|
||||
// Except in MSVC, where we can't have a constinit mutex.
|
||||
explicit constexpr MapFieldBase(ConstantInitialized)
|
||||
// NOLINTNEXTLINE(google-explicit-constructor)
|
||||
constexpr MapFieldBase(ConstantInitialized)
|
||||
: arena_(nullptr),
|
||||
repeated_field_(nullptr),
|
||||
mutex_(GOOGLE_PROTOBUF_LINKER_INITIALIZED),
|
||||
@ -497,7 +498,8 @@ class TypeDefinedMapFieldBase : public MapFieldBase {
|
||||
// This constructor is for constant initialized global instances.
|
||||
// It uses a linker initialized mutex, so it is not compatible with regular
|
||||
// runtime instances.
|
||||
explicit constexpr TypeDefinedMapFieldBase(ConstantInitialized tag)
|
||||
// NOLINTNEXTLINE(google-explicit-constructor)
|
||||
constexpr TypeDefinedMapFieldBase(ConstantInitialized tag)
|
||||
: MapFieldBase(tag) {}
|
||||
explicit TypeDefinedMapFieldBase(Arena* arena) : MapFieldBase(arena) {}
|
||||
|
||||
@ -567,7 +569,8 @@ class MapField : public TypeDefinedMapFieldBase<Key, T> {
|
||||
// This constructor is for constant initialized global instances.
|
||||
// It uses a linker initialized mutex, so it is not compatible with regular
|
||||
// runtime instances.
|
||||
explicit constexpr MapField(ConstantInitialized tag)
|
||||
// NOLINTNEXTLINE(google-explicit-constructor)
|
||||
constexpr MapField(ConstantInitialized tag)
|
||||
: TypeDefinedMapFieldBase<Key, T>(tag), impl_() {}
|
||||
explicit MapField(Arena* arena)
|
||||
: TypeDefinedMapFieldBase<Key, T>(arena), impl_(arena) {}
|
||||
|
@ -591,7 +591,8 @@ inline bool MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::IsInitialized(
|
||||
constexpr auto \
|
||||
MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::Constinit() \
|
||||
->TypeOnMemory { \
|
||||
return TypeOnMemory(&internal::fixed_address_empty_string); \
|
||||
return TypeOnMemory(&internal::fixed_address_empty_string, \
|
||||
ConstantInitialized{}); \
|
||||
} \
|
||||
template <typename Type> \
|
||||
inline typename MapTypeHandler<WireFormatLite::TYPE_##FieldType, \
|
||||
|
@ -84,12 +84,6 @@ namespace internal {
|
||||
|
||||
class SwapFieldHelper;
|
||||
|
||||
// Tag type used to invoke the constinit constructor overload of some classes.
|
||||
// Such constructors are internal implementation details of the library.
|
||||
struct ConstantInitialized {
|
||||
explicit ConstantInitialized() = default;
|
||||
};
|
||||
|
||||
// See parse_context.h for explanation
|
||||
class ParseContext;
|
||||
|
||||
|
@ -57,6 +57,13 @@ inline void SizedArrayDelete(void* p, size_t size) {
|
||||
::operator delete[](p);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Tag type used to invoke the constinit constructor overload of some classes.
|
||||
// Such constructors are internal implementation details of the library.
|
||||
struct ConstantInitialized {
|
||||
explicit ConstantInitialized() = default;
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
} // namespace protobuf
|
||||
} // namespace google
|
||||
|
@ -23,7 +23,7 @@ namespace _pbi = _pb::internal;
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
constexpr SourceContext::SourceContext(
|
||||
::_pbi::ConstantInitialized)
|
||||
: file_name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){}
|
||||
: file_name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}){}
|
||||
struct SourceContextDefaultTypeInternal {
|
||||
constexpr SourceContextDefaultTypeInternal()
|
||||
: _instance(::_pbi::ConstantInitialized{}) {}
|
||||
|
@ -26,7 +26,7 @@ constexpr Type::Type(
|
||||
: fields_()
|
||||
, oneofs_()
|
||||
, options_()
|
||||
, name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, source_context_(nullptr)
|
||||
, syntax_(0)
|
||||
{}
|
||||
@ -42,10 +42,10 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORIT
|
||||
constexpr Field::Field(
|
||||
::_pbi::ConstantInitialized)
|
||||
: options_()
|
||||
, name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, type_url_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, json_name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, default_value_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, type_url_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, json_name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, default_value_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, kind_(0)
|
||||
|
||||
, cardinality_(0)
|
||||
@ -66,7 +66,7 @@ constexpr Enum::Enum(
|
||||
::_pbi::ConstantInitialized)
|
||||
: enumvalue_()
|
||||
, options_()
|
||||
, name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, source_context_(nullptr)
|
||||
, syntax_(0)
|
||||
{}
|
||||
@ -82,7 +82,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORIT
|
||||
constexpr EnumValue::EnumValue(
|
||||
::_pbi::ConstantInitialized)
|
||||
: options_()
|
||||
, name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
, name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, number_(0){}
|
||||
struct EnumValueDefaultTypeInternal {
|
||||
constexpr EnumValueDefaultTypeInternal()
|
||||
@ -95,7 +95,7 @@ struct EnumValueDefaultTypeInternal {
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 EnumValueDefaultTypeInternal _EnumValue_default_instance_;
|
||||
constexpr Option::Option(
|
||||
::_pbi::ConstantInitialized)
|
||||
: name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
|
||||
: name_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{})
|
||||
, value_(nullptr){}
|
||||
struct OptionDefaultTypeInternal {
|
||||
constexpr OptionDefaultTypeInternal()
|
||||
|
@ -107,7 +107,7 @@ struct BoolValueDefaultTypeInternal {
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 BoolValueDefaultTypeInternal _BoolValue_default_instance_;
|
||||
constexpr StringValue::StringValue(
|
||||
::_pbi::ConstantInitialized)
|
||||
: value_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){}
|
||||
: value_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}){}
|
||||
struct StringValueDefaultTypeInternal {
|
||||
constexpr StringValueDefaultTypeInternal()
|
||||
: _instance(::_pbi::ConstantInitialized{}) {}
|
||||
@ -119,7 +119,7 @@ struct StringValueDefaultTypeInternal {
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 StringValueDefaultTypeInternal _StringValue_default_instance_;
|
||||
constexpr BytesValue::BytesValue(
|
||||
::_pbi::ConstantInitialized)
|
||||
: value_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){}
|
||||
: value_(&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}){}
|
||||
struct BytesValueDefaultTypeInternal {
|
||||
constexpr BytesValueDefaultTypeInternal()
|
||||
: _instance(::_pbi::ConstantInitialized{}) {}
|
||||
|
Loading…
Reference in New Issue
Block a user