]> granicus.if.org Git - clang/commitdiff
[objc migrator]: More knobs to do migration to
authorFariborz Jahanian <fjahanian@apple.com>
Fri, 5 Jul 2013 20:46:03 +0000 (20:46 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Fri, 5 Jul 2013 20:46:03 +0000 (20:46 +0000)
use of objc's properties.

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

include/clang/Edit/Rewriters.h
lib/ARCMigrate/ObjCMT.cpp
lib/Edit/RewriteObjCFoundationAPI.cpp

index 292878e75695dfb8c2b95293b8b26c5956027d60..cfb59dfa32c6c895f19fef4f2d8dea1d8a85d158 100644 (file)
@@ -12,6 +12,7 @@
 
 namespace clang {
   class ObjCMessageExpr;
+  class ObjCMethodDecl;
   class NSAPI;
   class ParentMap;
 
@@ -24,6 +25,10 @@ bool rewriteObjCRedundantCallWithLiteral(const ObjCMessageExpr *Msg,
 bool rewriteToObjCLiteralSyntax(const ObjCMessageExpr *Msg,
                                 const NSAPI &NS, Commit &commit,
                                 const ParentMap *PMap);
+  
+bool rewriteToObjCProperty(const ObjCMethodDecl *Getter,
+                           const ObjCMethodDecl *Setter,
+                           const NSAPI &NS, Commit &commit);
 
 bool rewriteToObjCSubscriptSyntax(const ObjCMessageExpr *Msg,
                                   const NSAPI &NS, Commit &commit);
index 696666ecde774be7a81827c7139d77f6d595472d..ec19f6e8f06be47cdf756aae9f8af3973bdbcb26 100644 (file)
@@ -212,15 +212,11 @@ void ObjCMigrateASTConsumer::migrateObjCInterfaceDecl(ASTContext &Ctx,
         continue;
       const ParmVarDecl *argDecl = *SetterMethod->param_begin();
       QualType ArgType = argDecl->getType();
-      if (!Ctx.hasSameType(ArgType, GRT)) {
-        bool Valid =
-          ((GRT->isObjCIdType() && ArgType->isObjCObjectPointerType())
-            || (ArgType->isObjCIdType() && GRT->isObjCObjectPointerType()));
-        if (!Valid)
+      if (!Ctx.hasSameType(ArgType, GRT))
           continue;
-      }
-      // we have a matching setter/getter pair.
-      // TODO. synthesize a suitable property declaration here.
+        edit::Commit commit(*Editor);
+        edit::rewriteToObjCProperty(Method, SetterMethod, *NSAPIObj, commit);
+        Editor->commit(commit);
       }
   }
 }
index f4206fbd8f4f406f93a25e7edfc37e1680c48a84..9af53037eacb6f8d8af57758a45aa2cc8f3458be 100644 (file)
@@ -355,6 +355,12 @@ bool edit::rewriteToObjCLiteralSyntax(const ObjCMessageExpr *Msg,
   return false;
 }
 
+bool edit::rewriteToObjCProperty(const ObjCMethodDecl *Getter,
+                                 const ObjCMethodDecl *Setter,
+                                 const NSAPI &NS, Commit &commit) {
+  return false;
+}
+
 /// \brief Returns true if the immediate message arguments of \c Msg should not
 /// be rewritten because it will interfere with the rewrite of the parent
 /// message expression. e.g.