diff options
author | kpayson64 <kpayson@google.com> | 2016-07-13 10:21:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-13 10:21:45 -0700 |
commit | d3d739284b3d450e5823387dd13a67ef2932de15 (patch) | |
tree | 527bad1a100832a8c2822d72e16ec513d420d51e /src/compiler/objective_c_plugin.cc | |
parent | 286ff57ffd8afdbbc954dc03cb1931fe7560224e (diff) | |
parent | ac59245624c7681b54ce30a9b0a073f645cce014 (diff) |
Merge pull request #6539 from soltanmm/clngfrmt-aoa
Add src/compiler to clang-formatting pass
Diffstat (limited to 'src/compiler/objective_c_plugin.cc')
-rw-r--r-- | src/compiler/objective_c_plugin.cc | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc index be64776402..8de0997ebe 100644 --- a/src/compiler/objective_c_plugin.cc +++ b/src/compiler/objective_c_plugin.cc @@ -42,7 +42,8 @@ #include <google/protobuf/compiler/objectivec/objectivec_helpers.h> using ::google::protobuf::compiler::objectivec::ProtobufLibraryFrameworkName; -using ::google::protobuf::compiler::objectivec::IsProtobufLibraryBundledProtoFile; +using ::google::protobuf::compiler::objectivec:: + IsProtobufLibraryBundledProtoFile; class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { public: @@ -53,7 +54,6 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { const ::grpc::string ¶meter, grpc::protobuf::compiler::GeneratorContext *context, ::grpc::string *error) const { - if (file->service_count() == 0) { // No services. Do nothing. return true; @@ -66,29 +66,32 @@ 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 <RxLibrary/GRXWriteable.h>\n" - "#import <RxLibrary/GRXWriter.h>\n"; + ".pbobjc.h\"\n\n" + "#import <ProtoRPC/ProtoService.h>\n" + "#import <RxLibrary/GRXWriteable.h>\n" + "#import <RxLibrary/GRXWriter.h>\n"; // TODO(jcanizales): Instead forward-declare the input and output types // and import the files in the .pbrpc.m ::grpc::string proto_imports; for (int i = 0; i < file->dependency_count(); i++) { - ::grpc::string header = grpc_objective_c_generator::MessageHeaderName( - file->dependency(i)); + ::grpc::string header = + grpc_objective_c_generator::MessageHeaderName(file->dependency(i)); const grpc::protobuf::FileDescriptor *dependency = file->dependency(i); if (IsProtobufLibraryBundledProtoFile(dependency)) { ::grpc::string base_name = header; grpc_generator::StripPrefix(&base_name, "google/protobuf/"); // create the import code snippet proto_imports += - "#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS\n" - " #import <" + ::grpc::string(ProtobufLibraryFrameworkName) + - "/" + base_name + ">\n" - "#else\n" - " #import \"" + header + "\"\n" - "#endif\n"; + "#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS\n" + " #import <" + + ::grpc::string(ProtobufLibraryFrameworkName) + "/" + base_name + + ">\n" + "#else\n" + " #import \"" + + header + + "\"\n" + "#endif\n"; } else { proto_imports += ::grpc::string("#import \"") + header + "\"\n"; } @@ -100,21 +103,22 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { declarations += grpc_objective_c_generator::GetHeader(service); } - static const ::grpc::string kNonNullBegin = "\nNS_ASSUME_NONNULL_BEGIN\n\n"; + static const ::grpc::string kNonNullBegin = + "\nNS_ASSUME_NONNULL_BEGIN\n\n"; static const ::grpc::string kNonNullEnd = "\nNS_ASSUME_NONNULL_END\n"; - Write(context, file_name + ".pbrpc.h", - imports + '\n' + proto_imports + '\n' + kNonNullBegin + - declarations + kNonNullEnd); + Write(context, file_name + ".pbrpc.h", imports + '\n' + proto_imports + + '\n' + kNonNullBegin + + declarations + kNonNullEnd); } { // Generate .pbrpc.m ::grpc::string imports = ::grpc::string("#import \"") + file_name + - ".pbrpc.h\"\n\n" - "#import <ProtoRPC/ProtoRPC.h>\n" - "#import <RxLibrary/GRXWriter+Immediate.h>\n"; + ".pbrpc.h\"\n\n" + "#import <ProtoRPC/ProtoRPC.h>\n" + "#import <RxLibrary/GRXWriter+Immediate.h>\n"; ::grpc::string definitions; for (int i = 0; i < file->service_count(); i++) { @@ -131,7 +135,7 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { private: // Write the given code into the given file. void Write(grpc::protobuf::compiler::GeneratorContext *context, - const ::grpc::string &filename, const ::grpc::string &code) const { + const ::grpc::string &filename, const ::grpc::string &code) const { std::unique_ptr<grpc::protobuf::io::ZeroCopyOutputStream> output( context->Open(filename)); grpc::protobuf::io::CodedOutputStream coded_out(output.get()); |