diff options
author | Alexander Smirnov <alex@ydb.tech> | 2024-07-08 15:54:05 +0000 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2024-07-08 15:54:05 +0000 |
commit | fc7be18c76af2e700641f3598c4856baeef1428e (patch) | |
tree | 11dbca45eb321c3a4dd08b12152acc6ef5dd3fa9 /contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_file.h | |
parent | ec0e7ed6da6fb317741fd8468602949a1362eca5 (diff) | |
parent | c92cb9d3a19331916f0c274d80e67f02a62caa9b (diff) | |
download | ydb-fc7be18c76af2e700641f3598c4856baeef1428e.tar.gz |
Merge branch 'rightlib' into mergelibs-240708-1553
Diffstat (limited to 'contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_file.h')
-rw-r--r-- | contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_file.h | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_file.h b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_file.h index 6d2c970f81..de37930eb3 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_file.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/objectivec/objectivec_file.h @@ -31,8 +31,9 @@ #ifndef GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_FILE_H__ #define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_FILE_H__ -#include <string> +#include <map> #include <set> +#include <string> #include <vector> #include <google/protobuf/descriptor.h> #include <google/protobuf/io/printer.h> @@ -59,8 +60,29 @@ class FileGenerator { bool headers_use_forward_declarations; }; + // Wrapper for some common state that is shared between file generations to + // improve performance when more than one file is generated at a time. + struct CommonState { + CommonState(); + + const std::vector<const FileDescriptor*> + CollectMinimalFileDepsContainingExtensions(const FileDescriptor* file); + + private: + struct MinDepsEntry { + bool has_extensions; + std::set<const FileDescriptor*> min_deps; + // `covered_deps` are the transtive deps of `min_deps_w_exts` that also + // have extensions. + std::set<const FileDescriptor*> covered_deps; + }; + const MinDepsEntry& CollectMinimalFileDepsContainingExtensionsInternal(const FileDescriptor* file); + std::map<const FileDescriptor*, MinDepsEntry> deps_info_cache_; + }; + FileGenerator(const FileDescriptor* file, - const GenerationOptions& generation_options); + const GenerationOptions& generation_options, + CommonState& common_state); ~FileGenerator(); FileGenerator(const FileGenerator&) = delete; @@ -72,6 +94,7 @@ class FileGenerator { private: const FileDescriptor* file_; const GenerationOptions& generation_options_; + CommonState& common_state_; TProtoStringType root_class_name_; bool is_bundled_proto_; |