aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Jorge Canizales <jcanizales@google.com>2016-04-27 22:06:29 -0700
committerGravatar Jorge Canizales <jcanizales@google.com>2016-04-27 22:06:29 -0700
commite107f8e6884b2f8edec17869bbe0d42f35e88445 (patch)
treeb7d723b2f08cf6dadaf4502ecee2d2f147d206e9 /src
parente2fd65343e468735676485ba0e3517401c7db1b5 (diff)
parent1843ccb226c477798ed7dd25287cb9ef3a87c754 (diff)
Merge pull request #6205 from BenchR267/objc-nullability
Added nullability to service declaration in ObjC
Diffstat (limited to 'src')
-rw-r--r--src/compiler/objective_c_generator.cc6
-rw-r--r--src/compiler/objective_c_plugin.cc6
2 files changed, 8 insertions, 4 deletions
diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc
index ff092053ad..465491e385 100644
--- a/src/compiler/objective_c_generator.cc
+++ b/src/compiler/objective_c_generator.cc
@@ -75,11 +75,11 @@ void PrintMethodSignature(Printer *printer, const MethodDescriptor *method,
if (method->server_streaming()) {
printer->Print(vars,
" eventHandler:(void(^)(BOOL done, "
- "$response_class$ *response, NSError *error))eventHandler");
+ "$response_class$ *_Nullable response, NSError *_Nullable error))eventHandler");
} else {
printer->Print(vars,
- " handler:(void(^)($response_class$ *response, "
- "NSError *error))handler");
+ " handler:(void(^)($response_class$ *_Nullable response, "
+ "NSError *_Nullable error))handler");
}
}
diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc
index 17440358bb..3ccfd5b037 100644
--- a/src/compiler/objective_c_plugin.cc
+++ b/src/compiler/objective_c_plugin.cc
@@ -81,8 +81,12 @@ 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 kNonNullEnd = "\nNS_ASSUME_NONNULL_END\n";
+
Write(context, file_name + ".pbrpc.h",
- imports + '\n' + proto_imports + '\n' + declarations);
+ imports + '\n' + proto_imports + '\n' + kNonNullBegin +
+ declarations + kNonNullEnd);
}
{