Fixed clang_format_code

pull/19733/head
Tony Lu 6 years ago
parent 431c5306ba
commit e76a5dd73c
  1. 4
      src/compiler/objective_c_generator_helpers.h
  2. 31
      src/compiler/objective_c_plugin.cc
  3. 56
      src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj
  4. 6
      src/objective-c/tests/InteropTests/InteropTests.m
  5. 2
      src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m
  6. 6
      src/objective-c/tests/MacTests/StressTests.m
  7. 2
      src/objective-c/tests/UnitTests/APIv2Tests.m
  8. 2
      src/objective-c/tests/UnitTests/GRPCClientTests.m

@ -22,7 +22,6 @@
#include <iostream>
using namespace std;
#include <map>
#include "src/compiler/config.h"
#include "src/compiler/generator_helpers.h"
@ -49,7 +48,8 @@ inline ::grpc::string LocalImport(const ::grpc::string& import) {
return ::grpc::string("#import \"" + import + "\"\n");
}
inline ::grpc::string FrameworkImport(const ::grpc::string& import, const ::grpc::string& framework) {
inline ::grpc::string FrameworkImport(const ::grpc::string& import,
const ::grpc::string& framework) {
// Flattens the directory structure
std::size_t pos = import.rfind("/");
::grpc::string filename = import.substr(pos + 1, import.size() - pos);

@ -29,8 +29,8 @@
using ::google::protobuf::compiler::objectivec::
IsProtobufLibraryBundledProtoFile;
using ::google::protobuf::compiler::objectivec::ProtobufLibraryFrameworkName;
using ::grpc_objective_c_generator::LocalImport;
using ::grpc_objective_c_generator::FrameworkImport;
using ::grpc_objective_c_generator::LocalImport;
using ::grpc_objective_c_generator::PreprocIfElse;
using ::grpc_objective_c_generator::PreprocIfNot;
using ::grpc_objective_c_generator::SystemImport;
@ -38,7 +38,8 @@ using ::grpc_objective_c_generator::SystemImport;
namespace {
inline ::grpc::string ImportProtoHeaders(
const grpc::protobuf::FileDescriptor* dep, const char* indent, const ::grpc::string &framework) {
const grpc::protobuf::FileDescriptor* dep, const char* indent,
const ::grpc::string& framework) {
::grpc::string header = grpc_objective_c_generator::MessageHeaderName(dep);
// cerr << header << endl;
@ -81,9 +82,12 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
}
::grpc::string framework;
std::vector<::grpc::string> params_list = grpc_generator::tokenize(parameter, ",");
for (auto param_str = params_list.begin(); param_str != params_list.end(); ++param_str) {
std::vector<::grpc::string> param = grpc_generator::tokenize(*param_str, "=");
std::vector<::grpc::string> params_list =
grpc_generator::tokenize(parameter, ",");
for (auto param_str = params_list.begin(); param_str != params_list.end();
++param_str) {
std::vector<::grpc::string> param =
grpc_generator::tokenize(*param_str, "=");
if (param[0] == "generate_for_named_framework") {
framework = param[1];
}
@ -100,7 +104,7 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
{
// Generate .pbrpc.h
::grpc::string imports;
if (framework.empty()) {
imports = LocalImport(file_name + ".pbobjc.h");
@ -126,7 +130,8 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
::grpc::string class_imports;
for (int i = 0; i < file->dependency_count(); i++) {
class_imports += ImportProtoHeaders(file->dependency(i), " ", framework);
class_imports +=
ImportProtoHeaders(file->dependency(i), " ", framework);
}
::grpc::string ng_protocols;
@ -164,14 +169,14 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
::grpc::string imports;
if (framework.empty()) {
imports = LocalImport(file_name + ".pbrpc.h") +
LocalImport(file_name + ".pbobjc.h") +
SystemImport("ProtoRPC/ProtoRPC.h") +
SystemImport("RxLibrary/GRXWriter+Immediate.h");
LocalImport(file_name + ".pbobjc.h") +
SystemImport("ProtoRPC/ProtoRPC.h") +
SystemImport("RxLibrary/GRXWriter+Immediate.h");
} else {
imports = FrameworkImport(file_name + ".pbrpc.h", framework) +
FrameworkImport(file_name + ".pbobjc.h", framework) +
SystemImport("ProtoRPC/ProtoRPC.h") +
SystemImport("RxLibrary/GRXWriter+Immediate.h");
FrameworkImport(file_name + ".pbobjc.h", framework) +
SystemImport("ProtoRPC/ProtoRPC.h") +
SystemImport("RxLibrary/GRXWriter+Immediate.h");
}
::grpc::string class_imports;

@ -12,7 +12,7 @@
6369A2761A9322E20015FC5C /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6369A2751A9322E20015FC5C /* ViewController.m */; };
6369A2791A9322E20015FC5C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6369A2771A9322E20015FC5C /* Main.storyboard */; };
6369A27B1A9322E20015FC5C /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6369A27A1A9322E20015FC5C /* Images.xcassets */; };
81BD5DEB744A906EF0708B68 /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6E85B2D77543A74F6CACF59A /* Pods_Sample.framework */; };
983179392696210F31F36D26 /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CCD4500A079C9D59E6CC5062 /* Pods_Sample.framework */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@ -25,9 +25,9 @@
6369A2751A9322E20015FC5C /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
6369A2781A9322E20015FC5C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
6369A27A1A9322E20015FC5C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
6E85B2D77543A74F6CACF59A /* Pods_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7544F97DDF1CB3F915E41CB9 /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = "<group>"; };
8BDAC28EF9131C53B2E6870D /* Pods-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.release.xcconfig"; path = "Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig"; sourceTree = "<group>"; };
CCD4500A079C9D59E6CC5062 /* Pods_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -35,7 +35,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
81BD5DEB744A906EF0708B68 /* Pods_Sample.framework in Frameworks */,
983179392696210F31F36D26 /* Pods_Sample.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -45,7 +45,7 @@
14C78F05D9C5E2D5F426D233 /* Frameworks */ = {
isa = PBXGroup;
children = (
6E85B2D77543A74F6CACF59A /* Pods_Sample.framework */,
CCD4500A079C9D59E6CC5062 /* Pods_Sample.framework */,
);
name = Frameworks;
sourceTree = "<group>";
@ -111,7 +111,7 @@
6369A2661A9322E20015FC5C /* Sources */,
6369A2671A9322E20015FC5C /* Frameworks */,
6369A2681A9322E20015FC5C /* Resources */,
BFA56A3C239159EE5FFE4D61 /* [CP] Embed Pods Frameworks */,
619CBF6DBB6BFE7F5B5A4777 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
@ -167,29 +167,7 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
B8CFD95B6470E21429BC7DF0 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Sample-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
BFA56A3C239159EE5FFE4D61 /* [CP] Embed Pods Frameworks */ = {
619CBF6DBB6BFE7F5B5A4777 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@ -221,6 +199,28 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
B8CFD95B6470E21429BC7DF0 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Sample-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */

@ -30,13 +30,13 @@
#import <GRPCClient/GRPCInterceptor.h>
#import <GRPCClient/internal_testing/GRPCCall+InternalTests.h>
#import <ProtoRPC/ProtoRPC.h>
#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h"
#import "src/objective-c/tests/RemoteTestClient/Test.pbobjc.h"
#import "src/objective-c/tests/RemoteTestClient/Test.pbrpc.h"
#import <RxLibrary/GRXBufferedPipe.h>
#import <RxLibrary/GRXWriter+Immediate.h>
#import <grpc/grpc.h>
#import <grpc/support/log.h>
#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h"
#import "src/objective-c/tests/RemoteTestClient/Test.pbobjc.h"
#import "src/objective-c/tests/RemoteTestClient/Test.pbrpc.h"
#import "../ConfigureCronet.h"
#import "InteropTestsBlockCallbacks.h"

@ -21,10 +21,10 @@
#ifdef GRPC_COMPILE_WITH_CRONET
#import <Cronet/Cronet.h>
#endif
#import <RxLibrary/GRXBufferedPipe.h>
#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h"
#import "src/objective-c/tests/RemoteTestClient/Test.pbobjc.h"
#import "src/objective-c/tests/RemoteTestClient/Test.pbrpc.h"
#import <RxLibrary/GRXBufferedPipe.h>
#import "../ConfigureCronet.h"
#import "InteropTestsBlockCallbacks.h"

@ -21,13 +21,13 @@
#import <GRPCClient/GRPCCall+Tests.h>
#import <GRPCClient/internal_testing/GRPCCall+InternalTests.h>
#import <ProtoRPC/ProtoRPC.h>
#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h"
#import "src/objective-c/tests/RemoteTestClient/Test.pbobjc.h"
#import "src/objective-c/tests/RemoteTestClient/Test.pbrpc.h"
#import <RxLibrary/GRXBufferedPipe.h>
#import <RxLibrary/GRXWriter+Immediate.h>
#import <grpc/grpc.h>
#import <grpc/support/log.h>
#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h"
#import "src/objective-c/tests/RemoteTestClient/Test.pbobjc.h"
#import "src/objective-c/tests/RemoteTestClient/Test.pbrpc.h"
#define TEST_TIMEOUT 32

@ -18,8 +18,8 @@
#import <GRPCClient/GRPCCall.h>
#import <ProtoRPC/ProtoMethod.h>
#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h"
#import <XCTest/XCTest.h>
#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h"
#include <grpc/grpc.h>
#include <grpc/support/port_platform.h>

@ -26,10 +26,10 @@
#import <GRPCClient/GRPCCall.h>
#import <GRPCClient/internal_testing/GRPCCall+InternalTests.h>
#import <ProtoRPC/ProtoMethod.h>
#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h"
#import <RxLibrary/GRXBufferedPipe.h>
#import <RxLibrary/GRXWriteable.h>
#import <RxLibrary/GRXWriter+Immediate.h>
#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h"
#include <netinet/in.h>

Loading…
Cancel
Save