r185724 - [objc migrator]: More knobs to do migration to
Fariborz Jahanian
fjahanian at apple.com
Fri Jul 5 13:46:03 PDT 2013
Author: fjahanian
Date: Fri Jul 5 15:46:03 2013
New Revision: 185724
URL: http://llvm.org/viewvc/llvm-project?rev=185724&view=rev
Log:
[objc migrator]: More knobs to do migration to
use of objc's properties.
Modified:
cfe/trunk/include/clang/Edit/Rewriters.h
cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
cfe/trunk/lib/Edit/RewriteObjCFoundationAPI.cpp
Modified: cfe/trunk/include/clang/Edit/Rewriters.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Edit/Rewriters.h?rev=185724&r1=185723&r2=185724&view=diff
==============================================================================
--- cfe/trunk/include/clang/Edit/Rewriters.h (original)
+++ cfe/trunk/include/clang/Edit/Rewriters.h Fri Jul 5 15:46:03 2013
@@ -12,6 +12,7 @@
namespace clang {
class ObjCMessageExpr;
+ class ObjCMethodDecl;
class NSAPI;
class ParentMap;
@@ -24,6 +25,10 @@ bool rewriteObjCRedundantCallWithLiteral
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);
Modified: cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ObjCMT.cpp?rev=185724&r1=185723&r2=185724&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Fri Jul 5 15:46:03 2013
@@ -212,15 +212,11 @@ void ObjCMigrateASTConsumer::migrateObjC
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);
}
}
}
Modified: cfe/trunk/lib/Edit/RewriteObjCFoundationAPI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Edit/RewriteObjCFoundationAPI.cpp?rev=185724&r1=185723&r2=185724&view=diff
==============================================================================
--- cfe/trunk/lib/Edit/RewriteObjCFoundationAPI.cpp (original)
+++ cfe/trunk/lib/Edit/RewriteObjCFoundationAPI.cpp Fri Jul 5 15:46:03 2013
@@ -355,6 +355,12 @@ bool edit::rewriteToObjCLiteralSyntax(co
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.
More information about the cfe-commits
mailing list