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

Unified Diff: third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Update to new HEAD (b7632464b4) + restore GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc
diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc
index 2ad4d36a5834d6e5fcad91ad4f412c09e85d7d63..6d844cc2748d75c787ce04450cc9c696be9b4e31 100644
--- a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc
+++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc
@@ -415,7 +415,8 @@ string DefaultValue(const FieldDescriptor* field) {
CEscape(field->default_value_string())) +
"\"";
case FieldDescriptor::CPPTYPE_MESSAGE:
- return FieldMessageTypeName(field) + "::default_instance()";
+ return "*" + FieldMessageTypeName(field) +
+ "::internal_default_instance()";
}
// Can't actually get here; make compiler happy. (We could add a default
// case above but then we wouldn't get the nice compiler warning when a
@@ -444,6 +445,10 @@ string GlobalAddDescriptorsName(const string& filename) {
return "protobuf_AddDesc_" + FilenameIdentifier(filename);
}
+string GlobalInitDefaultsName(const string& filename) {
+ return "protobuf_InitDefaults_" + FilenameIdentifier(filename);
+}
+
// Return the name of the AssignDescriptors() function for a given file.
string GlobalAssignDescriptorsName(const string& filename) {
return "protobuf_AssignDesc_" + FilenameIdentifier(filename);
@@ -500,40 +505,6 @@ bool StaticInitializersForced(const FileDescriptor* file,
return false;
}
-void PrintHandlingOptionalStaticInitializers(
- const FileDescriptor* file, const Options& options, io::Printer* printer,
- const char* with_static_init, const char* without_static_init,
- const char* var1, const string& val1, const char* var2,
- const string& val2) {
- map<string, string> vars;
- if (var1) {
- vars[var1] = val1;
- }
- if (var2) {
- vars[var2] = val2;
- }
- PrintHandlingOptionalStaticInitializers(
- vars, file, options, printer, with_static_init, without_static_init);
-}
-
-void PrintHandlingOptionalStaticInitializers(const map<string, string>& vars,
- const FileDescriptor* file,
- const Options& options,
- io::Printer* printer,
- const char* with_static_init,
- const char* without_static_init) {
- if (StaticInitializersForced(file, options)) {
- printer->Print(vars, with_static_init);
- } else {
- printer->Print(vars, (string(
- "#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER\n") +
- without_static_init +
- "#else\n" +
- with_static_init +
- "#endif\n").c_str());
- }
-}
-
static bool HasMapFields(const Descriptor* descriptor) {
for (int i = 0; i < descriptor->field_count(); ++i) {

Powered by Google App Engine
This is Rietveld 408576698