protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 // Author: kenton@google.com (Kenton Varda)
32 // Based on original Protocol Buffers design by
33 // Sanjay Ghemawat, Jeff Dean, and others.
34 
35 #include <google/protobuf/compiler/cpp/cpp_file.h>
36 
37 #include <iostream>
38 #include <map>
39 #include <memory>
40 #include <set>
41 #include <unordered_map>
42 #include <unordered_set>
43 #include <vector>
44 
45 #include <google/protobuf/compiler/cpp/cpp_enum.h>
46 #include <google/protobuf/compiler/cpp/cpp_extension.h>
47 #include <google/protobuf/compiler/cpp/cpp_field.h>
48 #include <google/protobuf/compiler/cpp/cpp_helpers.h>
49 #include <google/protobuf/compiler/cpp/cpp_message.h>
50 #include <google/protobuf/compiler/cpp/cpp_service.h>
51 #include <google/protobuf/compiler/scc.h>
52 #include <google/protobuf/descriptor.pb.h>
53 #include <google/protobuf/io/printer.h>
54 #include <google/protobuf/stubs/strutil.h>
55 
56 // Must be last.
57 #include <google/protobuf/port_def.inc>
58 
59 namespace google {
60 namespace protobuf {
61 namespace compiler {
62 namespace cpp {
63 
64 namespace {
65 
66 // When we forward-declare things, we want to create a sorted order so our
67 // output is deterministic and minimizes namespace changes.
68 template <class T>
69 std::string GetSortKey(const T& val) {
70  return val.full_name();
71 }
72 
73 template <>
74 std::string GetSortKey<FileDescriptor>(const FileDescriptor& val) {
75  return val.name();
76 }
77 
78 template <class T>
79 bool CompareSortKeys(const T* a, const T* b) {
80  return GetSortKey(*a) < GetSortKey(*b);
81 }
82 
83 template <class T>
84 std::vector<const T*> Sorted(const std::unordered_set<const T*>& vals) {
85  std::vector<const T*> sorted(vals.begin(), vals.end());
86  std::sort(sorted.begin(), sorted.end(), CompareSortKeys<T>);
87  return sorted;
88 }
89 
90 } // namespace
91 
93  : file_(file), options_(options), scc_analyzer_(options) {
94  // These variables are the same on a file level
96  variables_["dllexport_decl"] = options.dllexport_decl;
97  variables_["tablename"] = UniqueName("TableStruct", file_, options_);
98  variables_["file_level_metadata"] =
99  UniqueName("file_level_metadata", file_, options_);
100  variables_["desc_table"] = DescriptorTableName(file_, options_);
101  variables_["file_level_enum_descriptors"] =
102  UniqueName("file_level_enum_descriptors", file_, options_);
103  variables_["file_level_service_descriptors"] =
104  UniqueName("file_level_service_descriptors", file_, options_);
105  variables_["filename"] = file_->name();
106  variables_["package_ns"] = Namespace(file_, options);
107 
108  std::vector<const Descriptor*> msgs = FlattenMessagesInFile(file);
109  for (int i = 0; i < msgs.size(); i++) {
110  // Deleted in destructor
111  MessageGenerator* msg_gen =
112  new MessageGenerator(msgs[i], variables_, i, options, &scc_analyzer_);
113  message_generators_.emplace_back(msg_gen);
114  msg_gen->AddGenerators(&enum_generators_, &extension_generators_);
115  }
116 
117  for (int i = 0; i < file->enum_type_count(); i++) {
118  enum_generators_.emplace_back(
119  new EnumGenerator(file->enum_type(i), variables_, options));
120  }
121 
122  for (int i = 0; i < file->service_count(); i++) {
123  service_generators_.emplace_back(
124  new ServiceGenerator(file->service(i), variables_, options));
125  }
127  for (int i = 0; i < service_generators_.size(); i++) {
128  service_generators_[i]->index_in_metadata_ = i;
129  }
130  }
131  for (int i = 0; i < file->extension_count(); i++) {
132  extension_generators_.emplace_back(
133  new ExtensionGenerator(file->extension(i), options, &scc_analyzer_));
134  }
135  for (int i = 0; i < file->weak_dependency_count(); ++i) {
136  weak_deps_.insert(file->weak_dependency(i));
137  }
138 }
139 
141 
143  Formatter format(printer, variables_);
144  // Only do this for protobuf's own types. There are some google3 protos using
145  // macros as field names and the generated code compiles after the macro
146  // expansion. Undefing these macros actually breaks such code.
147  if (file_->name() != "net/proto2/compiler/proto/plugin.proto" &&
148  file_->name() != "google/protobuf/compiler/plugin.proto") {
149  return;
150  }
151  std::vector<std::string> names_to_undef;
152  std::vector<const FieldDescriptor*> fields;
154  for (int i = 0; i < fields.size(); i++) {
155  const std::string& name = fields[i]->name();
156  static const char* kMacroNames[] = {"major", "minor"};
157  for (int j = 0; j < GOOGLE_ARRAYSIZE(kMacroNames); ++j) {
158  if (name == kMacroNames[j]) {
159  names_to_undef.push_back(name);
160  break;
161  }
162  }
163  }
164  for (int i = 0; i < names_to_undef.size(); ++i) {
165  format(
166  "#ifdef $1$\n"
167  "#undef $1$\n"
168  "#endif\n",
169  names_to_undef[i]);
170  }
171 }
172 
174  Formatter format(printer, variables_);
175 
176  // port_def.inc must be included after all other includes.
177  IncludeFile("net/proto2/public/port_def.inc", printer);
178  format("#define $1$$ dllexport_decl$\n", FileDllExport(file_, options_));
179  GenerateMacroUndefs(printer);
180 
181  // For Any support with lite protos, we need to friend AnyMetadata, so we
182  // forward-declare it here.
183  format(
184  "PROTOBUF_NAMESPACE_OPEN\n"
185  "namespace internal {\n"
186  "class AnyMetadata;\n"
187  "} // namespace internal\n"
188  "PROTOBUF_NAMESPACE_CLOSE\n");
189 
191 
193 
194  {
195  NamespaceOpener ns(Namespace(file_, options_), format);
196 
197  format("\n");
198 
199  GenerateEnumDefinitions(printer);
200 
202  format("\n");
203 
205 
206  format("\n");
208  format("\n");
209 
211 
213 
214  format("\n");
216  format("\n");
217 
219 
220  format(
221  "\n"
222  "// @@protoc_insertion_point(namespace_scope)\n"
223  "\n");
224  }
225 
226  // We need to specialize some templates in the ::google::protobuf namespace:
228 
229  format(
230  "\n"
231  "// @@protoc_insertion_point(global_scope)\n"
232  "\n");
233  IncludeFile("net/proto2/public/port_undef.inc", printer);
234 }
235 
237  const std::string& info_path) {
238  Formatter format(printer, variables_);
239  if (!options_.proto_h) {
240  return;
241  }
242 
243  GenerateTopHeaderGuard(printer, false);
244 
246  format(
247  "#ifdef SWIG\n"
248  "#error \"Do not SWIG-wrap protobufs.\"\n"
249  "#endif // SWIG\n"
250  "\n");
251  }
252 
254  format("// IWYU pragma: private, include \"$1$.proto.h\"\n\n",
255  StripProto(file_->name()));
256  }
257 
258  GenerateLibraryIncludes(printer);
259 
260  for (int i = 0; i < file_->public_dependency_count(); i++) {
262  format("#include \"$1$.proto.h\"\n", StripProto(dep->name()));
263  }
264 
265  format("// @@protoc_insertion_point(includes)\n");
266 
267  GenerateMetadataPragma(printer, info_path);
268 
269  GenerateHeader(printer);
270 
271  GenerateBottomHeaderGuard(printer, false);
272 }
273 
275  const std::string& info_path) {
276  Formatter format(printer, variables_);
277  GenerateTopHeaderGuard(printer, true);
278 
279  if (options_.proto_h) {
280  std::string target_basename = StripProto(file_->name());
282  GetBootstrapBasename(options_, target_basename, &target_basename);
283  }
284  format("#include \"$1$.proto.h\" // IWYU pragma: export\n",
285  target_basename);
286  } else {
287  GenerateLibraryIncludes(printer);
288  }
289 
292  }
293 
294  // This is unfortunately necessary for some plugins. I don't see why we
295  // need two of the same insertion points.
296  // TODO(gerbens) remove this.
297  format("// @@protoc_insertion_point(includes)\n");
298 
299  GenerateMetadataPragma(printer, info_path);
300 
301  if (!options_.proto_h) {
302  GenerateHeader(printer);
303  } else {
304  {
305  NamespaceOpener ns(Namespace(file_, options_), format);
306  format(
307  "\n"
308  "// @@protoc_insertion_point(namespace_scope)\n");
309  }
310  format(
311  "\n"
312  "// @@protoc_insertion_point(global_scope)\n"
313  "\n");
314  }
315 
316  GenerateBottomHeaderGuard(printer, true);
317 }
318 
319 void FileGenerator::DoIncludeFile(const std::string& google3_name,
320  bool do_export, io::Printer* printer) {
321  Formatter format(printer, variables_);
322  const std::string prefix = "net/proto2/";
323  GOOGLE_CHECK(google3_name.find(prefix) == 0) << google3_name;
324 
326  std::string path = google3_name.substr(prefix.size());
327 
328  path = StringReplace(path, "internal/", "", false);
329  path = StringReplace(path, "proto/", "", false);
330  path = StringReplace(path, "public/", "", false);
331  if (options_.runtime_include_base.empty()) {
332  format("#include <google/protobuf/$1$>", path);
333  } else {
334  format("#include \"$1$google/protobuf/$2$\"",
336  }
337  } else {
338  format("#include \"$1$\"", google3_name);
339  }
340 
341  if (do_export) {
342  format(" // IWYU pragma: export");
343  }
344 
345  format("\n");
346 }
347 
349  const FileDescriptor* file) {
350  bool use_system_include = false;
351  std::string name = basename;
352 
354  if (IsWellKnownMessage(file)) {
355  if (options_.runtime_include_base.empty()) {
356  use_system_include = true;
357  } else {
358  name = options_.runtime_include_base + basename;
359  }
360  }
361  }
362 
363  std::string left = "\"";
364  std::string right = "\"";
365  if (use_system_include) {
366  left = "<";
367  right = ">";
368  }
369  return left + name + right;
370 }
371 
373  Formatter format(printer, variables_);
374  std::string target_basename = StripProto(file_->name());
376  GetBootstrapBasename(options_, target_basename, &target_basename);
377  }
378  target_basename += options_.proto_h ? ".proto.h" : ".pb.h";
379  format(
380  "// Generated by the protocol buffer compiler. DO NOT EDIT!\n"
381  "// source: $filename$\n"
382  "\n"
383  "#include $1$\n"
384  "\n"
385  "#include <algorithm>\n" // for swap()
386  "\n",
387  CreateHeaderInclude(target_basename, file_));
388 
389  IncludeFile("net/proto2/io/public/coded_stream.h", printer);
390  // TODO(gerbens) This is to include parse_context.h, we need a better way
391  IncludeFile("net/proto2/public/extension_set.h", printer);
392  IncludeFile("net/proto2/public/wire_format_lite.h", printer);
393 
394  // Unknown fields implementation in lite mode uses StringOutputStream
396  IncludeFile("net/proto2/io/public/zero_copy_stream_impl_lite.h", printer);
397  }
398 
400  IncludeFile("net/proto2/public/descriptor.h", printer);
401  IncludeFile("net/proto2/public/generated_message_reflection.h", printer);
402  IncludeFile("net/proto2/public/reflection_ops.h", printer);
403  IncludeFile("net/proto2/public/wire_format.h", printer);
404  }
405 
408  IncludeFile("net/proto2/public/generated_message_tctable_impl.h", printer);
409  }
410 
411  if (options_.proto_h) {
412  // Use the smaller .proto.h files.
413  for (int i = 0; i < file_->dependency_count(); i++) {
414  const FileDescriptor* dep = file_->dependency(i);
415  // Do not import weak deps.
416  if (!options_.opensource_runtime && IsDepWeak(dep)) continue;
417  std::string basename = StripProto(dep->name());
419  GetBootstrapBasename(options_, basename, &basename);
420  }
421  format("#include \"$1$.proto.h\"\n", basename);
422  }
423  }
424  if (HasCordFields(file_, options_)) {
425  format(
426  "#include \"third_party/absl/strings/internal/string_constant.h\"\n");
427  }
428 
429  format("// @@protoc_insertion_point(includes)\n");
430  IncludeFile("net/proto2/public/port_def.inc", printer);
431 
432  // For MSVC builds, we use #pragma init_seg to move the initialization of our
433  // libraries to happen before the user code.
434  // This worksaround the fact that MSVC does not do constant initializers when
435  // required by the standard.
436  format("\nPROTOBUF_PRAGMA_INIT_SEG\n");
437 }
438 
440  io::Printer* printer) {
441  Formatter format(printer, variables_);
442  MessageGenerator* generator = message_generators_[idx].get();
443  generator->GenerateConstexprConstructor(printer);
444  // Use a union to disable the destructor of the _instance member.
445  // We can constant initialize, but the object will still have a non-trivial
446  // destructor that we need to elide.
447  format(
448  "struct $1$ {\n"
449  " constexpr $1$()\n"
450  " : _instance(::$proto_ns$::internal::ConstantInitialized{}) {}\n"
451  " ~$1$() {}\n"
452  " union {\n"
453  " $2$ _instance;\n"
454  " };\n"
455  "};\n",
456  DefaultInstanceType(generator->descriptor_, options_),
457  generator->classname_);
458  // NO_DESTROY is not necessary for correctness. The empty destructor is
459  // enough. However, the empty destructor fails to be elided in some
460  // configurations (like non-opt or with certain sanitizers). NO_DESTROY is
461  // there just to improve performance and binary size in these builds.
462  format("PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT $1$ $2$;\n",
463  DefaultInstanceType(generator->descriptor_, options_),
464  DefaultInstanceName(generator->descriptor_, options_));
465 
466  for (int i = 0; i < generator->descriptor_->field_count(); i++) {
467  const FieldDescriptor* field = generator->descriptor_->field(i);
469  // Force the initialization of the inlined string in the default instance.
470  format(
471  "PROTOBUF_ATTRIBUTE_INIT_PRIORITY std::true_type "
472  "$1$::_init_inline_$2$_ = "
473  "($3$._instance.$2$_.Init(), std::true_type{});\n",
474  ClassName(generator->descriptor_), FieldName(field),
475  DefaultInstanceName(generator->descriptor_, options_));
476  }
477  }
478 
480  format("$1$* $2$ = &$3$;\n",
481  DefaultInstanceType(generator->descriptor_, options_),
482  DefaultInstancePtr(generator->descriptor_, options_),
483  DefaultInstanceName(generator->descriptor_, options_));
484  }
485 }
486 
487 // A list of things defined in one .pb.cc file that we need to reference from
488 // another .pb.cc file.
489 struct FileGenerator::CrossFileReferences {
490  // Populated if we are referencing from messages or files.
491  std::unordered_set<const Descriptor*> weak_default_instances;
492 
493  // Only if we are referencing from files.
494  std::unordered_set<const FileDescriptor*> strong_reflection_files;
495  std::unordered_set<const FileDescriptor*> weak_reflection_files;
496 };
497 
499  CrossFileReferences* refs) {
500  const Descriptor* msg = field->message_type();
501  if (msg == nullptr) return;
502 
504  IsWeak(field, options_)) {
505  refs->weak_default_instances.insert(msg);
506  }
507 }
508 
510  CrossFileReferences* refs) {
511  ForEachField(file, [this, refs](const FieldDescriptor* field) {
513  });
514 
515  if (!HasDescriptorMethods(file, options_)) return;
516 
517  for (int i = 0; i < file->dependency_count(); i++) {
518  const FileDescriptor* dep = file->dependency(i);
519  if (IsDepWeak(dep)) {
520  refs->weak_reflection_files.insert(dep);
521  } else {
522  refs->strong_reflection_files.insert(dep);
523  }
524  }
525 }
526 
527 // Generates references to variables defined in other files.
529  const CrossFileReferences& refs, io::Printer* printer) {
530  Formatter format(printer, variables_);
531 
532  {
533  NamespaceOpener ns(format);
534  for (auto instance : Sorted(refs.weak_default_instances)) {
535  ns.ChangeTo(Namespace(instance, options_));
537  format("extern $1$ $2$;\n", DefaultInstanceType(instance, options_),
539  format("__attribute__((weak)) $1$* $2$ = nullptr;\n",
542  } else {
543  format("extern __attribute__((weak)) $1$ $2$;\n",
546  }
547  }
548  }
549 
550  for (auto file : Sorted(refs.weak_reflection_files)) {
551  format(
552  "extern __attribute__((weak)) const "
553  "::$proto_ns$::internal::DescriptorTable $1$;\n",
555  }
556 }
557 
559  Formatter format(printer, variables_);
560  GenerateSourceIncludes(printer);
561 
562  CrossFileReferences refs;
564  [this, &refs](const FieldDescriptor* field) {
566  });
568 
569  { // package namespace
570  NamespaceOpener ns(Namespace(file_, options_), format);
571 
572  // Define default instances
574 
575  // Generate classes.
576  format("\n");
577  message_generators_[idx]->GenerateClassMethods(printer);
578 
579  format(
580  "\n"
581  "// @@protoc_insertion_point(namespace_scope)\n");
582  } // end package namespace
583 
584  {
585  NamespaceOpener proto_ns(ProtobufNamespace(options_), format);
586  message_generators_[idx]->GenerateSourceInProto2Namespace(printer);
587  }
588 
589  format(
590  "\n"
591  "// @@protoc_insertion_point(global_scope)\n");
592 }
593 
595  Formatter format(printer, variables_);
596  GenerateSourceIncludes(printer);
598  extension_generators_[idx]->GenerateDefinition(printer);
599 }
600 
602  Formatter format(printer, variables_);
603  GenerateSourceIncludes(printer);
604 
605  {
606  GenerateTables(printer);
607 
608  // Define the code to initialize reflection. This code uses a global
609  // constructor to register reflection data with the runtime pre-main.
612  }
613  }
614 
615  NamespaceOpener ns(Namespace(file_, options_), format);
616 
617  // Generate enums.
618  for (int i = 0; i < enum_generators_.size(); i++) {
619  enum_generators_[i]->GenerateMethods(i, printer);
620  }
621 }
622 
624  Formatter format(printer, variables_);
625  GenerateSourceIncludes(printer);
626  CrossFileReferences refs;
629 
630  {
631  NamespaceOpener ns(Namespace(file_, options_), format);
632 
633  // Define default instances
634  for (int i = 0; i < message_generators_.size(); i++) {
635  GenerateSourceDefaultInstance(i, printer);
636  }
637  }
638 
639  {
640  GenerateTables(printer);
641 
643  // Define the code to initialize reflection. This code uses a global
644  // constructor to register reflection data with the runtime pre-main.
646  }
647  }
648 
649  {
650  NamespaceOpener ns(Namespace(file_, options_), format);
651 
652  // Actually implement the protos
653 
654  // Generate enums.
655  for (int i = 0; i < enum_generators_.size(); i++) {
656  enum_generators_[i]->GenerateMethods(i, printer);
657  }
658 
659  // Generate classes.
660  for (int i = 0; i < message_generators_.size(); i++) {
661  format("\n");
663  format("\n");
664  message_generators_[i]->GenerateClassMethods(printer);
665  }
666 
668  // Generate services.
669  for (int i = 0; i < service_generators_.size(); i++) {
670  if (i == 0) format("\n");
672  format("\n");
673  service_generators_[i]->GenerateImplementation(printer);
674  }
675  }
676 
677  // Define extensions.
678  for (int i = 0; i < extension_generators_.size(); i++) {
679  extension_generators_[i]->GenerateDefinition(printer);
680  }
681 
682  format(
683  "\n"
684  "// @@protoc_insertion_point(namespace_scope)\n");
685  }
686 
687  {
688  NamespaceOpener proto_ns(ProtobufNamespace(options_), format);
689  for (int i = 0; i < message_generators_.size(); i++) {
690  message_generators_[i]->GenerateSourceInProto2Namespace(printer);
691  }
692  }
693 
694  format(
695  "\n"
696  "// @@protoc_insertion_point(global_scope)\n");
697 
698  IncludeFile("net/proto2/public/port_undef.inc", printer);
699 }
700 
702  Formatter format(printer, variables_);
703 
704  if (!message_generators_.empty()) {
705  format("static ::$proto_ns$::Metadata $file_level_metadata$[$1$];\n",
706  message_generators_.size());
707  }
708  if (!enum_generators_.empty()) {
709  format(
710  "static "
711  "const ::$proto_ns$::EnumDescriptor* "
712  "$file_level_enum_descriptors$[$1$];\n",
713  enum_generators_.size());
714  } else {
715  format(
716  "static "
717  "constexpr ::$proto_ns$::EnumDescriptor const** "
718  "$file_level_enum_descriptors$ = nullptr;\n");
719  }
721  format(
722  "static "
723  "const ::$proto_ns$::ServiceDescriptor* "
724  "$file_level_service_descriptors$[$1$];\n",
725  file_->service_count());
726  } else {
727  format(
728  "static "
729  "constexpr ::$proto_ns$::ServiceDescriptor const** "
730  "$file_level_service_descriptors$ = nullptr;\n");
731  }
732 
733  if (!message_generators_.empty()) {
734  format(
735  "\n"
736  "const $uint32$ $tablename$::offsets[] "
737  "PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {\n");
738  format.Indent();
739  std::vector<std::pair<size_t, size_t> > pairs;
740  pairs.reserve(message_generators_.size());
741  for (int i = 0; i < message_generators_.size(); i++) {
742  pairs.push_back(message_generators_[i]->GenerateOffsets(printer));
743  }
744  format.Outdent();
745  format(
746  "};\n"
747  "static const ::$proto_ns$::internal::MigrationSchema schemas[] "
748  "PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {\n");
749  format.Indent();
750  {
751  int offset = 0;
752  for (int i = 0; i < message_generators_.size(); i++) {
753  message_generators_[i]->GenerateSchema(printer, offset,
754  pairs[i].second);
755  offset += pairs[i].first;
756  }
757  }
758  format.Outdent();
759  format(
760  "};\n"
761  "\nstatic "
762  "::$proto_ns$::Message const * const file_default_instances[] = {\n");
763  format.Indent();
764  for (int i = 0; i < message_generators_.size(); i++) {
765  const Descriptor* descriptor = message_generators_[i]->descriptor_;
766  format(
767  "reinterpret_cast<const "
768  "::$proto_ns$::Message*>(&$1$::_$2$_default_instance_),\n",
770  ClassName(descriptor)); // 2
771  }
772  format.Outdent();
773  format(
774  "};\n"
775  "\n");
776  } else {
777  // we still need these symbols to exist
778  format(
779  // MSVC doesn't like empty arrays, so we add a dummy.
780  "const $uint32$ $tablename$::offsets[1] = {};\n"
781  "static constexpr ::$proto_ns$::internal::MigrationSchema* schemas = "
782  "nullptr;"
783  "\n"
784  "static constexpr ::$proto_ns$::Message* const* "
785  "file_default_instances = nullptr;\n"
786  "\n");
787  }
788 
789  // ---------------------------------------------------------------
790 
791  // Embed the descriptor. We simply serialize the entire
792  // FileDescriptorProto/ and embed it as a string literal, which is parsed and
793  // built into real descriptors at initialization time.
794  const std::string protodef_name =
795  UniqueName("descriptor_table_protodef", file_, options_);
796  format("const char $1$[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =\n",
797  protodef_name);
798  format.Indent();
799  FileDescriptorProto file_proto;
800  file_->CopyTo(&file_proto);
802  file_proto.SerializeToString(&file_data);
803 
804  {
805  if (file_data.size() > 65535) {
806  // Workaround for MSVC: "Error C1091: compiler limit: string exceeds
807  // 65535 bytes in length". Declare a static array of chars rather than
808  // use a string literal. Only write 25 bytes per line.
809  static const int kBytesPerLine = 25;
810  format("{ ");
811  for (int i = 0; i < file_data.size();) {
812  for (int j = 0; j < kBytesPerLine && i < file_data.size(); ++i, ++j) {
813  format("'$1$', ", CEscape(file_data.substr(i, 1)));
814  }
815  format("\n");
816  }
817  format("'\\0' }"); // null-terminate
818  } else {
819  // Only write 40 bytes per line.
820  static const int kBytesPerLine = 40;
821  for (int i = 0; i < file_data.size(); i += kBytesPerLine) {
822  format(
823  "\"$1$\"\n",
824  EscapeTrigraphs(CEscape(file_data.substr(i, kBytesPerLine))));
825  }
826  }
827  format(";\n");
828  }
829  format.Outdent();
830 
831  CrossFileReferences refs;
833  int num_deps =
834  refs.strong_reflection_files.size() + refs.weak_reflection_files.size();
835 
836  // Build array of DescriptorTable deps.
837  if (num_deps > 0) {
838  format(
839  "static const ::$proto_ns$::internal::DescriptorTable*const "
840  "$desc_table$_deps[$1$] = {\n",
841  num_deps);
842 
843  for (auto dep : Sorted(refs.strong_reflection_files)) {
844  format(" &::$1$,\n", DescriptorTableName(dep, options_));
845  }
846  for (auto dep : Sorted(refs.weak_reflection_files)) {
847  format(" &::$1$,\n", DescriptorTableName(dep, options_));
848  }
849 
850  format("};\n");
851  }
852 
853  // The DescriptorTable itself.
854  // Should be "bool eager = NeedsEagerDescriptorAssignment(file_, options_);"
855  // however this might cause a tsan failure in superroot b/148382879,
856  // so disable for now.
857  bool eager = false;
858  format(
859  "static ::$proto_ns$::internal::once_flag $desc_table$_once;\n"
860  "const ::$proto_ns$::internal::DescriptorTable $desc_table$ = {\n"
861  " false, $1$, $2$, $3$, \"$filename$\", \n"
862  " &$desc_table$_once, $4$, $5$, $6$,\n"
863  " schemas, file_default_instances, $tablename$::offsets,\n"
864  " $7$, $file_level_enum_descriptors$, "
865  "$file_level_service_descriptors$,\n"
866  "};\n"
867  // This function exists to be marked as weak.
868  // It can significantly speed up compilation by breaking up LLVM's SCC in
869  // the .pb.cc translation units. Large translation units see a reduction
870  // of more than 35% of walltime for optimized builds.
871  // Without the weak attribute all the messages in the file, including all
872  // the vtables and everything they use become part of the same SCC through
873  // a cycle like:
874  // GetMetadata -> descriptor table -> default instances ->
875  // vtables -> GetMetadata
876  // By adding a weak function here we break the connection from the
877  // individual vtables back into the descriptor table.
878  "PROTOBUF_ATTRIBUTE_WEAK const ::$proto_ns$::internal::DescriptorTable* "
879  "$desc_table$_getter() {\n"
880  " return &$desc_table$;\n"
881  "}\n"
882  "\n",
883  eager ? "true" : "false", file_data.size(), protodef_name,
884  num_deps == 0 ? "nullptr" : variables_["desc_table"] + "_deps", num_deps,
885  message_generators_.size(),
886  message_generators_.empty() ? "nullptr"
887  : variables_["file_level_metadata"]);
888 
889  // For descriptor.proto we want to avoid doing any dynamic initialization,
890  // because in some situations that would otherwise pull in a lot of
891  // unnecessary code that can't be stripped by --gc-sections. Descriptor
892  // initialization will still be performed lazily when it's needed.
893  if (file_->name() != "net/proto2/proto/descriptor.proto") {
894  format(
895  "// Force running AddDescriptors() at dynamic initialization time.\n"
896  "PROTOBUF_ATTRIBUTE_INIT_PRIORITY "
897  "static ::$proto_ns$::internal::AddDescriptorsRunner "
898  "$1$(&$desc_table$);\n",
899  UniqueName("dynamic_init_dummy", file_, options_));
900  }
901 }
902 
904  Formatter format(printer, variables_);
906  // TODO(ckennelly): Gate this with the same options flag to enable
907  // table-driven parsing.
908  format(
909  "PROTOBUF_CONSTEXPR_VAR ::$proto_ns$::internal::ParseTableField\n"
910  " const $tablename$::entries[] "
911  "PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {\n");
912  format.Indent();
913 
914  std::vector<size_t> entries;
915  size_t count = 0;
916  for (int i = 0; i < message_generators_.size(); i++) {
917  size_t value = message_generators_[i]->GenerateParseOffsets(printer);
918  entries.push_back(value);
919  count += value;
920  }
921 
922  // We need these arrays to exist, and MSVC does not like empty arrays.
923  if (count == 0) {
924  format("{0, 0, 0, ::$proto_ns$::internal::kInvalidMask, 0, 0},\n");
925  }
926 
927  format.Outdent();
928  format(
929  "};\n"
930  "\n"
931  "PROTOBUF_CONSTEXPR_VAR "
932  "::$proto_ns$::internal::AuxiliaryParseTableField\n"
933  " const $tablename$::aux[] "
934  "PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {\n");
935  format.Indent();
936 
937  std::vector<size_t> aux_entries;
938  count = 0;
939  for (int i = 0; i < message_generators_.size(); i++) {
940  size_t value = message_generators_[i]->GenerateParseAuxTable(printer);
941  aux_entries.push_back(value);
942  count += value;
943  }
944 
945  if (count == 0) {
946  format("::$proto_ns$::internal::AuxiliaryParseTableField(),\n");
947  }
948 
949  format.Outdent();
950  format(
951  "};\n"
952  "PROTOBUF_CONSTEXPR_VAR ::$proto_ns$::internal::ParseTable const\n"
953  " $tablename$::schema[] "
954  "PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {\n");
955  format.Indent();
956 
957  size_t offset = 0;
958  size_t aux_offset = 0;
959  for (int i = 0; i < message_generators_.size(); i++) {
960  message_generators_[i]->GenerateParseTable(printer, offset, aux_offset);
961  offset += entries[i];
962  aux_offset += aux_entries[i];
963  }
964 
965  if (message_generators_.empty()) {
966  format("{ nullptr, nullptr, 0, -1, -1, false },\n");
967  }
968 
969  format.Outdent();
970  format(
971  "};\n"
972  "\n");
973  }
974 
976  format(
977  "const ::$proto_ns$::internal::FieldMetadata "
978  "$tablename$::field_metadata[] "
979  "= {\n");
980  format.Indent();
981  std::vector<int> field_metadata_offsets;
982  int idx = 0;
983  for (int i = 0; i < message_generators_.size(); i++) {
984  field_metadata_offsets.push_back(idx);
985  idx += message_generators_[i]->GenerateFieldMetadata(printer);
986  }
987  field_metadata_offsets.push_back(idx);
988  format.Outdent();
989  format(
990  "};\n"
991  "const ::$proto_ns$::internal::SerializationTable "
992  "$tablename$::serialization_table[] = {\n");
993  format.Indent();
994  // We rely on the order we layout the tables to match the order we
995  // calculate them with FlattenMessagesInFile, so we check here that
996  // these match exactly.
997  std::vector<const Descriptor*> calculated_order =
999  GOOGLE_CHECK_EQ(calculated_order.size(), message_generators_.size());
1000  for (int i = 0; i < message_generators_.size(); i++) {
1001  GOOGLE_CHECK_EQ(calculated_order[i], message_generators_[i]->descriptor_);
1002  format("{$1$, $tablename$::field_metadata + $2$},\n",
1003  field_metadata_offsets[i + 1] - field_metadata_offsets[i], // 1
1004  field_metadata_offsets[i]); // 2
1005  }
1006  format.Outdent();
1007  format(
1008  "};\n"
1009  "\n");
1010  }
1011 }
1012 
1013 class FileGenerator::ForwardDeclarations {
1014  public:
1015  void AddMessage(const Descriptor* d) { classes_[ClassName(d)] = d; }
1016  void AddEnum(const EnumDescriptor* d) { enums_[ClassName(d)] = d; }
1017 
1018  void Print(const Formatter& format, const Options& options) const {
1019  for (const auto& p : enums_) {
1020  const std::string& enumname = p.first;
1021  const EnumDescriptor* enum_desc = p.second;
1022  format(
1023  "enum ${1$$2$$}$ : int;\n"
1024  "bool $2$_IsValid(int value);\n",
1025  enum_desc, enumname);
1026  }
1027  for (const auto& p : classes_) {
1028  const std::string& classname = p.first;
1029  const Descriptor* class_desc = p.second;
1030  format(
1031  "class ${1$$2$$}$;\n"
1032  "struct $3$;\n"
1033  "$dllexport_decl $extern $3$ $4$;\n",
1034  class_desc, classname, DefaultInstanceType(class_desc, options),
1035  DefaultInstanceName(class_desc, options));
1036  }
1037  }
1038 
1040  const Options& options) const {
1041  for (const auto& pair : classes_) {
1042  format(
1043  "template<> $dllexport_decl $"
1044  "$1$* Arena::CreateMaybeMessage<$1$>(Arena*);\n",
1045  QualifiedClassName(pair.second, options));
1046  }
1047  }
1048 
1049  private:
1050  std::map<std::string, const Descriptor*> classes_;
1051  std::map<std::string, const EnumDescriptor*> enums_;
1052 };
1053 
1054 static void PublicImportDFS(const FileDescriptor* fd,
1055  std::unordered_set<const FileDescriptor*>* fd_set) {
1056  for (int i = 0; i < fd->public_dependency_count(); i++) {
1057  const FileDescriptor* dep = fd->public_dependency(i);
1058  if (fd_set->insert(dep).second) PublicImportDFS(dep, fd_set);
1059  }
1060 }
1061 
1063  Formatter format(printer, variables_);
1064  std::vector<const Descriptor*> classes;
1065  std::vector<const EnumDescriptor*> enums;
1066 
1067  FlattenMessagesInFile(file_, &classes); // All messages need forward decls.
1068 
1069  if (options_.proto_h) { // proto.h needs extra forward declarations.
1070  // All classes / enums referred to as field members
1071  std::vector<const FieldDescriptor*> fields;
1073  for (int i = 0; i < fields.size(); i++) {
1074  classes.push_back(fields[i]->containing_type());
1075  classes.push_back(fields[i]->message_type());
1076  enums.push_back(fields[i]->enum_type());
1077  }
1079  }
1080 
1081  // Calculate the set of files whose definitions we get through include.
1082  // No need to forward declare types that are defined in these.
1083  std::unordered_set<const FileDescriptor*> public_set;
1084  PublicImportDFS(file_, &public_set);
1085 
1086  std::map<std::string, ForwardDeclarations> decls;
1087  for (int i = 0; i < classes.size(); i++) {
1088  const Descriptor* d = classes[i];
1089  if (d && !public_set.count(d->file()))
1090  decls[Namespace(d, options_)].AddMessage(d);
1091  }
1092  for (int i = 0; i < enums.size(); i++) {
1093  const EnumDescriptor* d = enums[i];
1094  if (d && !public_set.count(d->file()))
1095  decls[Namespace(d, options_)].AddEnum(d);
1096  }
1097 
1098  {
1099  NamespaceOpener ns(format);
1100  for (const auto& pair : decls) {
1101  ns.ChangeTo(pair.first);
1102  pair.second.Print(format, options_);
1103  }
1104  }
1105  format("PROTOBUF_NAMESPACE_OPEN\n");
1106  for (const auto& pair : decls) {
1107  pair.second.PrintTopLevelDecl(format, options_);
1108  }
1109  format("PROTOBUF_NAMESPACE_CLOSE\n");
1110 }
1111 
1112 void FileGenerator::GenerateTopHeaderGuard(io::Printer* printer, bool pb_h) {
1113  Formatter format(printer, variables_);
1114  // Generate top of header.
1115  format(
1116  "// Generated by the protocol buffer compiler. DO NOT EDIT!\n"
1117  "// source: $filename$\n"
1118  "\n"
1119  "#ifndef $1$\n"
1120  "#define $1$\n"
1121  "\n"
1122  "#include <limits>\n"
1123  "#include <string>\n",
1124  IncludeGuard(file_, pb_h, options_));
1125  if (!options_.opensource_runtime && !enum_generators_.empty()) {
1126  // Add header to provide std::is_integral for safe Enum_Name() function.
1127  format("#include <type_traits>\n");
1128  }
1129  format("\n");
1130 }
1131 
1132 void FileGenerator::GenerateBottomHeaderGuard(io::Printer* printer, bool pb_h) {
1133  Formatter format(printer, variables_);
1134  format("#endif // $GOOGLE_PROTOBUF$_INCLUDED_$1$\n",
1135  IncludeGuard(file_, pb_h, options_));
1136 }
1137 
1139  Formatter format(printer, variables_);
1141  IncludeFile("net/proto2/public/implicit_weak_message.h", printer);
1142  }
1143  if (HasWeakFields(file_, options_)) {
1145  IncludeFile("net/proto2/public/weak_field_map.h", printer);
1146  }
1149  IncludeFile("net/proto2/public/lazy_field.h", printer);
1150  }
1152  IncludeFile("net/proto2/public/wire_format_verify.h", printer);
1153  }
1154 
1156  // Verify the protobuf library header version is compatible with the protoc
1157  // version before going any further.
1158  IncludeFile("net/proto2/public/port_def.inc", printer);
1159  format(
1160  "#if PROTOBUF_VERSION < $1$\n"
1161  "#error This file was generated by a newer version of protoc which is\n"
1162  "#error incompatible with your Protocol Buffer headers. Please update\n"
1163  "#error your headers.\n"
1164  "#endif\n"
1165  "#if $2$ < PROTOBUF_MIN_PROTOC_VERSION\n"
1166  "#error This file was generated by an older version of protoc which "
1167  "is\n"
1168  "#error incompatible with your Protocol Buffer headers. Please\n"
1169  "#error regenerate this file with a newer version of protoc.\n"
1170  "#endif\n"
1171  "\n",
1172  PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC, // 1
1173  PROTOBUF_VERSION); // 2
1174  IncludeFile("net/proto2/public/port_undef.inc", printer);
1175  }
1176 
1177  // OK, it's now safe to #include other files.
1178  IncludeFile("net/proto2/io/public/coded_stream.h", printer);
1179  IncludeFile("net/proto2/public/arena.h", printer);
1180  IncludeFile("net/proto2/public/arenastring.h", printer);
1183  IncludeFile("net/proto2/public/inlined_string_field.h", printer);
1184  }
1186  IncludeFile("net/proto2/public/generated_message_bases.h", printer);
1187  }
1188  IncludeFile("net/proto2/public/generated_message_table_driven.h", printer);
1191  IncludeFile("net/proto2/public/generated_message_tctable_decl.h", printer);
1192  }
1193  IncludeFile("net/proto2/public/generated_message_util.h", printer);
1194  IncludeFile("net/proto2/public/metadata_lite.h", printer);
1195 
1197  IncludeFile("net/proto2/public/generated_message_reflection.h", printer);
1198  }
1199 
1200  if (!message_generators_.empty()) {
1202  IncludeFile("net/proto2/public/message.h", printer);
1203  } else {
1204  IncludeFile("net/proto2/public/message_lite.h", printer);
1205  }
1206  }
1208  // Open-source relies on unconditional includes of these.
1209  IncludeFileAndExport("net/proto2/public/repeated_field.h", printer);
1210  IncludeFileAndExport("net/proto2/public/extension_set.h", printer);
1211  } else {
1212  // Google3 includes these files only when they are necessary.
1214  IncludeFileAndExport("net/proto2/public/extension_set.h", printer);
1215  }
1216  if (HasRepeatedFields(file_)) {
1217  IncludeFileAndExport("net/proto2/public/repeated_field.h", printer);
1218  }
1220  IncludeFile("net/proto2/public/string_piece_field_support.h", printer);
1221  }
1222  if (HasCordFields(file_, options_)) {
1223  format("#include \"third_party/absl/strings/cord.h\"\n");
1224  }
1225  }
1226  if (HasMapFields(file_)) {
1227  IncludeFileAndExport("net/proto2/public/map.h", printer);
1229  IncludeFile("net/proto2/public/map_entry.h", printer);
1230  IncludeFile("net/proto2/public/map_field_inl.h", printer);
1231  } else {
1232  IncludeFile("net/proto2/public/map_entry_lite.h", printer);
1233  IncludeFile("net/proto2/public/map_field_lite.h", printer);
1234  }
1235  }
1236 
1237  if (HasEnumDefinitions(file_)) {
1239  IncludeFile("net/proto2/public/generated_enum_reflection.h", printer);
1240  } else {
1241  IncludeFile("net/proto2/public/generated_enum_util.h", printer);
1242  }
1243  }
1244 
1246  IncludeFile("net/proto2/public/service.h", printer);
1247  }
1248 
1250  IncludeFile("net/proto2/public/unknown_field_set.h", printer);
1251  }
1252 }
1253 
1255  const std::string& info_path) {
1256  Formatter format(printer, variables_);
1257  if (!info_path.empty() && !options_.annotation_pragma_name.empty() &&
1258  !options_.annotation_guard_name.empty()) {
1259  format.Set("guard", options_.annotation_guard_name);
1260  format.Set("pragma", options_.annotation_pragma_name);
1261  format.Set("info_path", info_path);
1262  format(
1263  "#ifdef $guard$\n"
1264  "#pragma $pragma$ \"$info_path$\"\n"
1265  "#endif // $guard$\n");
1266  }
1267 }
1268 
1270  Formatter format(printer, variables_);
1271  for (int i = 0; i < file_->dependency_count(); i++) {
1272  std::string basename = StripProto(file_->dependency(i)->name());
1273 
1274  // Do not import weak deps.
1275  if (IsDepWeak(file_->dependency(i))) continue;
1276 
1278  GetBootstrapBasename(options_, basename, &basename);
1279  }
1280 
1281  format("#include $1$\n",
1282  CreateHeaderInclude(basename + ".pb.h", file_->dependency(i)));
1283  }
1284 }
1285 
1287  io::Printer* printer) {
1288  Formatter format(printer, variables_);
1289  // Forward-declare the DescriptorTable because this is referenced by .pb.cc
1290  // files depending on this file.
1291  //
1292  // The TableStruct is also outputted in weak_message_field.cc, because the
1293  // weak fields must refer to table struct but cannot include the header.
1294  // Also it annotates extra weak attributes.
1295  // TODO(gerbens) make sure this situation is handled better.
1296  format(
1297  "\n"
1298  "// Internal implementation detail -- do not use these members.\n"
1299  "struct $dllexport_decl $$tablename$ {\n"
1300  // These tables describe how to serialize and parse messages. Used
1301  // for table driven code.
1302  " static const ::$proto_ns$::internal::ParseTableField entries[]\n"
1303  " PROTOBUF_SECTION_VARIABLE(protodesc_cold);\n"
1304  " static const ::$proto_ns$::internal::AuxiliaryParseTableField aux[]\n"
1305  " PROTOBUF_SECTION_VARIABLE(protodesc_cold);\n"
1306  " static const ::$proto_ns$::internal::ParseTable schema[$1$]\n"
1307  " PROTOBUF_SECTION_VARIABLE(protodesc_cold);\n"
1308  " static const ::$proto_ns$::internal::FieldMetadata field_metadata[];\n"
1309  " static const ::$proto_ns$::internal::SerializationTable "
1310  "serialization_table[];\n"
1311  " static const $uint32$ offsets[];\n"
1312  "};\n",
1313  std::max(size_t(1), message_generators_.size()));
1315  format(
1316  "$dllexport_decl $extern const ::$proto_ns$::internal::DescriptorTable "
1317  "$desc_table$;\n");
1318  }
1319 }
1320 
1322  Formatter format(printer, variables_);
1323  // Generate class definitions.
1324  for (int i = 0; i < message_generators_.size(); i++) {
1325  if (i > 0) {
1326  format("\n");
1328  format("\n");
1329  }
1330  message_generators_[i]->GenerateClassDefinition(printer);
1331  }
1332 }
1333 
1335  // Generate enum definitions.
1336  for (int i = 0; i < enum_generators_.size(); i++) {
1337  enum_generators_[i]->GenerateDefinition(printer);
1338  }
1339 }
1340 
1342  Formatter format(printer, variables_);
1344  // Generate service definitions.
1345  for (int i = 0; i < service_generators_.size(); i++) {
1346  if (i > 0) {
1347  format("\n");
1349  format("\n");
1350  }
1351  service_generators_[i]->GenerateDeclarations(printer);
1352  }
1353 
1354  format("\n");
1356  format("\n");
1357  }
1358 }
1359 
1361  // Declare extension identifiers. These are in global scope and so only
1362  // the global scope extensions.
1363  for (auto& extension_generator : extension_generators_) {
1364  if (extension_generator->IsScoped()) continue;
1365  extension_generator->GenerateDeclaration(printer);
1366  }
1367 }
1368 
1370  Formatter format(printer, variables_);
1371  // TODO(gerbens) remove pragmas when gcc is no longer used. Current version
1372  // of gcc fires a bogus error when compiled with strict-aliasing.
1373  format(
1374  "#ifdef __GNUC__\n"
1375  " #pragma GCC diagnostic push\n"
1376  " #pragma GCC diagnostic ignored \"-Wstrict-aliasing\"\n"
1377  "#endif // __GNUC__\n");
1378  // Generate class inline methods.
1379  for (int i = 0; i < message_generators_.size(); i++) {
1380  if (i > 0) {
1382  format("\n");
1383  }
1384  message_generators_[i]->GenerateInlineMethods(printer);
1385  }
1386  format(
1387  "#ifdef __GNUC__\n"
1388  " #pragma GCC diagnostic pop\n"
1389  "#endif // __GNUC__\n");
1390 
1391  for (int i = 0; i < message_generators_.size(); i++) {
1392  if (i > 0) {
1394  format("\n");
1395  }
1396  }
1397 }
1398 
1400  io::Printer* printer) {
1401  Formatter format(printer, variables_);
1402  // Emit GetEnumDescriptor specializations into google::protobuf namespace:
1403  if (HasEnumDefinitions(file_)) {
1404  format("\n");
1405  {
1406  NamespaceOpener proto_ns(ProtobufNamespace(options_), format);
1407  format("\n");
1408  for (int i = 0; i < enum_generators_.size(); i++) {
1409  enum_generators_[i]->GenerateGetEnumDescriptorSpecializations(printer);
1410  }
1411  format("\n");
1412  }
1413  }
1414 }
1415 
1416 } // namespace cpp
1417 } // namespace compiler
1418 } // namespace protobuf
1419 } // namespace google
google::protobuf::compiler::cpp::FileGenerator::ForwardDeclarations::enums_
std::map< std::string, const EnumDescriptor * > enums_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:1169
google::protobuf::compiler::cpp::IsBootstrapProto
bool IsBootstrapProto(const Options &options, const FileDescriptor *file)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:1268
google::protobuf::compiler::cpp::FileGenerator::scc_analyzer_
MessageSCCAnalyzer scc_analyzer_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h:187
descriptor_
string_view descriptor_
Definition: elf.cc:154
google::protobuf::compiler::cpp::HasGeneratedMethods
bool HasGeneratedMethods(const FileDescriptor *file, const Options &options)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h:362
http2_test_server.format
format
Definition: http2_test_server.py:118
google::protobuf::value
const Descriptor::ReservedRange value
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1954
google::protobuf::compiler::cpp::DefaultInstancePtr
std::string DefaultInstancePtr(const Descriptor *descriptor, const Options &options)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:377
absl::str_format_internal::LengthMod::j
@ j
google::protobuf::compiler::cpp::FieldName
std::string FieldName(const FieldDescriptor *field)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:416
google::protobuf::compiler::cpp::ProtobufNamespace
std::string ProtobufNamespace(const Options &options)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h:60
google::protobuf::compiler::cpp::FileGenerator::GenerateSource
void GenerateSource(io::Printer *printer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:651
google::protobuf::compiler::cpp::FileGenerator::GenerateHeader
void GenerateHeader(io::Printer *printer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:182
google::protobuf::compiler::cpp::StripProto
std::string StripProto(const std::string &filename)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:480
google::protobuf::compiler::cpp::FileGenerator::GenerateServiceDefinitions
void GenerateServiceDefinitions(io::Printer *printer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:1453
phone_pb2.message_type
message_type
Definition: phone_pb2.py:200
file_
FileDescriptorProto * file_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/annotation_test_util.cc:68
options
double_dict options[]
Definition: capstone_test.c:55
google::protobuf::compiler::cpp::FileGenerator::message_generators_
std::vector< std::unique_ptr< MessageGenerator > > message_generators_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h:193
google::protobuf::compiler::cpp::Options::kTCTableNever
@ kTCTableNever
Definition: protobuf/src/google/protobuf/compiler/cpp/cpp_options.h:81
google::protobuf::compiler::cpp::HasEnumDefinitions
static bool HasEnumDefinitions(const Descriptor *message_type)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:911
google::protobuf::compiler::cpp::NamespaceOpener
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h:706
google::protobuf::compiler::cpp::HasLazyFields
static bool HasLazyFields(const Descriptor *descriptor, const Options &options)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:771
google::protobuf::compiler::cpp::Options::profile_driven_inline_string
bool profile_driven_inline_string
Definition: protobuf/src/google/protobuf/compiler/cpp/cpp_options.h:73
FileDescriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:128
GOOGLE_CHECK_EQ
#define GOOGLE_CHECK_EQ(A, B)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/logging.h:156
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
google::protobuf::compiler::cpp::FileGenerator::DoIncludeFile
void DoIncludeFile(const std::string &google3_name, bool do_export, io::Printer *printer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:328
google::protobuf::compiler::cpp::FileGenerator::GenerateDependencyIncludes
void GenerateDependencyIncludes(io::Printer *printer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:1381
google::protobuf::compiler::cpp::FileGenerator::GenerateProto2NamespaceEnumSpecializations
void GenerateProto2NamespaceEnumSpecializations(io::Printer *printer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:1511
google::protobuf::compiler::cpp::FileGenerator::IncludeFile
void IncludeFile(const std::string &google3_name, io::Printer *printer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h:95
google::protobuf::compiler::cpp::FileGenerator::extension_generators_
std::vector< std::unique_ptr< ExtensionGenerator > > extension_generators_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h:196
file
Definition: bloaty/third_party/zlib/examples/gzappend.c:170
google::protobuf::compiler::cpp::FileGenerator::service_generators_
std::vector< std::unique_ptr< ServiceGenerator > > service_generators_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h:195
google::protobuf::CEscape
string CEscape(const string &src)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:615
grpc::protobuf::io::Printer
GRPC_CUSTOM_PRINTER Printer
Definition: src/compiler/config.h:54
google::protobuf
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:12
google::protobuf::compiler::cpp::FileGenerator::GenerateExtensionIdentifiers
void GenerateExtensionIdentifiers(io::Printer *printer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:1472
instance
RefCountedPtr< grpc_tls_certificate_provider > instance
Definition: xds_server_config_fetcher.cc:224
google::protobuf::compiler::cpp::QualifiedClassName
std::string QualifiedClassName(const Descriptor *d, const Options &options)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:320
gen_header_frame.vals
list vals
Definition: gen_header_frame.py:73
google::protobuf::compiler::cpp::FileGenerator::CrossFileReferences::weak_default_instances
std::unordered_set< const Descriptor * > weak_default_instances
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:465
setup.name
name
Definition: setup.py:542
google::protobuf::compiler::cpp::Options::force_inline_string
bool force_inline_string
Definition: protobuf/src/google/protobuf/compiler/cpp/cpp_options.h:74
google::protobuf::compiler::cpp::IsStringInlined
bool IsStringInlined(const FieldDescriptor *descriptor, const Options &options)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:752
check_documentation.path
path
Definition: check_documentation.py:57
second
StrT second
Definition: cxa_demangle.cpp:4885
google::protobuf::compiler::cpp::FileGenerator::ForwardDeclarations::AddEnum
void AddEnum(const EnumDescriptor *d)
Definition: protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:1016
google::protobuf::compiler::cpp::FileGenerator::GenerateTables
void GenerateTables(io::Printer *printer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:1021
google::protobuf::compiler::cpp::UniqueName
string UniqueName(const std::string &name, const std::string &filename, const Options &options)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:712
google::protobuf::compiler::cpp::FileGenerator::GenerateSourceDefaultInstance
void GenerateSourceDefaultInstance(int idx, io::Printer *printer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:438
T
#define T(upbtypeconst, upbtype, ctype, default_value)
Descriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:121
versiongenerate.file_data
string file_data
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/xcode/Scripts/versiongenerate.py:84
google::protobuf::compiler::cpp::HasMapFields
static bool HasMapFields(const Descriptor *descriptor)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:892
google::protobuf::compiler::cpp::FlattenMessagesInFile
void FlattenMessagesInFile(const FileDescriptor *file, std::vector< const Descriptor * > *result)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:1103
google::protobuf::compiler::cpp::IsWeak
bool IsWeak(const FieldDescriptor *field, const Options &options)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h:300
google::protobuf::compiler::cpp::FileGenerator::GeneratePBHeader
void GeneratePBHeader(io::Printer *printer, const std::string &info_path)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:283
google::protobuf::compiler::cpp::HasWeakFields
bool HasWeakFields(const Descriptor *descriptor, const Options &options)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:1110
google::protobuf::compiler::cpp::FileGenerator::file_
const FileDescriptor * file_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h:184
FieldDescriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:133
google::protobuf::compiler::cpp::FileDllExport
std::string FileDllExport(const FileDescriptor *file, const Options &options)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:398
google::protobuf::compiler::cpp::FileGenerator::ForwardDeclarations::AddMessage
void AddMessage(const Descriptor *d)
Definition: protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:1015
google::protobuf::compiler::cpp::HasStringPieceFields
static bool HasStringPieceFields(const Descriptor *descriptor, const Options &options)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:832
refs
std::vector< CordRep * > refs
Definition: cordz_info_statistics_test.cc:81
google::protobuf::compiler::cpp::UsingImplicitWeakFields
bool UsingImplicitWeakFields(const FileDescriptor *file, const Options &options)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:1124
google::protobuf::compiler::cpp::HasSimpleBaseClasses
bool HasSimpleBaseClasses(const FileDescriptor *file, const Options &options)
Definition: protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h:662
google::protobuf::compiler::cpp::FileGenerator::CrossFileReferences::weak_reflection_files
std::unordered_set< const FileDescriptor * > weak_reflection_files
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:469
google::protobuf::compiler::cpp::FileGenerator::GenerateMessageDefinitions
void GenerateMessageDefinitions(io::Printer *printer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:1433
google::protobuf::compiler::cpp::FileGenerator::ForwardDeclarations::Print
void Print(const Formatter &format, const Options &options) const
Definition: protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:1018
grpc_version.PROTOBUF_VERSION
string PROTOBUF_VERSION
Definition: tools/distrib/python/grpc_version.py:18
google::protobuf::compiler::cpp::FileGenerator::GenerateMetadataPragma
void GenerateMetadataPragma(io::Printer *printer, const std::string &info_path)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:1366
google::protobuf::compiler::cpp::FileGenerator::GenerateGlobalStateFunctionDeclarations
void GenerateGlobalStateFunctionDeclarations(io::Printer *printer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:1398
max
int max
Definition: bloaty/third_party/zlib/examples/enough.c:170
google::protobuf::compiler::cpp::PublicImportDFS
static void PublicImportDFS(const FileDescriptor *fd, std::unordered_set< const FileDescriptor * > *fd_set)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:1172
google::protobuf::compiler::cpp::FileGenerator::FileGenerator
FileGenerator(const FileDescriptor *file, const Options &options)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:94
google::protobuf::compiler::cpp::Options::lite_implicit_weak_fields
bool lite_implicit_weak_fields
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_options.h:61
google::protobuf::compiler::cpp::IsImplicitWeakField
bool IsImplicitWeakField(const FieldDescriptor *field, const Options &options, MessageSCCAnalyzer *scc_analyzer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:1130
google::protobuf::FileDescriptor::public_dependency_count
int public_dependency_count() const
google::protobuf::compiler::cpp::FileGenerator::options_
const Options options_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h:185
google::protobuf::compiler::cpp::Options::tctable_mode
enum google::protobuf::compiler::cpp::Options::@466 tctable_mode
google::protobuf::compiler::cpp::FileGenerator::GenerateBottomHeaderGuard
void GenerateBottomHeaderGuard(io::Printer *printer, bool pb_h)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:1251
google::protobuf::compiler::cpp::Options::proto_h
bool proto_h
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_options.h:55
google::protobuf::compiler::cpp::FileGenerator::CreateHeaderInclude
std::string CreateHeaderInclude(const std::string &basename, const FileDescriptor *file)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:357
google::protobuf::compiler::cpp::DefaultInstanceType
std::string DefaultInstanceType(const Descriptor *descriptor, const Options &options)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:367
google::protobuf::compiler::cpp::FileGenerator::GenerateInlineFunctionDefinitions
void GenerateInlineFunctionDefinitions(io::Printer *printer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:1481
google::protobuf::compiler::cpp::DescriptorTableName
std::string DescriptorTableName(const FileDescriptor *file, const Options &options)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:393
google::protobuf::compiler::cpp::UseUnknownFieldSet
bool UseUnknownFieldSet(const FileDescriptor *file, const Options &options)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h:295
google::protobuf::compiler::cpp::FileGenerator::IsDepWeak
bool IsDepWeak(const FileDescriptor *dep) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h:173
google::protobuf::compiler::cpp::Options::table_driven_serialization
bool table_driven_serialization
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_options.h:60
phone_pb2.containing_type
containing_type
Definition: phone_pb2.py:199
cpp
Definition: third_party/bloaty/third_party/googletest/googlemock/scripts/generator/cpp/__init__.py:1
google::protobuf::compiler::cpp::SetCommonVars
void SetCommonVars(const Options &options, std::map< std::string, std::string > *variables)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:210
FileDescriptorProto
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:501
google::protobuf::compiler::cpp::Options
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_options.h:52
b
uint64_t b
Definition: abseil-cpp/absl/container/internal/layout_test.cc:53
google::protobuf::compiler::cpp::GetBootstrapBasename
bool GetBootstrapBasename(const Options &options, const std::string &basename, std::string *bootstrap_basename)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:1244
google::protobuf::compiler::cpp::IncludeGuard
std::string IncludeGuard(const FileDescriptor *file, bool pb_h, const Options &options)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h:449
EnumDescriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:143
google::protobuf::compiler::cpp::FileGenerator::GenerateTopHeaderGuard
void GenerateTopHeaderGuard(io::Printer *printer, bool pb_h)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:1231
google::protobuf::compiler::cpp::HasDescriptorMethods
bool HasDescriptorMethods(const FileDescriptor *file, const Options &options)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h:368
google::protobuf::compiler::cpp::ListAllFields
void ListAllFields(const Descriptor *d, std::vector< const FieldDescriptor * > *fields)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:1204
setup.idx
idx
Definition: third_party/bloaty/third_party/capstone/bindings/python/setup.py:197
msg
std::string msg
Definition: client_interceptors_end2end_test.cc:372
google::protobuf::FileDescriptor::CopyTo
void CopyTo(FileDescriptorProto *proto) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.cc:1990
google::protobuf::io::Printer
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/printer.h:181
google::protobuf::compiler::cpp::Options::opensource_runtime
bool opensource_runtime
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_options.h:63
google::protobuf::compiler::cpp::HasCordFields
static bool HasCordFields(const Descriptor *descriptor, const Options &options)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:855
google::protobuf::compiler::cpp::kThickSeparator
const char kThickSeparator[]
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:273
google::protobuf::compiler::cpp::Namespace
std::string Namespace(const std::string &package)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:337
google::protobuf::FileDescriptor::name
const std::string & name() const
google::protobuf::compiler::cpp::IsWellKnownMessage
bool IsWellKnownMessage(const FileDescriptor *file)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:968
field
const FieldDescriptor * field
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/parser_unittest.cc:2692
google::protobuf::compiler::cpp::Options::annotation_guard_name
std::string annotation_guard_name
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_options.h:68
google::protobuf::compiler::cpp::FileGenerator::enum_generators_
std::vector< std::unique_ptr< EnumGenerator > > enum_generators_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h:194
google::protobuf::StringReplace
void StringReplace(const string &s, const string &oldsub, const string &newsub, bool replace_all, string *res)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:148
options_
DebugStringOptions options_
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.cc:2390
google::protobuf::compiler::cpp::HasGenericServices
bool HasGenericServices(const FileDescriptor *file, const Options &options)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h:374
classes
static const struct nv classes[]
Definition: adig.c:75
count
int * count
Definition: bloaty/third_party/googletest/googlemock/test/gmock_stress_test.cc:96
google::protobuf::compiler::cpp::FileGenerator::GenerateMacroUndefs
void GenerateMacroUndefs(io::Printer *printer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:151
google::protobuf::compiler::cpp::DefaultInstanceName
std::string DefaultInstanceName(const Descriptor *descriptor, const Options &options)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:372
google::protobuf::compiler::cpp::FileGenerator::GetCrossFileReferencesForField
void GetCrossFileReferencesForField(const FieldDescriptor *field, CrossFileReferences *refs)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:472
google::protobuf::FileDescriptor::dependency
const FileDescriptor * dependency(int index) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.cc:7235
google::protobuf::FileDescriptor::service_count
int service_count() const
profile_analyzer.fields
list fields
Definition: profile_analyzer.py:266
google::protobuf::compiler::cpp::FileGenerator::CrossFileReferences::strong_reflection_files
std::unordered_set< const FileDescriptor * > strong_reflection_files
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:468
google::protobuf::compiler::cpp::HasExtensionsOrExtendableMessage
static bool HasExtensionsOrExtendableMessage(const Descriptor *descriptor)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:873
google::protobuf::compiler::cpp::FileGenerator::GenerateGlobalSource
void GenerateGlobalSource(io::Printer *printer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:614
google::protobuf::compiler::cpp::FileGenerator::GenerateProtoHeader
void GenerateProtoHeader(io::Printer *printer, const std::string &info_path)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:245
google::protobuf::compiler::cpp::EscapeTrigraphs
std::string EscapeTrigraphs(const std::string &to_escape)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:728
GOOGLE_ARRAYSIZE
#define GOOGLE_ARRAYSIZE(a)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/macros.h:88
prefix
static const char prefix[]
Definition: head_of_line_blocking.cc:28
google::protobuf::compiler::cpp::FileGenerator::ForwardDeclarations::PrintTopLevelDecl
void PrintTopLevelDecl(const Formatter &format, const Options &options) const
Definition: protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:1039
google::protobuf::compiler::cpp::FileGenerator::variables_
std::map< std::string, std::string > variables_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h:189
google::protobuf::compiler::cpp::ClassName
std::string ClassName(const Descriptor *descriptor)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:302
google::protobuf::compiler::cpp::HasRepeatedFields
static bool HasRepeatedFields(const Descriptor *descriptor)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:807
google::protobuf::compiler::cpp::FileGenerator::GenerateReflectionInitializationCode
void GenerateReflectionInitializationCode(io::Printer *printer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:734
GOOGLE_CHECK
#define GOOGLE_CHECK(EXPRESSION)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/logging.h:153
google::protobuf::Descriptor
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:231
google::protobuf::compiler::cpp::FileGenerator::GenerateSourceForMessage
void GenerateSourceForMessage(int idx, io::Printer *printer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:567
google::protobuf::compiler::cpp::ForEachField
void ForEachField(const Descriptor *d, T &&func)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h:566
google::protobuf::compiler::cpp::FileGenerator::weak_deps_
std::set< const FileDescriptor * > weak_deps_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h:181
google::protobuf::compiler::cpp::ListAllTypesForServices
void ListAllTypesForServices(const FileDescriptor *fd, std::vector< const Descriptor * > *types)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:1232
google::protobuf::FileDescriptor
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1320
google::protobuf::compiler::cpp::FileGenerator::~FileGenerator
~FileGenerator()
ns
static int64_t ns
Definition: bloaty/third_party/re2/util/benchmark.cc:43
google::protobuf::compiler::cpp::Options::annotation_pragma_name
std::string annotation_pragma_name
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_options.h:67
google::protobuf::compiler::cpp::FileGenerator::GenerateForwardDeclarations
void GenerateForwardDeclarations(io::Printer *printer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:1180
google::protobuf::compiler::cpp::Options::table_driven_parsing
bool table_driven_parsing
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_options.h:59
google::protobuf::compiler::cpp::Options::transitive_pb_h
bool transitive_pb_h
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_options.h:56
google::protobuf::compiler::cpp::FileGenerator::GenerateEnumDefinitions
void GenerateEnumDefinitions(io::Printer *printer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:1446
google::protobuf::compiler::cpp::kThinSeparator
const char kThinSeparator[]
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:275
google::protobuf::compiler::cpp::FileGenerator::ForwardDeclarations::classes_
std::map< std::string, const Descriptor * > classes_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:1168
google::protobuf::compiler::cpp::FileGenerator::GenerateSourceForExtension
void GenerateSourceForExtension(int idx, io::Printer *printer)
Definition: protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:594
google::protobuf::EnumDescriptor
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:918
google::protobuf::compiler::cpp::FileGenerator::GenerateSourceIncludes
void GenerateSourceIncludes(io::Printer *printer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:381
phone_pb2.enum_type
enum_type
Definition: phone_pb2.py:198
google::protobuf::compiler::cpp::ShouldVerify
bool ShouldVerify(const Descriptor *descriptor, const Options &options, MessageSCCAnalyzer *scc_analyzer)
Definition: protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:954
google::protobuf::FileDescriptor::public_dependency
const FileDescriptor * public_dependency(int index) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:2166
google::protobuf::compiler::cpp::FileGenerator::GenerateInternalForwardDeclarations
void GenerateInternalForwardDeclarations(const CrossFileReferences &refs, io::Printer *printer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:508
descriptor
static const char descriptor[1336]
Definition: certs.upbdefs.c:16
pair
std::pair< std::string, std::string > pair
Definition: abseil-cpp/absl/container/internal/raw_hash_set_benchmark.cc:78
google::protobuf::compiler::cpp::FileGenerator::GetCrossFileReferencesForFile
void GetCrossFileReferencesForFile(const FileDescriptor *file, CrossFileReferences *refs)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:489
google::protobuf::compiler::cpp::FileGenerator::GenerateLibraryIncludes
void GenerateLibraryIncludes(io::Printer *printer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc:1257
compiler
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/plugin.pb.cc:21
google
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:11
fix_build_deps.dep
string dep
Definition: fix_build_deps.py:439
google::protobuf::compiler::cpp::Options::runtime_include_base
std::string runtime_include_base
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_options.h:65
google::protobuf::compiler::cpp::Formatter
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h:637
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
google::protobuf::FileDescriptor::dependency_count
int dependency_count() const
offset
voidpf uLong offset
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:142
framework.helpers.highlighter.Formatter
Formatter
Definition: highlighter.py:53
google::protobuf::compiler::cpp::FileGenerator::IncludeFileAndExport
void IncludeFileAndExport(const std::string &google3_name, io::Printer *printer)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h:98


grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:05