This is an automated email from the ASF dual-hosted git repository.

jking pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new e7fa464  THRIFT-4586: Cocoa generator generates NSString with copy 
instead of strong. Client: [cocoa]
e7fa464 is described below

commit e7fa46458492a0243cde2ddd86e538c3b7cfd58e
Author: Kevin Carbone <[email protected]>
AuthorDate: Thu Jun 14 18:44:14 2018 -0700

    THRIFT-4586: Cocoa generator generates NSString with copy instead of strong.
    Client: [cocoa]
---
 compiler/cpp/src/thrift/generate/t_cocoa_generator.cc | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/compiler/cpp/src/thrift/generate/t_cocoa_generator.cc 
b/compiler/cpp/src/thrift/generate/t_cocoa_generator.cc
index 5bed2d7..ac644f5 100644
--- a/compiler/cpp/src/thrift/generate/t_cocoa_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_cocoa_generator.cc
@@ -238,6 +238,12 @@ public:
   std::string getter_name(string field_name);
   std::string setter_name(string field_name);
 
+  bool type_can_be_copy(t_type* ttype) {
+    ttype = get_true_type(ttype);
+    
+    return ttype->is_string();
+  }
+  
   bool type_can_be_null(t_type* ttype) {
     ttype = get_true_type(ttype);
 
@@ -3011,7 +3017,9 @@ string t_cocoa_generator::declare_property(t_field* 
tfield) {
   std::ostringstream render;
   render << "@property (";
 
-  if (type_can_be_null(tfield->get_type())) {
+  if (type_can_be_copy(tfield->get_type())) {
+    render << "copy, ";
+  } else if (type_can_be_null(tfield->get_type())) {
     render << "strong, ";
   } else {
     render << "assign, ";

Reply via email to