diff options
author | 2015-06-24 09:00:09 -0700 | |
---|---|---|
committer | 2015-06-24 09:00:09 -0700 | |
commit | fbd735c5d76a860e75005090a89aa2ea88d8eb6c (patch) | |
tree | a2d15c207f332a122049c66289393e6e878ffb35 /src | |
parent | 659a43b5935f4afc9d00e1dd742e4210e000ab53 (diff) | |
parent | 242fdef65a3eb681ce686c0a68c7d33d4fb2ea1a (diff) |
Merge remote-tracking branch 'upstream/master' into fix_appveyor
Diffstat (limited to 'src')
-rw-r--r-- | src/google/protobuf/compiler/objectivec/objectivec_field.cc | 4 | ||||
-rw-r--r-- | src/google/protobuf/compiler/objectivec/objectivec_file.cc | 18 |
2 files changed, 13 insertions, 9 deletions
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_field.cc b/src/google/protobuf/compiler/objectivec/objectivec_field.cc index 0f96a4e6..cf5d8cfb 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_field.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_field.cc @@ -331,7 +331,7 @@ void ObjCObjFieldGenerator::GeneratePropertyDeclaration( } printer->Print( variables_, - "@property(nonatomic, readwrite, $property_storage_attribute$) $property_type$ *$name$$storage_attribute$;\n"); + "@property(nonatomic, readwrite, $property_storage_attribute$, null_resettable) $property_type$ *$name$$storage_attribute$;\n"); if (IsInitName(variables_.find("name")->second)) { // If property name starts with init we need to annotate it to get past ARC. // http://stackoverflow.com/questions/18723226/how-do-i-annotate-an-objective-c-property-with-an-objc-method-family/18723227#18723227 @@ -379,7 +379,7 @@ void RepeatedFieldGenerator::GeneratePropertyDeclaration( variables_, "$comments$" "$array_comment$" - "@property(nonatomic, readwrite, strong) $array_storage_type$ *$name$$storage_attribute$;\n" + "@property(nonatomic, readwrite, strong, null_resettable) $array_storage_type$ *$name$$storage_attribute$;\n" "@property(nonatomic, readonly) NSUInteger $name$_Count;\n"); if (IsInitName(variables_.find("name")->second)) { // If property name starts with init we need to annotate it to get past ARC. 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) { |