| 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 e3df88b00a25c8a8e3cbee8a9d8cbd40451c3e63..25b05a85fda183a2ac750c8782da9ab0d23df4ce 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
|
| @@ -292,7 +292,8 @@ string DefaultValue(const FieldDescriptor* field) {
|
| ClassName(field->enum_type(), true),
|
| field->default_value_enum()->number());
|
| case FieldDescriptor::CPPTYPE_STRING:
|
| - return "\"" + CEscape(field->default_value_string()) + "\"";
|
| + return "\"" + EscapeTrigraphs(CEscape(field->default_value_string())) +
|
| + "\"";
|
| case FieldDescriptor::CPPTYPE_MESSAGE:
|
| return FieldMessageTypeName(field) + "::default_instance()";
|
| }
|
| @@ -335,6 +336,11 @@ string GlobalShutdownFileName(const string& filename) {
|
| return "protobuf_ShutdownFile_" + FilenameIdentifier(filename);
|
| }
|
|
|
| +// Escape C++ trigraphs by escaping question marks to \?
|
| +string EscapeTrigraphs(const string& to_escape) {
|
| + return StringReplace(to_escape, "?", "\\?", true);
|
| +}
|
| +
|
| } // namespace cpp
|
| } // namespace compiler
|
| } // namespace protobuf
|
|
|