diff options
Diffstat (limited to 'src/compiler')
-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 | 3 | ||||
-rw-r--r-- | src/compiler/objective_c_generator.h | 1 | ||||
-rw-r--r-- | src/compiler/objective_c_plugin.cc | 20 | ||||
-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 |
11 files changed, 24 insertions, 14 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..ab7d869758 100644 --- a/src/compiler/objective_c_generator.cc +++ b/src/compiler/objective_c_generator.cc @@ -28,6 +28,7 @@ using ::google::protobuf::compiler::objectivec::ClassName; using ::grpc::protobuf::FileDescriptor; +using ::grpc::protobuf::FileDescriptor; using ::grpc::protobuf::MethodDescriptor; using ::grpc::protobuf::ServiceDescriptor; using ::grpc::protobuf::io::Printer; @@ -65,7 +66,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/objective_c_generator.h b/src/compiler/objective_c_generator.h index 2337abaf6a..d3aed76c4f 100644 --- a/src/compiler/objective_c_generator.h +++ b/src/compiler/objective_c_generator.h @@ -24,6 +24,7 @@ namespace grpc_objective_c_generator { using ::grpc::protobuf::FileDescriptor; +using ::grpc::protobuf::FileDescriptor; using ::grpc::protobuf::ServiceDescriptor; using ::grpc::string; diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc index 53ff81f94a..d5d488e84d 100644 --- a/src/compiler/objective_c_plugin.cc +++ b/src/compiler/objective_c_plugin.cc @@ -51,12 +51,15 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { { // Generate .pbrpc.h - ::grpc::string imports = ::grpc::string("#import \"") + file_name + - ".pbobjc.h\"\n\n" - "#import <ProtoRPC/ProtoService.h>\n" - "#import <ProtoRPC/ProtoRPC.h>\n" - "#import <RxLibrary/GRXWriteable.h>\n" - "#import <RxLibrary/GRXWriter.h>\n"; + ::grpc::string imports = + ::grpc::string("#if !GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO\n") + + "#import \"" + file_name + + ".pbobjc.h\"\n" + "#endif\n\n" + "#import <ProtoRPC/ProtoService.h>\n" + "#import <ProtoRPC/ProtoRPC.h>\n" + "#import <RxLibrary/GRXWriteable.h>\n" + "#import <RxLibrary/GRXWriter.h>\n"; ::grpc::string proto_imports; proto_imports += "#if GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO\n" + @@ -105,7 +108,10 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { // Generate .pbrpc.m ::grpc::string imports = ::grpc::string("#import \"") + file_name + - ".pbrpc.h\"\n\n" + ".pbrpc.h\"\n" + "#import \"" + + file_name + + ".pbobjc.h\"\n\n" "#import <ProtoRPC/ProtoRPC.h>\n" "#import <RxLibrary/GRXWriter+Immediate.h>\n"; for (int i = 0; i < file->dependency_count(); i++) { 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; }; |