aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/compiler/objectivec/objectivec_file.cc
diff options
context:
space:
mode:
authorGravatar Thomas Van Lenten <thomasvl@google.com>2015-06-16 16:45:14 -0400
committerGravatar Thomas Van Lenten <thomasvl@google.com>2015-06-16 17:04:50 -0400
commit8c88957ef375f3b739b6e72ea5c2fb71b12e1fc2 (patch)
tree31b4561aae2a11b1a9b4b7010dc9df10c52a4d72 /src/google/protobuf/compiler/objectivec/objectivec_file.cc
parent4cbb612299eaf8259db25f5dcda46022fbd1db54 (diff)
Add nonnil markup to ObjC library.
Add the clang annotations to the objc library and generated code to help with Swift bridging and compiler checks.
Diffstat (limited to 'src/google/protobuf/compiler/objectivec/objectivec_file.cc')
-rw-r--r--src/google/protobuf/compiler/objectivec/objectivec_file.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_file.cc b/src/google/protobuf/compiler/objectivec/objectivec_file.cc
index 1955c053..5a5c9e9b 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_file.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_file.cc
@@ -117,10 +117,10 @@ void FileGenerator::GenerateHeader(io::Printer *printer) {
printer->Print(
"// @@protoc_insertion_point(imports)\n"
+ "\n"
+ "CF_EXTERN_C_BEGIN\n"
"\n");
- printer->Print("CF_EXTERN_C_BEGIN\n\n");
-
set<string> fwd_decls;
for (vector<MessageGenerator *>::iterator iter = message_generators_.begin();
iter != message_generators_.end(); ++iter) {
@@ -134,6 +134,10 @@ void FileGenerator::GenerateHeader(io::Printer *printer) {
printer->Print("\n");
}
+ printer->Print(
+ "NS_ASSUME_NONNULL_BEGIN\n"
+ "\n");
+
// need to write out all enums first
for (vector<EnumGenerator *>::iterator iter = enum_generators_.begin();
iter != enum_generators_.end(); ++iter) {
@@ -148,7 +152,6 @@ void FileGenerator::GenerateHeader(io::Printer *printer) {
// For extensions to chain together, the Root gets created even if there
// are no extensions.
printer->Print(
- "\n"
"#pragma mark - $root_class_name$\n"
"\n"
"@interface $root_class_name$ : GPBRootObject\n"
@@ -182,11 +185,12 @@ void FileGenerator::GenerateHeader(io::Printer *printer) {
(*iter)->GenerateMessageHeader(printer);
}
- printer->Print("CF_EXTERN_C_END\n");
-
printer->Print(
- "\n"
- "// @@protoc_insertion_point(global_scope)\n");
+ "NS_ASSUME_NONNULL_END\n"
+ "\n"
+ "CF_EXTERN_C_END\n"
+ "\n"
+ "// @@protoc_insertion_point(global_scope)\n");
}
void FileGenerator::GenerateSource(io::Printer *printer) {