diff options
author | Vijay Pai <vpai@google.com> | 2017-11-22 09:18:35 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-22 09:18:35 -0800 |
commit | 0c000f6f6f385aa39fa882cd3940d14622a1f2f2 (patch) | |
tree | 67bd492fb5afff1b2c98b254d1758952a9bd493d /src | |
parent | bb9333c485fdb9e42d18667aa6c4f552e59323ef (diff) | |
parent | cf5a1f2c8162fbfefc0f4aa5d28e6a17d50a840f (diff) |
Merge pull request #12938 from gkelly/fix-variable-interpolation
Do not interpolate variables in leading comments.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/cpp_generator.cc | 2 | ||||
-rw-r--r-- | src/compiler/csharp_generator.cc | 2 | ||||
-rw-r--r-- | src/compiler/node_generator.cc | 2 | ||||
-rw-r--r-- | src/compiler/objective_c_generator.cc | 2 | ||||
-rw-r--r-- | src/compiler/php_generator.cc | 2 | ||||
-rw-r--r-- | src/compiler/protobuf_plugin.h | 1 | ||||
-rw-r--r-- | src/compiler/python_generator.cc | 2 | ||||
-rw-r--r-- | src/compiler/ruby_generator.cc | 2 | ||||
-rw-r--r-- | src/compiler/schema_interface.h | 1 |
9 files changed, 9 insertions, 7 deletions
diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index 3adf0fa451..dec8cd0f25 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -104,7 +104,7 @@ grpc::string GetHeaderPrologue(grpc_generator::File* file, grpc::string leading_comments = file->GetLeadingComments("//"); if (!leading_comments.empty()) { printer->Print(vars, "// Original file comments:\n"); - printer->Print(leading_comments.c_str()); + printer->PrintRaw(leading_comments.c_str()); } printer->Print(vars, "#ifndef GRPC_$filename_identifier$__INCLUDED\n"); printer->Print(vars, "#define GRPC_$filename_identifier$__INCLUDED\n"); diff --git a/src/compiler/csharp_generator.cc b/src/compiler/csharp_generator.cc index e0957bf9bb..40fe0b054a 100644 --- a/src/compiler/csharp_generator.cc +++ b/src/compiler/csharp_generator.cc @@ -666,7 +666,7 @@ grpc::string GetServices(const FileDescriptor* file, bool generate_client, grpc::string leading_comments = GetCsharpComments(file, true); if (!leading_comments.empty()) { out.Print("// Original file comments:\n"); - out.Print(leading_comments.c_str()); + out.PrintRaw(leading_comments.c_str()); } out.Print("#pragma warning disable 1591\n"); diff --git a/src/compiler/node_generator.cc b/src/compiler/node_generator.cc index ed835b4445..661587cbd6 100644 --- a/src/compiler/node_generator.cc +++ b/src/compiler/node_generator.cc @@ -250,7 +250,7 @@ grpc::string GenerateFile(const FileDescriptor* file) { grpc::string leading_comments = GetNodeComments(file, true); if (!leading_comments.empty()) { out.Print("// Original file comments:\n"); - out.Print(leading_comments.c_str()); + out.PrintRaw(leading_comments.c_str()); } out.Print("'use strict';\n"); diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc index 349f1dc281..8fe30e97e9 100644 --- a/src/compiler/objective_c_generator.cc +++ b/src/compiler/objective_c_generator.cc @@ -65,7 +65,7 @@ static void PrintAllComments(const DescriptorType* desc, Printer* printer) { printer->Print(" * "); size_t start_pos = it->find_first_not_of(' '); if (start_pos != grpc::string::npos) { - printer->Print(it->c_str() + start_pos); + printer->PrintRaw(it->c_str() + start_pos); } printer->Print("\n"); } diff --git a/src/compiler/php_generator.cc b/src/compiler/php_generator.cc index 1ff9520d7f..d9705e8077 100644 --- a/src/compiler/php_generator.cc +++ b/src/compiler/php_generator.cc @@ -164,7 +164,7 @@ grpc::string GenerateFile(const FileDescriptor* file, grpc::string leading_comments = GetPHPComments(file, "//"); if (!leading_comments.empty()) { out.Print("// Original file comments:\n"); - out.Print(leading_comments.c_str()); + out.PrintRaw(leading_comments.c_str()); } map<grpc::string, grpc::string> vars; diff --git a/src/compiler/protobuf_plugin.h b/src/compiler/protobuf_plugin.h index 1551908156..b971af1310 100644 --- a/src/compiler/protobuf_plugin.h +++ b/src/compiler/protobuf_plugin.h @@ -141,6 +141,7 @@ class ProtoBufPrinter : public grpc_generator::Printer { } void Print(const char* string) { printer_.Print(string); } + void PrintRaw(const char* string) { printer_.PrintRaw(string); } void Indent() { printer_.Indent(); } void Outdent() { printer_.Outdent(); } diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc index c1ae7d31ad..8a0b889454 100644 --- a/src/compiler/python_generator.cc +++ b/src/compiler/python_generator.cc @@ -101,7 +101,7 @@ void PrivateGenerator::PrintAllComments(StringVector comments, ++it) { size_t start_pos = it->find_first_not_of(' '); if (start_pos != grpc::string::npos) { - out->Print(it->c_str() + start_pos); + out->PrintRaw(it->c_str() + start_pos); } out->Print("\n"); } diff --git a/src/compiler/ruby_generator.cc b/src/compiler/ruby_generator.cc index ed7e074b47..e81dea603b 100644 --- a/src/compiler/ruby_generator.cc +++ b/src/compiler/ruby_generator.cc @@ -174,7 +174,7 @@ grpc::string GetServices(const FileDescriptor* file) { grpc::string leading_comments = GetRubyComments(file, true); if (!leading_comments.empty()) { out.Print("# Original file comments:\n"); - out.Print(leading_comments.c_str()); + out.PrintRaw(leading_comments.c_str()); } out.Print("\n"); diff --git a/src/compiler/schema_interface.h b/src/compiler/schema_interface.h index b2021f2926..c000478e68 100644 --- a/src/compiler/schema_interface.h +++ b/src/compiler/schema_interface.h @@ -86,6 +86,7 @@ struct Printer { virtual void Print(const std::map<grpc::string, grpc::string>& vars, const char* template_string) = 0; virtual void Print(const char* string) = 0; + virtual void PrintRaw(const char* string) = 0; virtual void Indent() = 0; virtual void Outdent() = 0; }; |