Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h

Issue 2590803003: Revert "third_party/protobuf: Update to HEAD (83d681ee2c)" (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved. 2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/ 3 // https://developers.google.com/protocol-buffers/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 140
141 // Get code that evaluates to the field's default value. 141 // Get code that evaluates to the field's default value.
142 string DefaultValue(const FieldDescriptor* field); 142 string DefaultValue(const FieldDescriptor* field);
143 143
144 // Convert a file name into a valid identifier. 144 // Convert a file name into a valid identifier.
145 string FilenameIdentifier(const string& filename); 145 string FilenameIdentifier(const string& filename);
146 146
147 // Return the name of the AddDescriptors() function for a given file. 147 // Return the name of the AddDescriptors() function for a given file.
148 string GlobalAddDescriptorsName(const string& filename); 148 string GlobalAddDescriptorsName(const string& filename);
149 149
150 // Return the name of the InitDefaults() function for a given file. 150 // Return the name of the AssignDescriptors() function for a given file.
151 string GlobalInitDefaultsName(const string& filename); 151 string GlobalAssignDescriptorsName(const string& filename);
152
153 // Return the name of the offset table function for a given file.
154 string GlobalOffsetTableName(const string& filename);
155 152
156 // Return the qualified C++ name for a file level symbol. 153 // Return the qualified C++ name for a file level symbol.
157 string QualifiedFileLevelSymbol(const string& package, const string& name); 154 string QualifiedFileLevelSymbol(const string& package, const string& name);
158 155
159 // Return the name of the ShutdownFile() function for a given file. 156 // Return the name of the ShutdownFile() function for a given file.
160 string GlobalShutdownFileName(const string& filename); 157 string GlobalShutdownFileName(const string& filename);
161 158
162 // Escape C++ trigraphs by escaping question marks to \? 159 // Escape C++ trigraphs by escaping question marks to \?
163 string EscapeTrigraphs(const string& to_escape); 160 string EscapeTrigraphs(const string& to_escape);
164 161
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 // size. 216 // size.
220 inline bool HasFastArraySerialization(const FileDescriptor* file, 217 inline bool HasFastArraySerialization(const FileDescriptor* file,
221 const Options& options) { 218 const Options& options) {
222 return GetOptimizeFor(file, options) == FileOptions::SPEED; 219 return GetOptimizeFor(file, options) == FileOptions::SPEED;
223 } 220 }
224 221
225 // Returns whether we have to generate code with static initializers. 222 // Returns whether we have to generate code with static initializers.
226 bool StaticInitializersForced(const FileDescriptor* file, 223 bool StaticInitializersForced(const FileDescriptor* file,
227 const Options& options); 224 const Options& options);
228 225
226 // Prints 'with_static_init' if static initializers have to be used for the
227 // provided file. Otherwise emits both 'with_static_init' and
228 // 'without_static_init' using #ifdef.
229 void PrintHandlingOptionalStaticInitializers(
230 const FileDescriptor* file, const Options& options, io::Printer* printer,
231 const char* with_static_init, const char* without_static_init,
232 const char* var1 = NULL, const string& val1 = "", const char* var2 = NULL,
233 const string& val2 = "");
234
235 void PrintHandlingOptionalStaticInitializers(const map<string, string>& vars,
236 const FileDescriptor* file,
237 const Options& options,
238 io::Printer* printer,
239 const char* with_static_init,
240 const char* without_static_init);
241
229 242
230 inline bool IsMapEntryMessage(const Descriptor* descriptor) { 243 inline bool IsMapEntryMessage(const Descriptor* descriptor) {
231 return descriptor->options().map_entry(); 244 return descriptor->options().map_entry();
232 } 245 }
233 246
234 // Returns true if the field's CPPTYPE is string or message. 247 // Returns true if the field's CPPTYPE is string or message.
235 bool IsStringOrMessage(const FieldDescriptor* field); 248 bool IsStringOrMessage(const FieldDescriptor* field);
236 249
237 // For a string field, returns the effective ctype. If the actual ctype is 250 // For a string field, returns the effective ctype. If the actual ctype is
238 // not supported, returns the default of STRING. 251 // not supported, returns the default of STRING.
(...skipping 23 matching lines...) Expand all
262 return SupportsArenas(field->file()); 275 return SupportsArenas(field->file());
263 } 276 }
264 277
265 bool IsAnyMessage(const FileDescriptor* descriptor); 278 bool IsAnyMessage(const FileDescriptor* descriptor);
266 bool IsAnyMessage(const Descriptor* descriptor); 279 bool IsAnyMessage(const Descriptor* descriptor);
267 280
268 bool IsWellKnownMessage(const FileDescriptor* descriptor); 281 bool IsWellKnownMessage(const FileDescriptor* descriptor);
269 282
270 void GenerateUtf8CheckCodeForString(const FieldDescriptor* field, 283 void GenerateUtf8CheckCodeForString(const FieldDescriptor* field,
271 const Options& options, bool for_parse, 284 const Options& options, bool for_parse,
272 const std::map<string, string>& variables, 285 const map<string, string>& variables,
273 const char* parameters, 286 const char* parameters,
274 io::Printer* printer); 287 io::Printer* printer);
275 288
276 void GenerateUtf8CheckCodeForCord(const FieldDescriptor* field, 289 void GenerateUtf8CheckCodeForCord(const FieldDescriptor* field,
277 const Options& options, bool for_parse, 290 const Options& options, bool for_parse,
278 const std::map<string, string>& variables, 291 const map<string, string>& variables,
279 const char* parameters, io::Printer* printer); 292 const char* parameters, io::Printer* printer);
280 293
281 inline ::google::protobuf::FileOptions_OptimizeMode GetOptimizeFor( 294 inline ::google::protobuf::FileOptions_OptimizeMode GetOptimizeFor(
282 const FileDescriptor* file, const Options& options) { 295 const FileDescriptor* file, const Options& options) {
283 return options.enforce_lite 296 return options.enforce_lite
284 ? FileOptions::LITE_RUNTIME 297 ? FileOptions::LITE_RUNTIME
285 : file->options().optimize_for(); 298 : file->options().optimize_for();
286 } 299 }
287 300
288 } // namespace cpp 301 } // namespace cpp
289 } // namespace compiler 302 } // namespace compiler
290 } // namespace protobuf 303 } // namespace protobuf
291 304
292 } // namespace google 305 } // namespace google
293 #endif // GOOGLE_PROTOBUF_COMPILER_CPP_HELPERS_H__ 306 #endif // GOOGLE_PROTOBUF_COMPILER_CPP_HELPERS_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698