Skip to content

Commit 266926d

Browse files
author
Fariborz Jahanian
committed
[objc migrator]: More knobs to do migration to
use of objc's properties. llvm-svn: 185724
1 parent e283e19 commit 266926d

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

clang/include/clang/Edit/Rewriters.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
namespace clang {
1414
class ObjCMessageExpr;
15+
class ObjCMethodDecl;
1516
class NSAPI;
1617
class ParentMap;
1718

@@ -24,6 +25,10 @@ bool rewriteObjCRedundantCallWithLiteral(const ObjCMessageExpr *Msg,
2425
bool rewriteToObjCLiteralSyntax(const ObjCMessageExpr *Msg,
2526
const NSAPI &NS, Commit &commit,
2627
const ParentMap *PMap);
28+
29+
bool rewriteToObjCProperty(const ObjCMethodDecl *Getter,
30+
const ObjCMethodDecl *Setter,
31+
const NSAPI &NS, Commit &commit);
2732

2833
bool rewriteToObjCSubscriptSyntax(const ObjCMessageExpr *Msg,
2934
const NSAPI &NS, Commit &commit);

clang/lib/ARCMigrate/ObjCMT.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,11 @@ void ObjCMigrateASTConsumer::migrateObjCInterfaceDecl(ASTContext &Ctx,
212212
continue;
213213
const ParmVarDecl *argDecl = *SetterMethod->param_begin();
214214
QualType ArgType = argDecl->getType();
215-
if (!Ctx.hasSameType(ArgType, GRT)) {
216-
bool Valid =
217-
((GRT->isObjCIdType() && ArgType->isObjCObjectPointerType())
218-
|| (ArgType->isObjCIdType() && GRT->isObjCObjectPointerType()));
219-
if (!Valid)
215+
if (!Ctx.hasSameType(ArgType, GRT))
220216
continue;
221-
}
222-
// we have a matching setter/getter pair.
223-
// TODO. synthesize a suitable property declaration here.
217+
edit::Commit commit(*Editor);
218+
edit::rewriteToObjCProperty(Method, SetterMethod, *NSAPIObj, commit);
219+
Editor->commit(commit);
224220
}
225221
}
226222
}

clang/lib/Edit/RewriteObjCFoundationAPI.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,12 @@ bool edit::rewriteToObjCLiteralSyntax(const ObjCMessageExpr *Msg,
355355
return false;
356356
}
357357

358+
bool edit::rewriteToObjCProperty(const ObjCMethodDecl *Getter,
359+
const ObjCMethodDecl *Setter,
360+
const NSAPI &NS, Commit &commit) {
361+
return false;
362+
}
363+
358364
/// \brief Returns true if the immediate message arguments of \c Msg should not
359365
/// be rewritten because it will interfere with the rewrite of the parent
360366
/// message expression. e.g.

0 commit comments

Comments
 (0)