From 5a76e633ea9b5adb215e93fdc11e1c0c08b3fc74 Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Thu, 17 Nov 2016 16:48:38 -0800 Subject: Integrated internal changes from Google --- src/google/protobuf/compiler/cpp/cpp_file.h | 37 ++++++++++++++++------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'src/google/protobuf/compiler/cpp/cpp_file.h') diff --git a/src/google/protobuf/compiler/cpp/cpp_file.h b/src/google/protobuf/compiler/cpp/cpp_file.h index 5dcf692b..25d6eabf 100644 --- a/src/google/protobuf/compiler/cpp/cpp_file.h +++ b/src/google/protobuf/compiler/cpp/cpp_file.h @@ -68,6 +68,9 @@ class FileGenerator { FileGenerator(const FileDescriptor* file, const Options& options); ~FileGenerator(); + // Shared code between the two header generators below. + void GenerateHeader(io::Printer* printer); + // info_path, if non-empty, should be the path (relative to printer's output) // to the metadata file describing this proto header. void GenerateProtoHeader(io::Printer* printer, @@ -117,18 +120,6 @@ class FileGenerator { // Generates types for classes. void GenerateMessageDefinitions(io::Printer* printer); - // Generates forward-declarations for just this file's classes. This is - // used for .pb.h headers, but not in proto_h mode. - void GenerateMessageForwardDeclarations(io::Printer* printer); - - // Fills in types for forward declarations. This is used internally, and - // also by other FileGenerators to determine imports' declarations. - void FillMessageForwardDeclarations(ForwardDeclarations* decls); - void FillMessageDefinitions(ForwardDeclarations* decls); - - // Generates enum definitions. - void GenerateEnumForwardDeclarations(io::Printer* printer); - void FillEnumForwardDeclarations(ForwardDeclarations* decls); void GenerateEnumDefinitions(io::Printer* printer); // Generates generic service definitions. @@ -145,13 +136,25 @@ class FileGenerator { const FileDescriptor* file_; const Options options_; - google::protobuf::scoped_array > message_generators_; - google::protobuf::scoped_array > enum_generators_; - google::protobuf::scoped_array > service_generators_; - google::protobuf::scoped_array > extension_generators_; + // Contains the post-order walk of all the messages (and child messages) in + // this file. If you need a pre-order walk just reverse iterate. + std::vector message_generators_; + std::vector enum_generators_; + std::vector service_generators_; + std::vector extension_generators_; + + // These members are just for owning (and thus proper deleting). Some of the + // message_ and enum_generators above are owned by child messages. + google::protobuf::scoped_array > + message_generators_owner_; + google::protobuf::scoped_array > enum_generators_owner_; + google::protobuf::scoped_array > + service_generators_owner_; + google::protobuf::scoped_array > + extension_generators_owner_; // E.g. if the package is foo.bar, package_parts_ is {"foo", "bar"}. - vector package_parts_; + std::vector package_parts_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator); }; -- cgit v1.2.3