]> granicus.if.org Git - clang/commitdiff
ObjectiveC migrator. Introduce a new print policy for
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 9 Oct 2013 17:37:28 +0000 (17:37 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 9 Oct 2013 17:37:28 +0000 (17:37 +0000)
suppression of strong lifetime qualifiers when
inferring property. // rdar://15082812

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192305 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/PrettyPrinter.h
lib/ARCMigrate/ObjCMT.cpp
lib/AST/TypePrinter.cpp
test/ARCMT/objcmt-property.m.result

index adfd1ac936b9f2da4b2aff671b1134753bf02d75..76426991cf47b5a410f629bfe1c9dc78949ba56b 100644 (file)
@@ -39,8 +39,8 @@ struct PrintingPolicy {
       SuppressTagKeyword(false), SuppressTag(false), SuppressScope(false),
       SuppressUnwrittenScope(false), SuppressInitializers(false),
       ConstantArraySizeAsWritten(false), AnonymousTagLocations(true),
-      SuppressStrongLifetime(false), Bool(LO.Bool),
-      TerseOutput(false), PolishForDeclaration(false),
+      SuppressStrongLifetime(false), SuppressLifetimeQualifiers(false),
+      Bool(LO.Bool), TerseOutput(false), PolishForDeclaration(false),
       MSWChar(LO.MicrosoftExt && !LO.WChar) { }
 
   /// \brief What language we're printing.
@@ -132,6 +132,10 @@ struct PrintingPolicy {
   /// ARC.
   unsigned SuppressStrongLifetime : 1;
   
+  /// \brief When true, suppress printing of lifetime qualifier in
+  /// ARC.
+  unsigned SuppressLifetimeQualifiers : 1;
+  
   /// \brief Whether we can use 'bool' rather than '_Bool', even if the language
   /// doesn't actually have 'bool' (because, e.g., it is defined as a macro).
   unsigned Bool : 1;
index 8d5395ae3cf060021c9c21bfd4175c1251e9cbc7..f1ab4fca32a389c8042ede755f8fca3a2627ef86 100644 (file)
@@ -324,6 +324,7 @@ static bool rewriteToObjCProperty(const ObjCMethodDecl *Getter,
   PropertyString += " ";
   PrintingPolicy SubPolicy(Context.getPrintingPolicy());
   SubPolicy.SuppressStrongLifetime = true;
+  SubPolicy.SuppressLifetimeQualifiers = true;
   std::string TypeString = RT.getAsString(SubPolicy);
   if (LengthOfPrefix > 0) {
     // property name must strip off "is" and lower case the first character
index ec7559c2f512cd365267890a9d1a83e31a2ca8d8..571e3db0289f2b318f3f9cde440154603bf7b3dd 100644 (file)
@@ -36,7 +36,8 @@ namespace {
   public:
     explicit IncludeStrongLifetimeRAII(PrintingPolicy &Policy) 
       : Policy(Policy), Old(Policy.SuppressStrongLifetime) {
-      Policy.SuppressStrongLifetime = false;
+        if (!Policy.SuppressLifetimeQualifiers)
+          Policy.SuppressStrongLifetime = false;
     }
     
     ~IncludeStrongLifetimeRAII() {
index 29559bfb35a6da48bc34b4dbc7d14e04cefb0efc..bd9b38bd48434270eaa6659bf3225e0590459cbe 100644 (file)
@@ -223,7 +223,7 @@ DEPRECATED
 @property (nonatomic, readonly) id (^expressionBlock)(id, NSArray *, NSMutableDictionary *);
 @property (nonatomic, copy) id (^MyBlock)(id, NSArray *, NSMutableDictionary *);
 
-@property (nonatomic, readonly) id (*expressionFuncptr)(__strong id, NSArray *__strong, NSMutableDictionary *__strong);
-@property (nonatomic) id (*MyFuncptr)(__strong id, NSArray *__strong, NSMutableDictionary *__strong);
+@property (nonatomic, readonly) id (*expressionFuncptr)(id, NSArray *, NSMutableDictionary *);
+@property (nonatomic) id (*MyFuncptr)(id, NSArray *, NSMutableDictionary *);
 
 @end