protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.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 #ifndef _MSC_VER
32 #include <unistd.h>
33 #endif
34 #include <climits>
35 #include <errno.h>
36 #include <fcntl.h>
37 #include <fstream>
38 #include <iostream>
39 #include <sstream>
40 #include <stdlib.h>
41 #include <unordered_set>
42 #include <vector>
43 
44 #include <google/protobuf/compiler/code_generator.h>
45 #include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
46 #include <google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h>
47 #include <google/protobuf/descriptor.pb.h>
48 #include <google/protobuf/io/coded_stream.h>
49 #include <google/protobuf/io/printer.h>
50 #include <google/protobuf/io/zero_copy_stream_impl.h>
51 #include <google/protobuf/io/io_win32.h>
52 #include <google/protobuf/port.h>
53 #include <google/protobuf/stubs/common.h>
54 #include <google/protobuf/stubs/strutil.h>
55 
56 // NOTE: src/google/protobuf/compiler/plugin.cc makes use of cerr for some
57 // error cases, so it seems to be ok to use as a back door for errors.
58 
59 namespace google {
60 namespace protobuf {
61 namespace compiler {
62 namespace objectivec {
63 
64 // <io.h> is transitively included in this file. Import the functions explicitly
65 // in this port namespace to avoid ambiguous definition.
66 namespace posix {
67 #ifdef _WIN32
69 #else
71 #endif
72 } // namespace port
73 
74 namespace {
75 
76 class SimpleLineCollector : public LineConsumer {
77  public:
78  SimpleLineCollector(std::unordered_set<std::string>* inout_set)
79  : set_(inout_set) {}
80 
81  virtual bool ConsumeLine(const StringPiece& line, std::string* out_error) override {
82  set_->insert(std::string(line));
83  return true;
84  }
85 
86  private:
87  std::unordered_set<std::string>* set_;
88 };
89 
90 class PrefixModeStorage {
91  public:
92  PrefixModeStorage();
93 
94  bool use_package_name() const { return use_package_name_; }
95  void set_use_package_name(bool on_or_off) { use_package_name_ = on_or_off; }
96 
97  const std::string exception_path() const { return exception_path_; }
98  void set_exception_path(const std::string& path) {
100  exceptions_.clear();
101  }
102 
103  bool is_package_exempted(const std::string& package);
104 
105  private:
108  std::unordered_set<std::string> exceptions_;
109 };
110 
111 PrefixModeStorage::PrefixModeStorage() {
112  // Even thought there are generation options, have an env back door since some
113  // of these helpers could be used in other plugins.
114 
115  const char* use_package_cstr = getenv("GPB_OBJC_USE_PACKAGE_AS_PREFIX");
117  (use_package_cstr && (std::string("YES") == ToUpper(use_package_cstr)));
118 
119  const char* exception_path = getenv("GPB_OBJC_PACKAGE_PREFIX_EXCEPTIONS_PATH");
120  if (exception_path) {
121  exception_path_ = exception_path;
122  }
123 }
124 
125 bool PrefixModeStorage::is_package_exempted(const std::string& package) {
126  if (exceptions_.empty() && !exception_path_.empty()) {
127  std::string error_str;
128  SimpleLineCollector collector(&exceptions_);
129  if (!ParseSimpleFile(exception_path_, &collector, &error_str)) {
130  if (error_str.empty()) {
131  error_str = std::string("protoc:0: warning: Failed to parse")
132  + std::string(" package prefix exceptions file: ")
133  + exception_path_;
134  }
135  std::cerr << error_str << std::endl;
136  std::cerr.flush();
137  exceptions_.clear();
138  }
139 
140  // If the file was empty put something in it so it doesn't get reloaded over
141  // and over.
142  if (exceptions_.empty()) {
143  exceptions_.insert("<not a real package>");
144  }
145  }
146 
147  return exceptions_.count(package) != 0;
148 }
149 
150 PrefixModeStorage g_prefix_mode;
151 
152 } // namespace
153 
155  return g_prefix_mode.use_package_name();
156 }
157 
158 void SetUseProtoPackageAsDefaultPrefix(bool on_or_off) {
159  g_prefix_mode.set_use_package_name(on_or_off);
160 }
161 
163  return g_prefix_mode.exception_path();
164 }
165 
167  g_prefix_mode.set_exception_path(file_path);
168 }
169 
171  // Default is the value of the env for the package prefixes.
172  const char* file_path = getenv("GPB_OBJC_EXPECTED_PACKAGE_PREFIXES");
173  if (file_path) {
174  expected_prefixes_path = file_path;
175  }
176  const char* suppressions = getenv("GPB_OBJC_EXPECTED_PACKAGE_PREFIXES_SUPPRESSIONS");
177  if (suppressions) {
179  Split(suppressions, ";", true);
180  }
182  require_prefixes = false;
183 }
184 
185 namespace {
186 
187 std::unordered_set<std::string> MakeWordsMap(const char* const words[],
188  size_t num_words) {
189  std::unordered_set<std::string> result;
190  for (int i = 0; i < num_words; i++) {
191  result.insert(words[i]);
192  }
193  return result;
194 }
195 
196 const char* const kUpperSegmentsList[] = {"url", "http", "https"};
197 
198 std::unordered_set<std::string> kUpperSegments =
199  MakeWordsMap(kUpperSegmentsList, GOOGLE_ARRAYSIZE(kUpperSegmentsList));
200 
201 bool ascii_isnewline(char c) {
202  return c == '\n' || c == '\r';
203 }
204 
205 // Internal helper for name handing.
206 // Do not expose this outside of helpers, stick to having functions for specific
207 // cases (ClassName(), FieldName()), so there is always consistent suffix rules.
209  bool first_capitalized) {
210  std::vector<std::string> values;
211  std::string current;
212 
213  bool last_char_was_number = false;
214  bool last_char_was_lower = false;
215  bool last_char_was_upper = false;
216  for (int i = 0; i < input.size(); i++) {
217  char c = input[i];
218  if (ascii_isdigit(c)) {
219  if (!last_char_was_number) {
220  values.push_back(current);
221  current = "";
222  }
223  current += c;
224  last_char_was_number = last_char_was_lower = last_char_was_upper = false;
225  last_char_was_number = true;
226  } else if (ascii_islower(c)) {
227  // lowercase letter can follow a lowercase or uppercase letter
228  if (!last_char_was_lower && !last_char_was_upper) {
229  values.push_back(current);
230  current = "";
231  }
232  current += c; // already lower
233  last_char_was_number = last_char_was_lower = last_char_was_upper = false;
234  last_char_was_lower = true;
235  } else if (ascii_isupper(c)) {
236  if (!last_char_was_upper) {
237  values.push_back(current);
238  current = "";
239  }
240  current += ascii_tolower(c);
241  last_char_was_number = last_char_was_lower = last_char_was_upper = false;
242  last_char_was_upper = true;
243  } else {
244  last_char_was_number = last_char_was_lower = last_char_was_upper = false;
245  }
246  }
247  values.push_back(current);
248 
250  bool first_segment_forces_upper = false;
251  for (std::vector<std::string>::iterator i = values.begin(); i != values.end();
252  ++i) {
253  std::string value = *i;
254  bool all_upper = (kUpperSegments.count(value) > 0);
255  if (all_upper && (result.length() == 0)) {
256  first_segment_forces_upper = true;
257  }
258  for (int j = 0; j < value.length(); j++) {
259  if (j == 0 || all_upper) {
260  value[j] = ascii_toupper(value[j]);
261  } else {
262  // Nothing, already in lower.
263  }
264  }
265  result += value;
266  }
267  if ((result.length() != 0) &&
268  !first_capitalized &&
269  !first_segment_forces_upper) {
270  result[0] = ascii_tolower(result[0]);
271  }
272  return result;
273 }
274 
275 const char* const kReservedWordList[] = {
276  // Note NSObject Methods:
277  // These are brought in from objectivec_nsobject_methods.h that is generated
278  // using method_dump.sh. See kNSObjectMethods below.
279 
280  // Objective C "keywords" that aren't in C
281  // From
282  // http://stackoverflow.com/questions/1873630/reserved-keywords-in-objective-c
283  // with some others added on.
284  "id", "_cmd", "super", "in", "out", "inout", "bycopy", "byref", "oneway",
285  "self", "instancetype", "nullable", "nonnull", "nil", "Nil",
286  "YES", "NO", "weak",
287 
288  // C/C++ keywords (Incl C++ 0x11)
289  // From http://en.cppreference.com/w/cpp/keywords
290  "and", "and_eq", "alignas", "alignof", "asm", "auto", "bitand", "bitor",
291  "bool", "break", "case", "catch", "char", "char16_t", "char32_t", "class",
292  "compl", "const", "constexpr", "const_cast", "continue", "decltype",
293  "default", "delete", "double", "dynamic_cast", "else", "enum", "explicit",
294  "export", "extern ", "false", "float", "for", "friend", "goto", "if",
295  "inline", "int", "long", "mutable", "namespace", "new", "noexcept", "not",
296  "not_eq", "nullptr", "operator", "or", "or_eq", "private", "protected",
297  "public", "register", "reinterpret_cast", "return", "short", "signed",
298  "sizeof", "static", "static_assert", "static_cast", "struct", "switch",
299  "template", "this", "thread_local", "throw", "true", "try", "typedef",
300  "typeid", "typename", "union", "unsigned", "using", "virtual", "void",
301  "volatile", "wchar_t", "while", "xor", "xor_eq",
302 
303  // C99 keywords
304  // From
305  // http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Fkeyw.htm
306  "restrict",
307 
308  // GCC/Clang extension
309  "typeof",
310 
311  // Not a keyword, but will break you
312  "NULL",
313 
314  // C88+ specs call for these to be macros, so depending on what they are
315  // defined to be it can lead to odd errors for some Xcode/SDK versions.
316  "stdin", "stdout", "stderr",
317 
318  // Objective-C Runtime typedefs
319  // From <obc/runtime.h>
320  "Category", "Ivar", "Method", "Protocol",
321 
322  // GPBMessage Methods
323  // Only need to add instance methods that may conflict with
324  // method declared in protos. The main cases are methods
325  // that take no arguments, or setFoo:/hasFoo: type methods.
326  "clear", "data", "delimitedData", "descriptor", "extensionRegistry",
327  "extensionsCurrentlySet", "initialized", "isInitialized", "serializedSize",
328  "sortedExtensionsInUse", "unknownFields",
329 
330  // MacTypes.h names
331  "Fixed", "Fract", "Size", "LogicalAddress", "PhysicalAddress", "ByteCount",
332  "ByteOffset", "Duration", "AbsoluteTime", "OptionBits", "ItemCount",
333  "PBVersion", "ScriptCode", "LangCode", "RegionCode", "OSType",
334  "ProcessSerialNumber", "Point", "Rect", "FixedPoint", "FixedRect", "Style",
335  "StyleParameter", "StyleField", "TimeScale", "TimeBase", "TimeRecord",
336 };
337 
338 // returns true is input starts with __ or _[A-Z] which are reserved identifiers
339 // in C/ C++. All calls should go through UnderscoresToCamelCase before getting here
340 // but this verifies and allows for future expansion if we decide to redefine what a
341 // reserved C identifier is (for example the GNU list
342 // https://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html )
343 bool IsReservedCIdentifier(const std::string& input) {
344  if (input.length() > 2) {
345  if (input.at(0) == '_') {
346  if (isupper(input.at(1)) || input.at(1) == '_') {
347  return true;
348  }
349  }
350  }
351  return false;
352 }
353 
354 std::string SanitizeNameForObjC(const std::string& prefix,
355  const std::string& input,
356  const std::string& extension,
357  std::string* out_suffix_added) {
358  static const std::unordered_set<std::string> kReservedWords =
359  MakeWordsMap(kReservedWordList, GOOGLE_ARRAYSIZE(kReservedWordList));
360  static const std::unordered_set<std::string> kNSObjectMethods =
362  std::string sanitized;
363  // We add the prefix in the cases where the string is missing a prefix.
364  // We define "missing a prefix" as where 'input':
365  // a) Doesn't start with the prefix or
366  // b) Isn't equivalent to the prefix or
367  // c) Has the prefix, but the letter after the prefix is lowercase
368  if (HasPrefixString(input, prefix)) {
369  if (input.length() == prefix.length() || !ascii_isupper(input[prefix.length()])) {
370  sanitized = prefix + input;
371  } else {
372  sanitized = input;
373  }
374  } else {
375  sanitized = prefix + input;
376  }
377  if (IsReservedCIdentifier(sanitized) ||
378  (kReservedWords.count(sanitized) > 0) ||
379  (kNSObjectMethods.count(sanitized) > 0)) {
380  if (out_suffix_added) *out_suffix_added = extension;
381  return sanitized + extension;
382  }
383  if (out_suffix_added) out_suffix_added->clear();
384  return sanitized;
385 }
386 
387 std::string NameFromFieldDescriptor(const FieldDescriptor* field) {
388  if (field->type() == FieldDescriptor::TYPE_GROUP) {
389  return field->message_type()->name();
390  } else {
391  return field->name();
392  }
393 }
394 
395 void PathSplit(const std::string& path, std::string* directory,
396  std::string* basename) {
397  std::string::size_type last_slash = path.rfind('/');
398  if (last_slash == std::string::npos) {
399  if (directory) {
400  *directory = "";
401  }
402  if (basename) {
403  *basename = path;
404  }
405  } else {
406  if (directory) {
407  *directory = path.substr(0, last_slash);
408  }
409  if (basename) {
410  *basename = path.substr(last_slash + 1);
411  }
412  }
413 }
414 
415 bool IsSpecialName(const std::string& name, const std::string* special_names,
416  size_t count) {
417  for (size_t i = 0; i < count; ++i) {
418  size_t length = special_names[i].length();
419  if (name.compare(0, length, special_names[i]) == 0) {
420  if (name.length() > length) {
421  // If name is longer than the retained_name[i] that it matches
422  // the next character must be not lower case (newton vs newTon vs
423  // new_ton).
424  return !ascii_islower(name[length]);
425  } else {
426  return true;
427  }
428  }
429  }
430  return false;
431 }
432 
433 std::string GetZeroEnumNameForFlagType(const FlagType flag_type) {
434  switch(flag_type) {
436  return "GPBDescriptorInitializationFlag_None";
437  case FLAGTYPE_EXTENSION:
438  return "GPBExtensionNone";
439  case FLAGTYPE_FIELD:
440  return "GPBFieldNone";
441  default:
442  GOOGLE_LOG(FATAL) << "Can't get here.";
443  return "0";
444  }
445 }
446 
447 std::string GetEnumNameForFlagType(const FlagType flag_type) {
448  switch(flag_type) {
450  return "GPBDescriptorInitializationFlags";
451  case FLAGTYPE_EXTENSION:
452  return "GPBExtensionOptions";
453  case FLAGTYPE_FIELD:
454  return "GPBFieldFlags";
455  default:
456  GOOGLE_LOG(FATAL) << "Can't get here.";
457  return std::string();
458  }
459 }
460 
461 void MaybeUnQuote(StringPiece* input) {
462  if ((input->length() >= 2) &&
463  ((*input->data() == '\'' || *input->data() == '"')) &&
464  ((*input)[input->length() - 1] == *input->data())) {
465  input->remove_prefix(1);
466  input->remove_suffix(1);
467  }
468 }
469 
470 } // namespace
471 
472 // Escape C++ trigraphs by escaping question marks to \?
474  return StringReplace(to_escape, "?", "\\?", true);
475 }
476 
478  while (!input->empty() && ascii_isspace(*input->data())) {
479  input->remove_prefix(1);
480  }
481  while (!input->empty() && ascii_isspace((*input)[input->length() - 1])) {
482  input->remove_suffix(1);
483  }
484 }
485 
487  // List of prefixes from
488  // http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html
489  static const std::string retained_names[] = {"new", "alloc", "copy",
490  "mutableCopy"};
491  return IsSpecialName(name, retained_names,
492  sizeof(retained_names) / sizeof(retained_names[0]));
493 }
494 
496  static const std::string init_names[] = {"init"};
497  return IsSpecialName(name, init_names,
498  sizeof(init_names) / sizeof(init_names[0]));
499 }
500 
502  std::string basename;
503  PathSplit(file->name(), NULL, &basename);
504  return basename;
505 }
506 
508  // Always honor the file option.
509  if (file->options().has_objc_class_prefix()) {
510  return file->options().objc_class_prefix();
511  }
512 
513  // If package prefix isn't enabled or no package, done.
514  if (!g_prefix_mode.use_package_name() || file->package().empty()) {
515  return "";
516  }
517 
518  // If the package is in the exceptions list, done.
519  if (g_prefix_mode.is_package_exempted(file->package())) {
520  return "";
521  }
522 
523  // Transform the package into a prefix: use the dot segments as part,
524  // camelcase each one and then join them with underscores, and add an
525  // underscore at the end.
527  const std::vector<std::string> segments = Split(file->package(), ".", true);
528  for (const auto& segment : segments) {
529  const std::string part = UnderscoresToCamelCase(segment, true);
530  if (part.empty()) {
531  continue;
532  }
533  if (!result.empty()) {
534  result.append("_");
535  }
536  result.append(part);
537  }
538  if (!result.empty()) {
539  result.append("_");
540  }
541  return result;
542 }
543 
546  std::string basename;
548  PathSplit(file->name(), &directory, &basename);
549  if (directory.length() > 0) {
550  output = directory + "/";
551  }
552  basename = StripProto(basename);
553 
554  // CamelCase to be more ObjC friendly.
555  basename = UnderscoresToCamelCase(basename, true);
556 
557  output += basename;
558  return output;
559 }
560 
563  std::string basename;
565  PathSplit(file->name(), &directory, &basename);
566  basename = StripProto(basename);
567 
568  // CamelCase to be more ObjC friendly.
569  output = UnderscoresToCamelCase(basename, true);
570 
571  return output;
572 }
573 
576  const std::string name =
578  // There aren't really any reserved words that end in "Root", but playing
579  // it safe and checking.
580  return SanitizeNameForObjC(prefix, name, "_RootClass", NULL);
581 }
582 
585  if (descriptor->containing_type() != NULL) {
586  name = ClassNameWorker(descriptor->containing_type());
587  name += "_";
588  }
589  return name + descriptor->name();
590 }
591 
594  if (descriptor->containing_type() != NULL) {
595  name = ClassNameWorker(descriptor->containing_type());
596  name += "_";
597  }
598  return name + descriptor->name();
599 }
600 
602  return ClassName(descriptor, NULL);
603 }
604 
606  std::string* out_suffix_added) {
607  // 1. Message names are used as is (style calls for CamelCase, trust it).
608  // 2. Check for reserved word at the very end and then suffix things.
609  const std::string prefix = FileClassPrefix(descriptor->file());
611  return SanitizeNameForObjC(prefix, name, "_Class", out_suffix_added);
612 }
613 
615  // 1. Enum names are used as is (style calls for CamelCase, trust it).
616  // 2. Check for reserved word at the every end and then suffix things.
617  // message Fixed {
618  // message Size {...}
619  // enum Mumble {...}
620  // ...
621  // }
622  // yields Fixed_Class, Fixed_Size.
623  const std::string prefix = FileClassPrefix(descriptor->file());
625  return SanitizeNameForObjC(prefix, name, "_Enum", NULL);
626 }
627 
629  // Because of the Switch enum compatibility, the name on the enum has to have
630  // the suffix handing, so it slightly diverges from how nested classes work.
631  // enum Fixed {
632  // FOO = 1
633  // }
634  // yields Fixed_Enum and Fixed_Enum_Foo (not Fixed_Foo).
635  const std::string class_name = EnumName(descriptor->type());
636  const std::string value_str =
637  UnderscoresToCamelCase(descriptor->name(), true);
638  const std::string name = class_name + "_" + value_str;
639  // There aren't really any reserved words with an underscore and a leading
640  // capital letter, but playing it safe and checking.
641  return SanitizeNameForObjC("", name, "_Value", NULL);
642 }
643 
645  // Enum value names (EnumValueName above) are the enum name turned into
646  // a class name and then the value name is CamelCased and concatenated; the
647  // whole thing then gets sanitized for reserved words.
648  // The "short name" is intended to be the final leaf, the value name; but
649  // you can't simply send that off to sanitize as that could result in it
650  // getting modified when the full name didn't. For example enum
651  // "StorageModes" has a value "retain". So the full name is
652  // "StorageModes_Retain", but if we sanitize "retain" it would become
653  // "RetainValue".
654  // So the right way to get the short name is to take the full enum name
655  // and then strip off the enum name (leaving the value name and anything
656  // done by sanitize).
657  const std::string class_name = EnumName(descriptor->type());
658  const std::string long_name_prefix = class_name + "_";
659  const std::string long_name = EnumValueName(descriptor);
660  return StripPrefixString(long_name, long_name_prefix);
661 }
662 
665  for (int i = 0; i < name.size(); i++) {
666  char c = name[i];
667  if (i > 0 && ascii_isupper(c)) {
668  result += '_';
669  }
670  result += ascii_toupper(c);
671  }
672  return result;
673 }
674 
676  const std::string name = NameFromFieldDescriptor(descriptor);
678  return SanitizeNameForObjC("", result, "_Extension", NULL);
679 }
680 
682  const std::string name = NameFromFieldDescriptor(field);
684  if (field->is_repeated() && !field->is_map()) {
685  // Add "Array" before do check for reserved worlds.
686  result += "Array";
687  } else {
688  // If it wasn't repeated, but ends in "Array", force on the _p suffix.
689  if (HasSuffixString(result, "Array")) {
690  result += "_p";
691  }
692  }
693  return SanitizeNameForObjC("", result, "_p", NULL);
694 }
695 
697  // Want the same suffix handling, so upcase the first letter of the other
698  // name.
700  if (result.length() > 0) {
701  result[0] = ascii_toupper(result[0]);
702  }
703  return result;
704 }
705 
707  const Descriptor* fieldDescriptor = descriptor->containing_type();
708  std::string name = ClassName(fieldDescriptor);
709  name += "_" + UnderscoresToCamelCase(descriptor->name(), true) + "_OneOfCase";
710  // No sanitize needed because the OS never has names that end in _OneOfCase.
711  return name;
712 }
713 
716  // No sanitize needed because it gets OneOfCase added and that shouldn't
717  // ever conflict.
718  return name;
719 }
720 
722  // Use the common handling and then up-case the first letter.
724  if (result.length() > 0) {
725  result[0] = ascii_toupper(result[0]);
726  }
727  return result;
728 }
729 
731  return std::string("GPBObjCClass(") + class_name + ")";
732 }
733 
735  return std::string("GPBObjCClassDeclaration(") + class_name + ");";
736 }
737 
740  if (HasSuffixString(worker, "_p")) {
742  }
743  if (field->is_repeated() && HasSuffixString(worker, "Array")) {
744  worker = StripSuffixString(worker, "Array");
745  }
746  if (field->type() == FieldDescriptor::TYPE_GROUP) {
747  if (worker.length() > 0) {
748  if (ascii_islower(worker[0])) {
749  worker[0] = ascii_toupper(worker[0]);
750  }
751  }
752  return worker;
753  } else {
755  for (int i = 0; i < worker.size(); i++) {
756  char c = worker[i];
757  if (ascii_isupper(c)) {
758  if (i > 0) {
759  result += '_';
760  }
761  result += ascii_tolower(c);
762  } else {
763  result += c;
764  }
765  }
766  return result;
767  }
768 }
769 
771  switch (field->type()) {
773  return "Int32";
775  return "UInt32";
777  return "SInt32";
779  return "Fixed32";
781  return "SFixed32";
783  return "Int64";
785  return "UInt64";
787  return "SInt64";
789  return "Fixed64";
791  return "SFixed64";
793  return "Float";
795  return "Double";
797  return "Bool";
799  return "String";
801  return "Bytes";
803  return "Enum";
805  return "Group";
807  return "Message";
808  }
809 
810  // Some compilers report reaching end of function even though all cases of
811  // the enum are handed in the switch.
812  GOOGLE_LOG(FATAL) << "Can't get here.";
813  return std::string();
814 }
815 
817  switch (field_type) {
821  return OBJECTIVECTYPE_INT32;
822 
825  return OBJECTIVECTYPE_UINT32;
826 
830  return OBJECTIVECTYPE_INT64;
831 
834  return OBJECTIVECTYPE_UINT64;
835 
837  return OBJECTIVECTYPE_FLOAT;
838 
840  return OBJECTIVECTYPE_DOUBLE;
841 
843  return OBJECTIVECTYPE_BOOLEAN;
844 
846  return OBJECTIVECTYPE_STRING;
847 
849  return OBJECTIVECTYPE_DATA;
850 
852  return OBJECTIVECTYPE_ENUM;
853 
856  return OBJECTIVECTYPE_MESSAGE;
857  }
858 
859  // Some compilers report reaching end of function even though all cases of
860  // the enum are handed in the switch.
861  GOOGLE_LOG(FATAL) << "Can't get here.";
862  return OBJECTIVECTYPE_INT32;
863 }
864 
867  switch (type) {
875  case OBJECTIVECTYPE_ENUM:
876  return true;
877  break;
878  default:
879  return false;
880  }
881 }
882 
884  return !IsPrimitiveType(field);
885 }
886 
888  bool add_float_suffix) {
889  if (val == "nan") {
890  return "NAN";
891  } else if (val == "inf") {
892  return "INFINITY";
893  } else if (val == "-inf") {
894  return "-INFINITY";
895  } else {
896  // float strings with ., e or E need to have f appended
897  if (add_float_suffix && (val.find(".") != std::string::npos ||
898  val.find("e") != std::string::npos ||
899  val.find("E") != std::string::npos)) {
900  val += "f";
901  }
902  return val;
903  }
904 }
905 
907  // Returns the field within the GPBGenericValue union to use for the given
908  // field.
909  if (field->is_repeated()) {
910  return "valueMessage";
911  }
912  switch (field->cpp_type()) {
914  return "valueInt32";
916  return "valueUInt32";
918  return "valueInt64";
920  return "valueUInt64";
922  return "valueFloat";
924  return "valueDouble";
926  return "valueBool";
928  if (field->type() == FieldDescriptor::TYPE_BYTES) {
929  return "valueData";
930  } else {
931  return "valueString";
932  }
934  return "valueEnum";
936  return "valueMessage";
937  }
938 
939  // Some compilers report reaching end of function even though all cases of
940  // the enum are handed in the switch.
941  GOOGLE_LOG(FATAL) << "Can't get here.";
942  return std::string();
943 }
944 
945 
947  // Repeated fields don't have defaults.
948  if (field->is_repeated()) {
949  return "nil";
950  }
951 
952  // Switch on cpp_type since we need to know which default_value_* method
953  // of FieldDescriptor to call.
954  switch (field->cpp_type()) {
956  // gcc and llvm reject the decimal form of kint32min and kint64min.
957  if (field->default_value_int32() == INT_MIN) {
958  return "-0x80000000";
959  }
960  return StrCat(field->default_value_int32());
962  return StrCat(field->default_value_uint32()) + "U";
964  // gcc and llvm reject the decimal form of kint32min and kint64min.
965  if (field->default_value_int64() == LLONG_MIN) {
966  return "-0x8000000000000000LL";
967  }
968  return StrCat(field->default_value_int64()) + "LL";
970  return StrCat(field->default_value_uint64()) + "ULL";
973  SimpleDtoa(field->default_value_double()), false);
976  SimpleFtoa(field->default_value_float()), true);
978  return field->default_value_bool() ? "YES" : "NO";
980  const bool has_default_value = field->has_default_value();
981  const std::string& default_string = field->default_value_string();
982  if (!has_default_value || default_string.length() == 0) {
983  // If the field is defined as being the empty string,
984  // then we will just assign to nil, as the empty string is the
985  // default for both strings and data.
986  return "nil";
987  }
988  if (field->type() == FieldDescriptor::TYPE_BYTES) {
989  // We want constant fields in our data structures so we can
990  // declare them as static. To achieve this we cheat and stuff
991  // a escaped c string (prefixed with a length) into the data
992  // field, and cast it to an (NSData*) so it will compile.
993  // The runtime library knows how to handle it.
994 
995  // Must convert to a standard byte order for packing length into
996  // a cstring.
997  uint32_t length = ghtonl(default_string.length());
998  std::string bytes((const char*)&length, sizeof(length));
999  bytes.append(default_string);
1000  return "(NSData*)\"" + EscapeTrigraphs(CEscape(bytes)) + "\"";
1001  } else {
1002  return "@\"" + EscapeTrigraphs(CEscape(default_string)) + "\"";
1003  }
1004  }
1006  return EnumValueName(field->default_value_enum());
1008  return "nil";
1009  }
1010 
1011  // Some compilers report reaching end of function even though all cases of
1012  // the enum are handed in the switch.
1013  GOOGLE_LOG(FATAL) << "Can't get here.";
1014  return std::string();
1015 }
1016 
1018  // Repeated fields don't have defaults.
1019  if (field->is_repeated()) {
1020  return false;
1021  }
1022 
1023  // As much as checking field->has_default_value() seems useful, it isn't
1024  // because of enums. proto2 syntax allows the first item in an enum (the
1025  // default) to be non zero. So checking field->has_default_value() would
1026  // result in missing this non zero default. See MessageWithOneBasedEnum in
1027  // objectivec/Tests/unittest_objc.proto for a test Message to confirm this.
1028 
1029  // Some proto file set the default to the zero value, so make sure the value
1030  // isn't the zero case.
1031  switch (field->cpp_type()) {
1033  return field->default_value_int32() != 0;
1035  return field->default_value_uint32() != 0U;
1037  return field->default_value_int64() != 0LL;
1039  return field->default_value_uint64() != 0ULL;
1041  return field->default_value_double() != 0.0;
1043  return field->default_value_float() != 0.0f;
1045  return field->default_value_bool();
1047  const std::string& default_string = field->default_value_string();
1048  return default_string.length() != 0;
1049  }
1051  return field->default_value_enum()->number() != 0;
1053  return false;
1054  }
1055 
1056  // Some compilers report reaching end of function even though all cases of
1057  // the enum are handed in the switch.
1058  GOOGLE_LOG(FATAL) << "Can't get here.";
1059  return false;
1060 }
1061 
1063  const std::vector<std::string>& strings) {
1064  if (strings.empty()) {
1065  return GetZeroEnumNameForFlagType(flag_type);
1066  } else if (strings.size() == 1) {
1067  return strings[0];
1068  }
1069  std::string string("(" + GetEnumNameForFlagType(flag_type) + ")(");
1070  for (size_t i = 0; i != strings.size(); ++i) {
1071  if (i > 0) {
1072  string.append(" | ");
1073  }
1074  string.append(strings[i]);
1075  }
1076  string.append(")");
1077  return string;
1078 }
1079 
1081  bool prefer_single_line) {
1082  const std::string& comments = location.leading_comments.empty()
1083  ? location.trailing_comments
1084  : location.leading_comments;
1085  std::vector<std::string> lines;
1086  lines = Split(comments, "\n", false);
1087  while (!lines.empty() && lines.back().empty()) {
1088  lines.pop_back();
1089  }
1090  // If there are no comments, just return an empty string.
1091  if (lines.empty()) {
1092  return "";
1093  }
1094 
1097  std::string final_comments;
1098  std::string epilogue;
1099 
1100  bool add_leading_space = false;
1101 
1102  if (prefer_single_line && lines.size() == 1) {
1103  prefix = "/** ";
1104  suffix = " */\n";
1105  } else {
1106  prefix = "* ";
1107  suffix = "\n";
1108  final_comments += "/**\n";
1109  epilogue = " **/\n";
1110  add_leading_space = true;
1111  }
1112 
1113  for (int i = 0; i < lines.size(); i++) {
1115  // HeaderDoc and appledoc use '\' and '@' for markers; escape them.
1116  line = StringReplace(line, "\\", "\\\\", true);
1117  line = StringReplace(line, "@", "\\@", true);
1118  // Decouple / from * to not have inline comments inside comments.
1119  line = StringReplace(line, "/*", "/\\*", true);
1120  line = StringReplace(line, "*/", "*\\/", true);
1121  line = prefix + line;
1123  // If not a one line, need to add the first space before *, as
1124  // StripWhitespace would have removed it.
1125  line = (add_leading_space ? " " : "") + line;
1126  final_comments += line + suffix;
1127  }
1128  final_comments += epilogue;
1129  return final_comments;
1130 }
1131 
1132 // Making these a generator option for folks that don't use CocoaPods, but do
1133 // want to put the library in a framework is an interesting question. The
1134 // problem is it means changing sources shipped with the library to actually
1135 // use a different value; so it isn't as simple as a option.
1136 const char* const ProtobufLibraryFrameworkName = "Protobuf";
1137 
1139  // GPB_USE_[framework_name]_FRAMEWORK_IMPORTS
1140  std::string result = std::string("GPB_USE_");
1141  result += ToUpper(framework_name);
1142  result += "_FRAMEWORK_IMPORTS";
1143  return result;
1144 }
1145 
1147  // We don't check the name prefix or proto package because some files
1148  // (descriptor.proto), aren't shipped generated by the library, so this
1149  // seems to be the safest way to only catch the ones shipped.
1150  const std::string name = file->name();
1151  if (name == "google/protobuf/any.proto" ||
1152  name == "google/protobuf/api.proto" ||
1153  name == "google/protobuf/duration.proto" ||
1154  name == "google/protobuf/empty.proto" ||
1155  name == "google/protobuf/field_mask.proto" ||
1156  name == "google/protobuf/source_context.proto" ||
1157  name == "google/protobuf/struct.proto" ||
1158  name == "google/protobuf/timestamp.proto" ||
1159  name == "google/protobuf/type.proto" ||
1160  name == "google/protobuf/wrappers.proto") {
1161  return true;
1162  }
1163  return false;
1164 }
1165 
1166 bool ReadLine(StringPiece* input, StringPiece* line) {
1167  for (int len = 0; len < input->size(); ++len) {
1168  if (ascii_isnewline((*input)[len])) {
1169  *line = StringPiece(input->data(), len);
1170  ++len; // advance over the newline
1171  *input = StringPiece(input->data() + len, input->size() - len);
1172  return true;
1173  }
1174  }
1175  return false; // Ran out of input with no newline.
1176 }
1177 
1178 void RemoveComment(StringPiece* input) {
1179  int offset = input->find('#');
1180  if (offset != StringPiece::npos) {
1181  input->remove_suffix(input->length() - offset);
1182  }
1183 }
1184 
1185 namespace {
1186 
1187 class ExpectedPrefixesCollector : public LineConsumer {
1188  public:
1189  ExpectedPrefixesCollector(std::map<std::string, std::string>* inout_package_to_prefix_map)
1190  : prefix_map_(inout_package_to_prefix_map) {}
1191 
1192  virtual bool ConsumeLine(const StringPiece& line, std::string* out_error) override;
1193 
1194  private:
1195  std::map<std::string, std::string>* prefix_map_;
1196 };
1197 
1198 bool ExpectedPrefixesCollector::ConsumeLine(
1199  const StringPiece& line, std::string* out_error) {
1200  int offset = line.find('=');
1201  if (offset == StringPiece::npos) {
1202  *out_error = std::string("Expected prefixes file line without equal sign: '") +
1203  std::string(line) + "'.";
1204  return false;
1205  }
1206  StringPiece package = line.substr(0, offset);
1207  StringPiece prefix = line.substr(offset + 1);
1208  TrimWhitespace(&package);
1210  MaybeUnQuote(&prefix);
1211  // Don't really worry about error checking the package/prefix for
1212  // being valid. Assume the file is validated when it is created/edited.
1213  (*prefix_map_)[std::string(package)] = std::string(prefix);
1214  return true;
1215 }
1216 
1217 bool LoadExpectedPackagePrefixes(const Options& generation_options,
1218  std::map<std::string, std::string>* prefix_map,
1219  std::string* out_error) {
1220  if (generation_options.expected_prefixes_path.empty()) {
1221  return true;
1222  }
1223 
1224  ExpectedPrefixesCollector collector(prefix_map);
1225  return ParseSimpleFile(
1226  generation_options.expected_prefixes_path, &collector, out_error);
1227 }
1228 
1229 bool ValidateObjCClassPrefix(
1230  const FileDescriptor* file, const std::string& expected_prefixes_path,
1231  const std::map<std::string, std::string>& expected_package_prefixes,
1232  bool prefixes_must_be_registered, bool require_prefixes,
1233  std::string* out_error) {
1234  // Reminder: An explicit prefix option of "" is valid in case the default
1235  // prefixing is set to use the proto package and a file needs to be generated
1236  // without any prefix at all (for legacy reasons).
1237 
1238  bool has_prefix = file->options().has_objc_class_prefix();
1239  bool have_expected_prefix_file = !expected_prefixes_path.empty();
1240 
1241  const std::string prefix = file->options().objc_class_prefix();
1242  const std::string package = file->package();
1243 
1244  // NOTE: src/google/protobuf/compiler/plugin.cc makes use of cerr for some
1245  // error cases, so it seems to be ok to use as a back door for warnings.
1246 
1247  // Check: Error - See if there was an expected prefix for the package and
1248  // report if it doesn't match (wrong or missing).
1249  std::map<std::string, std::string>::const_iterator package_match =
1250  expected_package_prefixes.find(package);
1251  if (package_match != expected_package_prefixes.end()) {
1252  // There was an entry, and...
1253  if (has_prefix && package_match->second == prefix) {
1254  // ...it matches. All good, out of here!
1255  return true;
1256  } else {
1257  // ...it didn't match!
1258  *out_error = "error: Expected 'option objc_class_prefix = \"" +
1259  package_match->second + "\";' for package '" + package +
1260  "' in '" + file->name() + "'";
1261  if (has_prefix) {
1262  *out_error += "; but found '" + prefix + "' instead";
1263  }
1264  *out_error += ".";
1265  return false;
1266  }
1267  }
1268 
1269  // If there was no prefix option, we're done at this point.
1270  if (!has_prefix) {
1271  if (require_prefixes) {
1272  *out_error =
1273  "error: '" + file->name() + "' does not have a required 'option" +
1274  " objc_class_prefix'.";
1275  return false;
1276  }
1277  return true;
1278  }
1279 
1280  // When the prefix is non empty, check it against the expected entries.
1281  if (!prefix.empty() && have_expected_prefix_file) {
1282  // For a non empty prefix, look for any other package that uses the prefix.
1283  std::string other_package_for_prefix;
1284  for (std::map<std::string, std::string>::const_iterator i =
1285  expected_package_prefixes.begin();
1286  i != expected_package_prefixes.end(); ++i) {
1287  if (i->second == prefix) {
1288  other_package_for_prefix = i->first;
1289  break;
1290  }
1291  }
1292 
1293  // Check: Warning - If the file does not have a package, check whether the
1294  // prefix was declared is being used by another package or not. This is
1295  // a special case for empty packages.
1296  if (package.empty()) {
1297  // The file does not have a package and ...
1298  if (other_package_for_prefix.empty()) {
1299  // ... no other package has declared that prefix.
1300  std::cerr
1301  << "protoc:0: warning: File '" << file->name() << "' has no "
1302  << "package. Consider adding a new package to the proto and adding '"
1303  << "new.package = " << prefix << "' to the expected prefixes file ("
1304  << expected_prefixes_path << ")." << std::endl;
1305  std::cerr.flush();
1306  } else {
1307  // ... another package has declared the same prefix.
1308  std::cerr
1309  << "protoc:0: warning: File '" << file->name() << "' has no package "
1310  << "and package '" << other_package_for_prefix << "' already uses '"
1311  << prefix << "' as its prefix. Consider either adding a new package "
1312  << "to the proto, or reusing one of the packages already using this "
1313  << "prefix in the expected prefixes file ("
1314  << expected_prefixes_path << ")." << std::endl;
1315  std::cerr.flush();
1316  }
1317  return true;
1318  }
1319 
1320  // Check: Error - Make sure the prefix wasn't expected for a different
1321  // package (overlap is allowed, but it has to be listed as an expected
1322  // overlap).
1323  if (!other_package_for_prefix.empty()) {
1324  *out_error =
1325  "error: Found 'option objc_class_prefix = \"" + prefix +
1326  "\";' in '" + file->name() +
1327  "'; that prefix is already used for 'package " +
1328  other_package_for_prefix + ";'. It can only be reused by listing " +
1329  "it in the expected file (" +
1330  expected_prefixes_path + ").";
1331  return false; // Only report first usage of the prefix.
1332  }
1333  } // !prefix.empty()
1334 
1335  // Check: Warning - Make sure the prefix is is a reasonable value according
1336  // to Apple's rules (the checks above implicitly whitelist anything that
1337  // doesn't meet these rules).
1338  if (!prefix.empty() && !ascii_isupper(prefix[0])) {
1339  std::cerr
1340  << "protoc:0: warning: Invalid 'option objc_class_prefix = \""
1341  << prefix << "\";' in '" << file->name() << "';"
1342  << " it should start with a capital letter." << std::endl;
1343  std::cerr.flush();
1344  }
1345  if (!prefix.empty() && prefix.length() < 3) {
1346  // Apple reserves 2 character prefixes for themselves. They do use some
1347  // 3 character prefixes, but they haven't updated the rules/docs.
1348  std::cerr
1349  << "protoc:0: warning: Invalid 'option objc_class_prefix = \""
1350  << prefix << "\";' in '" << file->name() << "';"
1351  << " Apple recommends they should be at least 3 characters long."
1352  << std::endl;
1353  std::cerr.flush();
1354  }
1355 
1356  // Check: Error/Warning - If the given package/prefix pair wasn't expected,
1357  // issue a error/warning to added to the file.
1358  if (have_expected_prefix_file) {
1359  if (prefixes_must_be_registered) {
1360  *out_error =
1361  "error: '" + file->name() + "' has 'option objc_class_prefix = \"" +
1362  prefix + "\";', but it is not registered; add it to the expected " +
1363  "prefixes file (" + expected_prefixes_path + ") for the package '" +
1364  package + "'.";
1365  return false;
1366  }
1367 
1368  std::cerr
1369  << "protoc:0: warning: Found unexpected 'option objc_class_prefix = \""
1370  << prefix << "\";' in '" << file->name() << "';"
1371  << " consider adding it to the expected prefixes file ("
1372  << expected_prefixes_path << ")." << std::endl;
1373  std::cerr.flush();
1374  }
1375 
1376  return true;
1377 }
1378 
1379 } // namespace
1380 
1381 bool ValidateObjCClassPrefixes(const std::vector<const FileDescriptor*>& files,
1382  const Options& generation_options,
1383  std::string* out_error) {
1384  // Allow a '-' as the path for the expected prefixes to completely disable
1385  // even the most basic of checks.
1386  if (generation_options.expected_prefixes_path == "-") {
1387  return true;
1388  }
1389 
1390  // Load the expected package prefixes, if available, to validate against.
1391  std::map<std::string, std::string> expected_package_prefixes;
1392  if (!LoadExpectedPackagePrefixes(generation_options,
1393  &expected_package_prefixes,
1394  out_error)) {
1395  return false;
1396  }
1397 
1398  for (int i = 0; i < files.size(); i++) {
1399  bool should_skip =
1400  (std::find(generation_options.expected_prefixes_suppressions.begin(),
1401  generation_options.expected_prefixes_suppressions.end(),
1402  files[i]->name())
1403  != generation_options.expected_prefixes_suppressions.end());
1404  if (should_skip) {
1405  continue;
1406  }
1407 
1408  bool is_valid =
1409  ValidateObjCClassPrefix(files[i],
1410  generation_options.expected_prefixes_path,
1411  expected_package_prefixes,
1412  generation_options.prefixes_must_be_registered,
1413  generation_options.require_prefixes,
1414  out_error);
1415  if (!is_valid) {
1416  return false;
1417  }
1418  }
1419  return true;
1420 }
1421 
1423 
1425 
1427  const std::string& input_for_decode,
1428  const std::string& desired_output) {
1429  for (std::vector<DataEntry>::const_iterator i = entries_.begin();
1430  i != entries_.end(); ++i) {
1431  if (i->first == key) {
1432  std::cerr << "error: duplicate key (" << key
1433  << ") making TextFormat data, input: \"" << input_for_decode
1434  << "\", desired: \"" << desired_output << "\"." << std::endl;
1435  std::cerr.flush();
1436  abort();
1437  }
1438  }
1439 
1441  input_for_decode, desired_output);
1442  entries_.push_back(DataEntry(key, data));
1443 }
1444 
1446  std::ostringstream data_stringstream;
1447 
1448  if (num_entries() > 0) {
1449  io::OstreamOutputStream data_outputstream(&data_stringstream);
1450  io::CodedOutputStream output_stream(&data_outputstream);
1451 
1452  output_stream.WriteVarint32(num_entries());
1453  for (std::vector<DataEntry>::const_iterator i = entries_.begin();
1454  i != entries_.end(); ++i) {
1455  output_stream.WriteVarint32(i->first);
1456  output_stream.WriteString(i->second);
1457  }
1458  }
1459 
1460  data_stringstream.flush();
1461  return data_stringstream.str();
1462 }
1463 
1464 namespace {
1465 
1466 // Helper to build up the decode data for a string.
1467 class DecodeDataBuilder {
1468  public:
1469  DecodeDataBuilder() { Reset(); }
1470 
1471  bool AddCharacter(const char desired, const char input);
1472  void AddUnderscore() {
1473  Push();
1474  need_underscore_ = true;
1475  }
1476  std::string Finish() {
1477  Push();
1478  return decode_data_;
1479  }
1480 
1481  private:
1482  static constexpr uint8_t kAddUnderscore = 0x80;
1483 
1484  static constexpr uint8_t kOpAsIs = 0x00;
1485  static constexpr uint8_t kOpFirstUpper = 0x40;
1486  static constexpr uint8_t kOpFirstLower = 0x20;
1487  static constexpr uint8_t kOpAllUpper = 0x60;
1488 
1489  static constexpr int kMaxSegmentLen = 0x1f;
1490 
1491  void AddChar(const char desired) {
1492  ++segment_len_;
1493  is_all_upper_ &= ascii_isupper(desired);
1494  }
1495 
1496  void Push() {
1497  uint8_t op = (op_ | segment_len_);
1499  if (op != 0) {
1500  decode_data_ += (char)op;
1501  }
1502  Reset();
1503  }
1504 
1505  bool AddFirst(const char desired, const char input) {
1506  if (desired == input) {
1507  op_ = kOpAsIs;
1508  } else if (desired == ascii_toupper(input)) {
1509  op_ = kOpFirstUpper;
1510  } else if (desired == ascii_tolower(input)) {
1511  op_ = kOpFirstLower;
1512  } else {
1513  // Can't be transformed to match.
1514  return false;
1515  }
1516  AddChar(desired);
1517  return true;
1518  }
1519 
1520  void Reset() {
1521  need_underscore_ = false;
1522  op_ = 0;
1523  segment_len_ = 0;
1524  is_all_upper_ = true;
1525  }
1526 
1531 
1533 };
1534 
1535 bool DecodeDataBuilder::AddCharacter(const char desired, const char input) {
1536  // If we've hit the max size, push to start a new segment.
1537  if (segment_len_ == kMaxSegmentLen) {
1538  Push();
1539  }
1540  if (segment_len_ == 0) {
1541  return AddFirst(desired, input);
1542  }
1543 
1544  // Desired and input match...
1545  if (desired == input) {
1546  // If we aren't transforming it, or we're upper casing it and it is
1547  // supposed to be uppercase; just add it to the segment.
1548  if ((op_ != kOpAllUpper) || ascii_isupper(desired)) {
1549  AddChar(desired);
1550  return true;
1551  }
1552 
1553  // Add the current segment, and start the next one.
1554  Push();
1555  return AddFirst(desired, input);
1556  }
1557 
1558  // If we need to uppercase, and everything so far has been uppercase,
1559  // promote op to AllUpper.
1560  if ((desired == ascii_toupper(input)) && is_all_upper_) {
1561  op_ = kOpAllUpper;
1562  AddChar(desired);
1563  return true;
1564  }
1565 
1566  // Give up, push and start a new segment.
1567  Push();
1568  return AddFirst(desired, input);
1569 }
1570 
1571 // If decode data can't be generated, a directive for the raw string
1572 // is used instead.
1573 std::string DirectDecodeString(const std::string& str) {
1575  result += (char)'\0'; // Marker for full string.
1576  result += str;
1577  result += (char)'\0'; // End of string.
1578  return result;
1579 }
1580 
1581 } // namespace
1582 
1583 // static
1585  const std::string& input_for_decode, const std::string& desired_output) {
1586  if (input_for_decode.empty() || desired_output.empty()) {
1587  std::cerr << "error: got empty string for making TextFormat data, input: \""
1588  << input_for_decode << "\", desired: \"" << desired_output << "\"."
1589  << std::endl;
1590  std::cerr.flush();
1591  abort();
1592  }
1593  if ((input_for_decode.find('\0') != std::string::npos) ||
1594  (desired_output.find('\0') != std::string::npos)) {
1595  std::cerr << "error: got a null char in a string for making TextFormat data,"
1596  << " input: \"" << CEscape(input_for_decode) << "\", desired: \""
1597  << CEscape(desired_output) << "\"." << std::endl;
1598  std::cerr.flush();
1599  abort();
1600  }
1601 
1602  DecodeDataBuilder builder;
1603 
1604  // Walk the output building it from the input.
1605  int x = 0;
1606  for (int y = 0; y < desired_output.size(); y++) {
1607  const char d = desired_output[y];
1608  if (d == '_') {
1609  builder.AddUnderscore();
1610  continue;
1611  }
1612 
1613  if (x >= input_for_decode.size()) {
1614  // Out of input, no way to encode it, just return a full decode.
1615  return DirectDecodeString(desired_output);
1616  }
1617  if (builder.AddCharacter(d, input_for_decode[x])) {
1618  ++x; // Consumed one input
1619  } else {
1620  // Couldn't transform for the next character, just return a full decode.
1621  return DirectDecodeString(desired_output);
1622  }
1623  }
1624 
1625  if (x != input_for_decode.size()) {
1626  // Extra input (suffix from name sanitizing?), just return a full decode.
1627  return DirectDecodeString(desired_output);
1628  }
1629 
1630  // Add the end marker.
1631  return builder.Finish() + (char)'\0';
1632 }
1633 
1634 namespace {
1635 
1636 class Parser {
1637  public:
1638  Parser(LineConsumer* line_consumer)
1639  : line_consumer_(line_consumer), line_(0) {}
1640 
1641  // Feeds in some input, parse what it can, returning success/failure. Calling
1642  // again after an error is undefined.
1643  bool ParseChunk(StringPiece chunk, std::string* out_error);
1644 
1645  // Should be called to finish parsing (after all input has been provided via
1646  // successful calls to ParseChunk(), calling after a ParseChunk() failure is
1647  // undefined). Returns success/failure.
1648  bool Finish(std::string* out_error);
1649 
1650  int last_line() const { return line_; }
1651 
1652  private:
1653  LineConsumer* line_consumer_;
1654  int line_;
1656 };
1657 
1658 bool Parser::ParseChunk(StringPiece chunk, std::string* out_error) {
1659  StringPiece full_chunk;
1660  if (!leftover_.empty()) {
1661  leftover_ += std::string(chunk);
1662  full_chunk = StringPiece(leftover_);
1663  } else {
1664  full_chunk = chunk;
1665  }
1666 
1667  StringPiece line;
1668  while (ReadLine(&full_chunk, &line)) {
1669  ++line_;
1670  RemoveComment(&line);
1671  TrimWhitespace(&line);
1672  if (!line.empty() && !line_consumer_->ConsumeLine(line, out_error)) {
1673  if (out_error->empty()) {
1674  *out_error = "ConsumeLine failed without setting an error.";
1675  }
1676  leftover_.clear();
1677  return false;
1678  }
1679  }
1680 
1681  if (full_chunk.empty()) {
1682  leftover_.clear();
1683  } else {
1684  leftover_ = std::string(full_chunk);
1685  }
1686  return true;
1687 }
1688 
1689 bool Parser::Finish(std::string* out_error) {
1690  // If there is still something to go, flush it with a newline.
1691  if (!leftover_.empty() && !ParseChunk("\n", out_error)) {
1692  return false;
1693  }
1694  // This really should never fail if ParseChunk succeeded, but check to be sure.
1695  if (!leftover_.empty()) {
1696  *out_error = "ParseSimple Internal error: finished with pending data.";
1697  return false;
1698  }
1699  return true;
1700 }
1701 
1702 std::string FullErrorString(const std::string& name, int line_num, const std::string& msg) {
1703  return std::string("error: ") + name + " Line " + StrCat(line_num) + ", " + msg;
1704 }
1705 
1706 } // namespace
1707 
1709 
1711 
1712 bool ParseSimpleFile(const std::string& path, LineConsumer* line_consumer,
1713  std::string* out_error) {
1714  int fd;
1715  do {
1716  fd = posix::open(path.c_str(), O_RDONLY);
1717  } while (fd < 0 && errno == EINTR);
1718  if (fd < 0) {
1719  *out_error = std::string("error: Unable to open \"") + path + "\", " +
1720  strerror(errno);
1721  return false;
1722  }
1723  io::FileInputStream file_stream(fd);
1724  file_stream.SetCloseOnDelete(true);
1725 
1726  return ParseSimpleStream(file_stream, path, line_consumer, out_error);
1727 }
1728 
1730  const std::string& stream_name,
1731  LineConsumer* line_consumer,
1732  std::string* out_error) {
1733  std::string local_error;
1734  Parser parser(line_consumer);
1735  const void* buf;
1736  int buf_len;
1737  while (input_stream.Next(&buf, &buf_len)) {
1738  if (buf_len == 0) {
1739  continue;
1740  }
1741 
1742  if (!parser.ParseChunk(StringPiece(static_cast<const char*>(buf), buf_len),
1743  &local_error)) {
1744  *out_error = FullErrorString(stream_name, parser.last_line(), local_error);
1745  return false;
1746  }
1747  }
1748  if (!parser.Finish(&local_error)) {
1749  *out_error = FullErrorString(stream_name, parser.last_line(), local_error);
1750  return false;
1751  }
1752  return true;
1753 }
1754 
1756  const std::string& generate_for_named_framework,
1757  const std::string& named_framework_to_proto_path_mappings_path,
1758  const std::string& runtime_import_prefix, bool include_wkt_imports)
1759  : generate_for_named_framework_(generate_for_named_framework),
1760  named_framework_to_proto_path_mappings_path_(
1761  named_framework_to_proto_path_mappings_path),
1762  runtime_import_prefix_(runtime_import_prefix),
1763  include_wkt_imports_(include_wkt_imports),
1764  need_to_parse_mapping_file_(true) {}
1765 
1767 
1769  const std::string& header_extension) {
1771  // The imports of the WKTs are only needed within the library itself,
1772  // in other cases, they get skipped because the generated code already
1773  // import GPBProtocolBuffers.h and hence proves them.
1774  if (include_wkt_imports_) {
1775  const std::string header_name =
1776  "GPB" + FilePathBasename(file) + header_extension;
1777  protobuf_imports_.push_back(header_name);
1778  }
1779  return;
1780  }
1781 
1782  // Lazy parse any mappings.
1785  }
1786 
1789  if (proto_lookup != proto_file_to_framework_name_.end()) {
1790  other_framework_imports_.push_back(
1791  proto_lookup->second + "/" +
1792  FilePathBasename(file) + header_extension);
1793  return;
1794  }
1795 
1796  if (!generate_for_named_framework_.empty()) {
1797  other_framework_imports_.push_back(
1799  FilePathBasename(file) + header_extension);
1800  return;
1801  }
1802 
1803  other_imports_.push_back(FilePath(file) + header_extension);
1804 }
1805 
1806 void ImportWriter::Print(io::Printer* printer) const {
1807  bool add_blank_line = false;
1808 
1809  if (!protobuf_imports_.empty()) {
1811  add_blank_line = true;
1812  }
1813 
1814  if (!other_framework_imports_.empty()) {
1815  if (add_blank_line) {
1816  printer->Print("\n");
1817  }
1818 
1819  for (std::vector<std::string>::const_iterator iter =
1820  other_framework_imports_.begin();
1821  iter != other_framework_imports_.end(); ++iter) {
1822  printer->Print(
1823  "#import <$header$>\n",
1824  "header", *iter);
1825  }
1826 
1827  add_blank_line = true;
1828  }
1829 
1830  if (!other_imports_.empty()) {
1831  if (add_blank_line) {
1832  printer->Print("\n");
1833  }
1834 
1835  for (std::vector<std::string>::const_iterator iter = other_imports_.begin();
1836  iter != other_imports_.end(); ++iter) {
1837  printer->Print(
1838  "#import \"$header$\"\n",
1839  "header", *iter);
1840  }
1841  }
1842 }
1843 
1845  io::Printer* printer, const std::vector<std::string>& header_to_import,
1846  const std::string& runtime_import_prefix, bool default_cpp_symbol) {
1847  // Given an override, use that.
1848  if (!runtime_import_prefix.empty()) {
1849  for (const auto& header : header_to_import) {
1850  printer->Print(
1851  " #import \"$import_prefix$/$header$\"\n",
1852  "import_prefix", runtime_import_prefix,
1853  "header", header);
1854  }
1855  return;
1856  }
1857 
1858  const std::string framework_name(ProtobufLibraryFrameworkName);
1859  const std::string cpp_symbol(ProtobufFrameworkImportSymbol(framework_name));
1860 
1861  if (default_cpp_symbol) {
1862  printer->Print(
1863  "// This CPP symbol can be defined to use imports that match up to the framework\n"
1864  "// imports needed when using CocoaPods.\n"
1865  "#if !defined($cpp_symbol$)\n"
1866  " #define $cpp_symbol$ 0\n"
1867  "#endif\n"
1868  "\n",
1869  "cpp_symbol", cpp_symbol);
1870  }
1871 
1872  printer->Print(
1873  "#if $cpp_symbol$\n",
1874  "cpp_symbol", cpp_symbol);
1875  for (const auto& header : header_to_import) {
1876  printer->Print(
1877  " #import <$framework_name$/$header$>\n",
1878  "framework_name", framework_name,
1879  "header", header);
1880  }
1881  printer->Print(
1882  "#else\n");
1883  for (const auto& header : header_to_import) {
1884  printer->Print(
1885  " #import \"$header$\"\n",
1886  "header", header);
1887  }
1888  printer->Print(
1889  "#endif\n");
1890 }
1891 
1895  return; // Nothing to do.
1896  }
1897 
1898  ProtoFrameworkCollector collector(&proto_file_to_framework_name_);
1901  &collector, &parse_error)) {
1902  std::cerr << "error parsing " << named_framework_to_proto_path_mappings_path_
1903  << " : " << parse_error << std::endl;
1904  std::cerr.flush();
1905  }
1906 }
1907 
1909  const StringPiece& line, std::string* out_error) {
1910  int offset = line.find(':');
1911  if (offset == StringPiece::npos) {
1912  *out_error =
1913  std::string("Framework/proto file mapping line without colon sign: '") +
1914  std::string(line) + "'.";
1915  return false;
1916  }
1917  StringPiece framework_name = line.substr(0, offset);
1918  StringPiece proto_file_list = line.substr(offset + 1);
1919  TrimWhitespace(&framework_name);
1920 
1921  int start = 0;
1922  while (start < proto_file_list.length()) {
1923  offset = proto_file_list.find(',', start);
1924  if (offset == StringPiece::npos) {
1925  offset = proto_file_list.length();
1926  }
1927 
1928  StringPiece proto_file = proto_file_list.substr(start, offset - start);
1929  TrimWhitespace(&proto_file);
1930  if (!proto_file.empty()) {
1932  map_->find(std::string(proto_file));
1933  if (existing_entry != map_->end()) {
1934  std::cerr << "warning: duplicate proto file reference, replacing "
1935  "framework entry for '"
1936  << std::string(proto_file) << "' with '" << std::string(framework_name)
1937  << "' (was '" << existing_entry->second << "')." << std::endl;
1938  std::cerr.flush();
1939  }
1940 
1941  if (proto_file.find(' ') != StringPiece::npos) {
1942  std::cerr << "note: framework mapping file had a proto file with a "
1943  "space in, hopefully that isn't a missing comma: '"
1944  << std::string(proto_file) << "'" << std::endl;
1945  std::cerr.flush();
1946  }
1947 
1948  (*map_)[std::string(proto_file)] = std::string(framework_name);
1949  }
1950 
1951  start = offset + 1;
1952  }
1953 
1954  return true;
1955 }
1956 
1957 } // namespace objectivec
1958 } // namespace compiler
1959 } // namespace protobuf
1960 } // namespace google
google::protobuf::compiler::objectivec::ProtobufLibraryFrameworkName
const char *const ProtobufLibraryFrameworkName
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:984
google::protobuf::compiler::objectivec::IsReferenceType
bool IsReferenceType(const FieldDescriptor *field)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:732
google::protobuf::FieldDescriptor::Type
Type
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:521
xds_interop_client.str
str
Definition: xds_interop_client.py:487
google::protobuf::compiler::objectivec::ParseSimpleFile
bool ParseSimpleFile(const string &path, LineConsumer *line_consumer, string *out_error)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1525
kAddUnderscore
static constexpr uint8_t kAddUnderscore
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1482
google::protobuf::io::Printer::Print
void Print(const std::map< std::string, std::string > &variables, const char *text)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/printer.cc:113
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
google::protobuf::compiler::objectivec::ImportWriter::other_framework_imports_
std::vector< string > other_framework_imports_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:306
google::protobuf::compiler::objectivec::OBJECTIVECTYPE_UINT32
@ OBJECTIVECTYPE_UINT32
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:139
google::protobuf::compiler::objectivec::FLAGTYPE_DESCRIPTOR_INITIALIZATION
@ FLAGTYPE_DESCRIPTOR_INITIALIZATION
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:152
google::protobuf::value
const Descriptor::ReservedRange value
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1954
google::protobuf::compiler::objectivec::FileClassPrefix
string FileClassPrefix(const FileDescriptor *file)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:398
google::protobuf::FieldDescriptor
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:515
absl::str_format_internal::LengthMod::j
@ j
google::protobuf::compiler::objectivec::ImportWriter::generate_for_named_framework_
const string generate_for_named_framework_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:298
google::protobuf::compiler::objectivec::ImportWriter::ProtoFrameworkCollector::map_
std::map< string, string > * map_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:293
find
static void ** find(grpc_chttp2_stream_map *map, uint32_t key)
Definition: stream_map.cc:99
google::protobuf::StringPiece::length
stringpiece_ssize_type length() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/stringpiece.h:249
google::protobuf::FieldDescriptor::CPPTYPE_STRING
@ CPPTYPE_STRING
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:562
google::protobuf::extension
const Descriptor::ReservedRange const EnumValueDescriptor const MethodDescriptor extension
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:2001
google::protobuf::compiler::objectivec::FilePathBasename
string FilePathBasename(const FileDescriptor *file)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:421
fix_build_deps.c
list c
Definition: fix_build_deps.py:490
google::protobuf::FieldDescriptor::TYPE_SFIXED64
@ TYPE_SFIXED64
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:542
google::protobuf::compiler::objectivec::BaseFileName
string BaseFileName(const FileDescriptor *file)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:392
line_
int line_
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1654
google::protobuf::compiler::objectivec::SetUseProtoPackageAsDefaultPrefix
void SetUseProtoPackageAsDefaultPrefix(bool on_or_off)
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:158
google::protobuf::compiler::objectivec::ObjCClassDeclaration
std::string ObjCClassDeclaration(const std::string &class_name)
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:734
google::protobuf::compiler::objectivec::OneofEnumName
string OneofEnumName(const OneofDescriptor *descriptor)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:563
google::protobuf::compiler::objectivec::FileClassName
string FileClassName(const FileDescriptor *file)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:434
google::protobuf::compiler::objectivec::DefaultValue
string DefaultValue(const FieldDescriptor *field)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:794
google::protobuf::compiler::objectivec::TextFormatDecodeData::Data
string Data() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1258
y
const double y
Definition: bloaty/third_party/googletest/googlemock/test/gmock-matchers_test.cc:3611
worker
static void worker(void *arg)
Definition: threadpool.c:57
google::protobuf::compiler::objectivec::ImportWriter::runtime_import_prefix_
const std::string runtime_import_prefix_
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:330
google::protobuf::compiler::objectivec::ObjCClass
std::string ObjCClass(const std::string &class_name)
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:730
buf
voidpf void * buf
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
FileDescriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:128
google::protobuf::compiler::objectivec::ClassName
string ClassName(const Descriptor *descriptor)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:460
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
google::protobuf::FieldDescriptor::TYPE_BYTES
@ TYPE_BYTES
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:538
google::protobuf::FieldDescriptor::TYPE_DOUBLE
@ TYPE_DOUBLE
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:522
file
Definition: bloaty/third_party/zlib/examples/gzappend.c:170
google::protobuf::CEscape
string CEscape(const string &src)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:615
google::protobuf
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:12
kMaxSegmentLen
static constexpr int kMaxSegmentLen
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1489
google::protobuf::compiler::objectivec::UnCamelCaseFieldName
string UnCamelCaseFieldName(const string &name, const FieldDescriptor *field)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:587
google::protobuf::FieldDescriptor::TYPE_BOOL
@ TYPE_BOOL
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:533
google::protobuf::compiler::objectivec::FLAGTYPE_FIELD
@ FLAGTYPE_FIELD
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:154
google::protobuf::compiler::objectivec::Options
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:50
setup.name
name
Definition: setup.py:542
words
std::vector< std::string > words
Definition: bloaty/third_party/protobuf/src/google/protobuf/repeated_field_unittest.cc:1787
check_documentation.path
path
Definition: check_documentation.py:57
google::protobuf::compiler::objectivec::HandleExtremeFloatingPoint
static string HandleExtremeFloatingPoint(string val, bool add_float_suffix)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:736
google::protobuf::SourceLocation
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:145
google::protobuf::compiler::objectivec::OBJECTIVECTYPE_DATA
@ OBJECTIVECTYPE_DATA
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:146
default_string
static upb_StringView default_string(upb_ToProto_Context *ctx, const upb_FieldDef *f)
Definition: def_to_proto.c:124
google::protobuf::compiler::objectivec::EnumValueName
string EnumValueName(const EnumValueDescriptor *descriptor)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:486
google::protobuf::ascii_tolower
char ascii_tolower(char c)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.h:94
google::protobuf::compiler::objectivec::ImportWriter::protobuf_imports_
std::vector< std::string > protobuf_imports_
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:335
google::protobuf::StringPiece::substr
StringPiece substr(size_type pos, size_type n=npos) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/stringpiece.cc:261
exceptions_
std::unordered_set< std::string > exceptions_
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:108
google::protobuf::FieldDescriptor::TYPE_GROUP
@ TYPE_GROUP
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:535
google::protobuf::SourceLocation::trailing_comments
std::string trailing_comments
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:154
uint8_t
unsigned char uint8_t
Definition: stdint-msvc2008.h:78
iterator
const typedef MCPhysReg * iterator
Definition: MCRegisterInfo.h:27
google::protobuf::FieldDescriptor::TYPE_INT64
@ TYPE_INT64
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:524
google::protobuf::compiler::objectivec::OBJECTIVECTYPE_UINT64
@ OBJECTIVECTYPE_UINT64
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:141
google::protobuf::StrCat
string StrCat(const AlphaNum &a, const AlphaNum &b)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:1482
Descriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:121
true
#define true
Definition: setup_once.h:324
google::protobuf::compiler::objectivec::ExtensionMethodName
string ExtensionMethodName(const FieldDescriptor *descriptor)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:532
google::protobuf::compiler::objectivec::ImportWriter::ImportWriter
ImportWriter(const string &generate_for_named_framework, const string &named_framework_to_proto_path_mappings_path, bool include_wkt_imports)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1557
google::protobuf::compiler::objectivec::OBJECTIVECTYPE_FLOAT
@ OBJECTIVECTYPE_FLOAT
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:142
google::protobuf::compiler::objectivec::ImportWriter::named_framework_to_proto_path_mappings_path_
const string named_framework_to_proto_path_mappings_path_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:299
google::protobuf::compiler::objectivec::EnumValueShortName
string EnumValueShortName(const EnumValueDescriptor *descriptor)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:501
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
google::protobuf::ascii_isupper
bool ascii_isupper(char c)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.h:82
google::protobuf::SourceLocation::leading_comments
std::string leading_comments
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:153
change-comments.lines
lines
Definition: change-comments.py:32
google::protobuf::compiler::objectivec::OBJECTIVECTYPE_DOUBLE
@ OBJECTIVECTYPE_DOUBLE
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:143
google::protobuf::compiler::objectivec::HasNonZeroDefaultValue
bool HasNonZeroDefaultValue(const FieldDescriptor *field)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:865
google::protobuf::compiler::objectivec::ImportWriter::other_imports_
std::vector< string > other_imports_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:307
ULL
#define ULL(x)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream_unittest.cc:57
FieldDescriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:133
google::protobuf::compiler::objectivec::LineConsumer::LineConsumer
LineConsumer()
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1521
google::protobuf::FieldDescriptor::TYPE_ENUM
@ TYPE_ENUM
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:540
op_
uint8_t op_
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1529
google::protobuf::ghtonl
uint32 ghtonl(uint32 x)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/common.cc:307
google::protobuf::StringPiece::npos
static const size_type npos
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/stringpiece.h:350
start
static uint64_t start
Definition: benchmark-pound.c:74
google::protobuf::compiler::objectivec::StripProto
string StripProto(const string &filename)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:359
google::protobuf::compiler::objectivec::ReadLine
bool ReadLine(StringPiece *input, StringPiece *line)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1014
google::protobuf::compiler::objectivec::ImportWriter::Print
void Print(io::Printer *printer) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1610
google::protobuf::compiler::objectivec::OBJECTIVECTYPE_ENUM
@ OBJECTIVECTYPE_ENUM
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:147
google::protobuf::compiler::objectivec::LineConsumer
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:261
profile_analyzer.builder
builder
Definition: profile_analyzer.py:159
kNSObjectMethodsList
const char *const kNSObjectMethodsList[]
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h:7
asyncio_get_stats.parser
parser
Definition: asyncio_get_stats.py:34
google::protobuf::compiler::objectivec::Options::prefixes_must_be_registered
bool prefixes_must_be_registered
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:71
exception_path_
std::string exception_path_
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:107
mox.Reset
def Reset(*args)
Definition: bloaty/third_party/protobuf/python/mox.py:257
google::protobuf::StripWhitespace
void StripWhitespace(string *str)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:113
google::protobuf::compiler::objectivec::ImportWriter::need_to_parse_mapping_file_
bool need_to_parse_mapping_file_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:302
gmock_output_test.output
output
Definition: bloaty/third_party/googletest/googlemock/test/gmock_output_test.py:175
google::protobuf::StringPiece::empty
bool empty() const
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/stringpiece.h:250
google::protobuf::compiler::objectivec::IsPrimitiveType
bool IsPrimitiveType(const FieldDescriptor *field)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:714
google::protobuf::compiler::objectivec::ImportWriter::ParseFrameworkMappings
void ParseFrameworkMappings()
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1673
use_package_name_
bool use_package_name_
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:106
google::protobuf::compiler::objectivec::Options::expected_prefixes_suppressions
std::vector< string > expected_prefixes_suppressions
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:53
google::protobuf::compiler::objectivec::OBJECTIVECTYPE_INT32
@ OBJECTIVECTYPE_INT32
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:138
google::protobuf::compiler::objectivec::IsInitName
bool IsInitName(const string &name)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:386
worker
Definition: worker.py:1
google::protobuf::compiler::objectivec::FlagType
FlagType
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:151
google::protobuf::FieldDescriptor::TYPE_FIXED32
@ TYPE_FIXED32
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:532
google::protobuf::io::FileInputStream::SetCloseOnDelete
void SetCloseOnDelete(bool value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h:83
google::protobuf::compiler::objectivec::RemoveComment
void RemoveComment(StringPiece *input)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1026
google::protobuf::StringPiece
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/stringpiece.h:180
google::protobuf::compiler::objectivec::TextFormatDecodeData::~TextFormatDecodeData
~TextFormatDecodeData()
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1237
google::protobuf::io::OstreamOutputStream
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h:259
google::protobuf::compiler::objectivec::BuildFlagsString
string BuildFlagsString(const FlagType flag_type, const std::vector< string > &strings)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:910
google::protobuf::SimpleFtoa
string SimpleFtoa(float value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:1226
google::protobuf::StripPrefixString
string StripPrefixString(const string &str, const string &prefix)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.h:121
header
struct absl::base_internal::@2940::AllocList::Header header
decode_data_
std::string decode_data_
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1532
google::protobuf::compiler::objectivec::TextFormatDecodeData::DecodeDataForString
static string DecodeDataForString(const string &input_for_decode, const string &desired_output)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1397
google::protobuf::ascii_isspace
bool ascii_isspace(char c)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.h:77
EnumValueDescriptor
Definition: protobuf/php/ext/google/protobuf/def.c:63
x
int x
Definition: bloaty/third_party/googletest/googlemock/test/gmock-matchers_test.cc:3610
data
char data[kBufferLength]
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1006
google::protobuf::compiler::objectivec::TrimWhitespace
void TrimWhitespace(StringPiece *input)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:367
google::protobuf::compiler::objectivec::FieldName
string FieldName(const FieldDescriptor *field)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:538
google::protobuf::compiler::objectivec::Options::expected_prefixes_path
string expected_prefixes_path
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:52
google::protobuf::compiler::objectivec::LineConsumer::~LineConsumer
virtual ~LineConsumer()
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1523
google::protobuf::compiler::objectivec::ImportWriter::proto_file_to_framework_name_
std::map< string, string > proto_file_to_framework_name_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:301
google::protobuf::FieldDescriptor::CPPTYPE_UINT64
@ CPPTYPE_UINT64
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:557
google::protobuf::compiler::objectivec::TextFormatDecodeData::TextFormatDecodeData
TextFormatDecodeData()
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1235
google::protobuf::io::FileInputStream
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h:65
google::protobuf::compiler::objectivec::TextFormatDecodeData::AddString
void AddString(int32 key, const string &input_for_decode, const string &desired_output)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1239
EnumDescriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:143
segment_len_
int segment_len_
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1530
google::protobuf::compiler::objectivec::GetCapitalizedType
string GetCapitalizedType(const FieldDescriptor *field)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:619
google::protobuf::HasPrefixString
bool HasPrefixString(const string &str, const string &prefix)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.h:115
google::protobuf::compiler::objectivec::FLAGTYPE_EXTENSION
@ FLAGTYPE_EXTENSION
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:153
google::protobuf::compiler::objectivec::OneofName
string OneofName(const OneofDescriptor *descriptor)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:571
msg
std::string msg
Definition: client_interceptors_end2end_test.cc:372
kOpFirstLower
static constexpr uint8_t kOpFirstLower
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1486
google::protobuf::compiler::objectivec::ValidateObjCClassPrefixes
bool ValidateObjCClassPrefixes(const std::vector< const FileDescriptor * > &files, const Options &generation_options, string *out_error)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1202
google::protobuf::compiler::objectivec::TextFormatDecodeData::DataEntry
std::pair< int32, string > DataEntry
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:256
google::protobuf::compiler::objectivec::OneofNameCapitalized
string OneofNameCapitalized(const OneofDescriptor *descriptor)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:578
class_name
static const char * class_name(int dnsclass)
Definition: adig.c:901
google::protobuf::io::Printer
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/printer.h:181
google::protobuf::compiler::objectivec::UnCamelCaseEnumShortName
string UnCamelCaseEnumShortName(const string &name)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:520
google::protobuf::io::CodedOutputStream
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream.h:1044
google::protobuf::io::ZeroCopyInputStream
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/zero_copy_stream.h:126
google::protobuf::compiler::objectivec::ClassNameWorker
string ClassNameWorker(const Descriptor *descriptor)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:442
google::protobuf::FieldDescriptor::CPPTYPE_INT64
@ CPPTYPE_INT64
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:555
google::protobuf::compiler::objectivec::FieldNameCapitalized
string FieldNameCapitalized(const FieldDescriptor *field)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:553
google::protobuf::FieldDescriptor::TYPE_SINT32
@ TYPE_SINT32
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:543
FATAL
#define FATAL(msg)
Definition: task.h:88
google::protobuf::compiler::objectivec::Options::require_prefixes
bool require_prefixes
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:72
google::protobuf::SimpleDtoa
string SimpleDtoa(double value)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:1221
need_underscore_
bool need_underscore_
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1527
google::protobuf::compiler::objectivec::ProtobufFrameworkImportSymbol
string ProtobufFrameworkImportSymbol(const string &framework_name)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:986
field
const FieldDescriptor * field
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/parser_unittest.cc:2692
key
const char * key
Definition: hpack_parser_table.cc:164
google::protobuf::FieldDescriptor::CPPTYPE_UINT32
@ CPPTYPE_UINT32
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:556
google::protobuf::FieldDescriptor::CPPTYPE_FLOAT
@ CPPTYPE_FLOAT
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:559
prefix_map_
std::map< std::string, std::string > * prefix_map_
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1195
google::protobuf::FieldDescriptor::TYPE_SINT64
@ TYPE_SINT64
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:544
suffix
unsigned char suffix[65536]
Definition: bloaty/third_party/zlib/examples/gun.c:164
bytes
uint8 bytes[10]
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/coded_stream_unittest.cc:153
regress.directory
directory
Definition: regress/regress.py:17
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
google::protobuf::compiler::objectivec::OBJECTIVECTYPE_INT64
@ OBJECTIVECTYPE_INT64
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:140
google::protobuf::compiler::objectivec::ObjectiveCType
ObjectiveCType
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:137
google::protobuf::FieldDescriptor::TYPE_FLOAT
@ TYPE_FLOAT
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:523
testing::internal::posix
Definition: bloaty/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:1963
count
int * count
Definition: bloaty/third_party/googletest/googlemock/test/gmock_stress_test.cc:96
OneofDescriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:138
benchmark::internal::Finish
double Finish(Counter const &c, IterationCount iterations, double cpu_time, double num_threads)
Definition: benchmark/src/counter.cc:20
google::protobuf::FieldDescriptor::TYPE_SFIXED32
@ TYPE_SFIXED32
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:541
google::protobuf::ascii_islower
bool ascii_islower(char c)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.h:86
google::protobuf::compiler::objectivec::OBJECTIVECTYPE_BOOLEAN
@ OBJECTIVECTYPE_BOOLEAN
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:144
google::protobuf::compiler::objectivec::OBJECTIVECTYPE_STRING
@ OBJECTIVECTYPE_STRING
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:145
google::protobuf::FieldDescriptor::CPPTYPE_BOOL
@ CPPTYPE_BOOL
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:560
google::protobuf::compiler::objectivec::GetProtoPackagePrefixExceptionList
std::string GetProtoPackagePrefixExceptionList()
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:162
google::protobuf::FieldDescriptor::CPPTYPE_DOUBLE
@ CPPTYPE_DOUBLE
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:558
google::protobuf::compiler::objectivec::SetProtoPackagePrefixExceptionList
void SetProtoPackagePrefixExceptionList(const std::string &file_path)
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:166
google::protobuf::ascii_isdigit
bool ascii_isdigit(char c)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.h:73
kOpAsIs
static constexpr uint8_t kOpAsIs
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1484
kOpAllUpper
static constexpr uint8_t kOpAllUpper
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1487
GOOGLE_ARRAYSIZE
#define GOOGLE_ARRAYSIZE(a)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/macros.h:88
google::protobuf::ascii_toupper
char ascii_toupper(char c)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.h:90
google::protobuf::FieldDescriptor::CPPTYPE_ENUM
@ CPPTYPE_ENUM
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:561
field_type
zend_class_entry * field_type
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/message.c:2030
values
std::array< int64_t, Size > values
Definition: abseil-cpp/absl/container/btree_benchmark.cc:608
prefix
static const char prefix[]
Definition: head_of_line_blocking.cc:28
regen-readme.line
line
Definition: regen-readme.py:30
google::protobuf::EnumValueDescriptor
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1075
google::protobuf::compiler::objectivec::OBJECTIVECTYPE_MESSAGE
@ OBJECTIVECTYPE_MESSAGE
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:148
google::protobuf::Split
std::vector< string > Split(const string &full, const char *delim, bool skip_empty=true)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.h:235
google::protobuf::Descriptor
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:231
google::protobuf::FieldDescriptor::TYPE_MESSAGE
@ TYPE_MESSAGE
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:536
set_
std::unordered_set< std::string > * set_
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:87
google::protobuf::compiler::objectivec::IsRetainedName
bool IsRetainedName(const string &name)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:377
google::protobuf::FieldDescriptor::TYPE_UINT32
@ TYPE_UINT32
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:539
google::protobuf::compiler::cpp::UnderscoresToCamelCase
std::string UnderscoresToCamelCase(const std::string &input, bool cap_next_letter)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc:247
leftover_
std::string leftover_
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1655
line_consumer_
LineConsumer * line_consumer_
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1653
input
std::string input
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer_unittest.cc:197
google::protobuf::ToUpper
string ToUpper(const string &s)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.h:193
google::protobuf::FieldDescriptor::TYPE_FIXED64
@ TYPE_FIXED64
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:531
google::protobuf::FileDescriptor
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1320
open
#define open
Definition: test-fs.c:46
google::protobuf::compiler::objectivec::IsProtobufLibraryBundledProtoFile
bool IsProtobufLibraryBundledProtoFile(const FileDescriptor *file)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:994
iter
Definition: test_winkernel.cpp:47
google::protobuf::FieldDescriptor::CPPTYPE_MESSAGE
@ CPPTYPE_MESSAGE
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:563
google::protobuf::compiler::objectivec::ImportWriter::ProtoFrameworkCollector::ConsumeLine
virtual bool ConsumeLine(const StringPiece &line, string *out_error)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1689
google::protobuf::compiler::objectivec::EnumName
string EnumName(const EnumDescriptor *descriptor)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:472
google::protobuf::HasSuffixString
bool HasSuffixString(const string &str, const string &suffix)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.h:137
google::protobuf::compiler::objectivec::ImportWriter::~ImportWriter
~ImportWriter()
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1568
google::protobuf::StringPiece::find
stringpiece_ssize_type find(StringPiece s, size_type pos=0) const
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/stringpiece.cc:104
asyncio_get_stats.type
type
Definition: asyncio_get_stats.py:37
len
int len
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46
google::protobuf::FieldDescriptor::TYPE_INT32
@ TYPE_INT32
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:528
file::name
char * name
Definition: bloaty/third_party/zlib/examples/gzappend.c:176
google::protobuf::io::ZeroCopyInputStream::Next
virtual bool Next(const void **data, int *size)=0
google::protobuf::compiler::objectivec::ImportWriter::include_wkt_imports_
const bool include_wkt_imports_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.h:300
google::protobuf::StripSuffixString
string StripSuffixString(const string &str, const string &suffix)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.h:143
length
std::size_t length
Definition: abseil-cpp/absl/time/internal/test_util.cc:57
int32_t
signed int int32_t
Definition: stdint-msvc2008.h:77
google::protobuf::EnumDescriptor
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:918
google::protobuf::compiler::objectivec::GetObjectiveCType
ObjectiveCType GetObjectiveCType(FieldDescriptor::Type field_type)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:665
GOOGLE_LOG
#define GOOGLE_LOG(LEVEL)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/logging.h:146
google::protobuf::compiler::objectivec::FilePath
string FilePath(const FileDescriptor *file)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:404
getenv
#define getenv(ptr)
Definition: ares_private.h:106
op
static grpc_op * op
Definition: test/core/fling/client.cc:47
google::protobuf::compiler::objectivec::EscapeTrigraphs
string EscapeTrigraphs(const string &to_escape)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:355
descriptor
static const char descriptor[1336]
Definition: certs.upbdefs.c:16
kOpFirstUpper
static constexpr uint8_t kOpFirstUpper
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1485
google::protobuf::compiler::objectivec::GPBGenericValueFieldName
string GPBGenericValueFieldName(const FieldDescriptor *field)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:754
amalgamate.files
list files
Definition: amalgamate.py:115
google::protobuf::FieldDescriptor::TYPE_STRING
@ TYPE_STRING
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:534
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
google::protobuf::compiler::objectivec::UseProtoPackageAsDefaultPrefix
bool UseProtoPackageAsDefaultPrefix()
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:154
google::protobuf::compiler::objectivec::ImportWriter::PrintRuntimeImports
static void PrintRuntimeImports(io::Printer *printer, const std::vector< std::string > &header_to_import, const std::string &runtime_import_prefix, bool default_cpp_symbol=false)
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1844
errno.h
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
google::protobuf::compiler::objectivec::ParseSimpleStream
bool ParseSimpleStream(io::ZeroCopyInputStream &input_stream, const std::string &stream_name, LineConsumer *line_consumer, std::string *out_error)
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1729
google::protobuf::compiler::objectivec::ImportWriter::AddFile
void AddFile(const FileDescriptor *file, const string &header_extension)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1570
offset
voidpf uLong offset
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:142
LL
#define LL(x)
google::protobuf::compiler::objectivec::BuildCommentsString
string BuildCommentsString(const SourceLocation &location, bool prefer_single_line)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:928
google::protobuf::FieldDescriptor::TYPE_UINT64
@ TYPE_UINT64
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:527
google::protobuf::compiler::objectivec::Options::Options
Options()
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:72
parse_error
@ parse_error
Definition: pem_info.c:88
is_all_upper_
bool is_all_upper_
Definition: protobuf/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc:1528
google::protobuf::FieldDescriptor::CPPTYPE_INT32
@ CPPTYPE_INT32
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:554


grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:34