blob: 0c8d15544610e4abddd5a8a08450fa352c697749 [file] [log] [blame]
Benjamin Kramerd81108f2012-11-14 15:08:31 +00001//===--- TransRetainReleaseDealloc.cpp - Transformations to ARC mode ------===//
Argyrios Kyrtzidise5b475c2011-06-21 20:20:39 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// removeRetainReleaseDealloc:
11//
12// Removes retain/release/autorelease/dealloc messages.
13//
14// return [[foo retain] autorelease];
15// ---->
16// return foo;
17//
18//===----------------------------------------------------------------------===//
19
20#include "Transforms.h"
21#include "Internals.h"
Benjamin Kramer4ab984e2012-07-04 20:19:54 +000022#include "clang/AST/ASTContext.h"
Argyrios Kyrtzidise5b475c2011-06-21 20:20:39 +000023#include "clang/AST/ParentMap.h"
Ted Kremenekf7639e12012-03-06 20:06:33 +000024#include "clang/Basic/SourceManager.h"
Benjamin Kramer4ab984e2012-07-04 20:19:54 +000025#include "clang/Lex/Lexer.h"
26#include "clang/Sema/SemaDiagnostic.h"
Benjamin Kramerd7d2b1f2012-12-01 16:35:25 +000027#include "llvm/ADT/StringSwitch.h"
Argyrios Kyrtzidise5b475c2011-06-21 20:20:39 +000028
29using namespace clang;
30using namespace arcmt;
31using namespace trans;
Argyrios Kyrtzidise5b475c2011-06-21 20:20:39 +000032
33namespace {
34
35class RetainReleaseDeallocRemover :
36 public RecursiveASTVisitor<RetainReleaseDeallocRemover> {
Argyrios Kyrtzidise5b475c2011-06-21 20:20:39 +000037 Stmt *Body;
38 MigrationPass &Pass;
39
40 ExprSet Removables;
Dylan Noblesmithe2778992012-02-05 02:12:40 +000041 OwningPtr<ParentMap> StmtMap;
Argyrios Kyrtzidise5b475c2011-06-21 20:20:39 +000042
Argyrios Kyrtzidisd2b91122011-11-04 15:58:22 +000043 Selector DelegateSel, FinalizeSel;
Argyrios Kyrtzidisa6fe4bf2011-07-15 23:48:56 +000044
Argyrios Kyrtzidise5b475c2011-06-21 20:20:39 +000045public:
Argyrios Kyrtzidis0b2bd862011-06-23 21:21:33 +000046 RetainReleaseDeallocRemover(MigrationPass &pass)
Argyrios Kyrtzidisa6fe4bf2011-07-15 23:48:56 +000047 : Body(0), Pass(pass) {
48 DelegateSel =
49 Pass.Ctx.Selectors.getNullarySelector(&Pass.Ctx.Idents.get("delegate"));
Argyrios Kyrtzidisd2b91122011-11-04 15:58:22 +000050 FinalizeSel =
51 Pass.Ctx.Selectors.getNullarySelector(&Pass.Ctx.Idents.get("finalize"));
Argyrios Kyrtzidisa6fe4bf2011-07-15 23:48:56 +000052 }
Argyrios Kyrtzidise5b475c2011-06-21 20:20:39 +000053
Argyrios Kyrtzidisb03cc792012-06-07 00:44:06 +000054 void transformBody(Stmt *body, Decl *ParentD) {
Argyrios Kyrtzidise5b475c2011-06-21 20:20:39 +000055 Body = body;
56 collectRemovables(body, Removables);
57 StmtMap.reset(new ParentMap(body));
58 TraverseStmt(body);
59 }
60
61 bool VisitObjCMessageExpr(ObjCMessageExpr *E) {
62 switch (E->getMethodFamily()) {
63 default:
Argyrios Kyrtzidisd2b91122011-11-04 15:58:22 +000064 if (E->isInstanceMessage() && E->getSelector() == FinalizeSel)
65 break;
Argyrios Kyrtzidise5b475c2011-06-21 20:20:39 +000066 return true;
Argyrios Kyrtzidis84b528f2011-07-14 21:26:49 +000067 case OMF_autorelease:
Argyrios Kyrtzidis937bcb22012-05-21 17:48:31 +000068 if (isRemovable(E)) {
Argyrios Kyrtzidis0b21d822012-05-23 21:50:04 +000069 if (!isCommonUnusedAutorelease(E)) {
70 // An unused autorelease is badness. If we remove it the receiver
71 // will likely die immediately while previously it was kept alive
72 // by the autorelease pool. This is bad practice in general, leave it
73 // and emit an error to force the user to restructure his code.
74 Pass.TA.reportError("it is not safe to remove an unused 'autorelease' "
75 "message; its receiver may be destroyed immediately",
76 E->getLocStart(), E->getSourceRange());
77 return true;
78 }
Argyrios Kyrtzidis937bcb22012-05-21 17:48:31 +000079 }
80 // Pass through.
Argyrios Kyrtzidise5b475c2011-06-21 20:20:39 +000081 case OMF_retain:
82 case OMF_release:
Argyrios Kyrtzidise5b475c2011-06-21 20:20:39 +000083 if (E->getReceiverKind() == ObjCMessageExpr::Instance)
84 if (Expr *rec = E->getInstanceReceiver()) {
85 rec = rec->IgnoreParenImpCasts();
Argyrios Kyrtzidis08903e42011-07-14 22:46:12 +000086 if (rec->getType().getObjCLifetime() == Qualifiers::OCL_ExplicitNone &&
87 (E->getMethodFamily() != OMF_retain || isRemovable(E))) {
Argyrios Kyrtzidis84b528f2011-07-14 21:26:49 +000088 std::string err = "it is not safe to remove '";
Argyrios Kyrtzidise5b475c2011-06-21 20:20:39 +000089 err += E->getSelector().getAsString() + "' message on "
90 "an __unsafe_unretained type";
91 Pass.TA.reportError(err, rec->getLocStart());
92 return true;
93 }
Argyrios Kyrtzidisf2a27f42011-07-14 23:32:04 +000094
95 if (isGlobalVar(rec) &&
96 (E->getMethodFamily() != OMF_retain || isRemovable(E))) {
97 std::string err = "it is not safe to remove '";
98 err += E->getSelector().getAsString() + "' message on "
99 "a global variable";
100 Pass.TA.reportError(err, rec->getLocStart());
101 return true;
102 }
Argyrios Kyrtzidisa6fe4bf2011-07-15 23:48:56 +0000103
104 if (E->getMethodFamily() == OMF_release && isDelegateMessage(rec)) {
105 Pass.TA.reportError("it is not safe to remove 'retain' "
106 "message on the result of a 'delegate' message; "
107 "the object that was passed to 'setDelegate:' may not be "
108 "properly retained", rec->getLocStart());
109 return true;
110 }
Argyrios Kyrtzidise5b475c2011-06-21 20:20:39 +0000111 }
112 case OMF_dealloc:
113 break;
114 }
115
116 switch (E->getReceiverKind()) {
117 default:
118 return true;
119 case ObjCMessageExpr::SuperInstance: {
120 Transaction Trans(Pass.TA);
Argyrios Kyrtzidis6a8a14d2011-07-15 21:11:23 +0000121 clearDiagnostics(E->getSuperLoc());
Argyrios Kyrtzidise5b475c2011-06-21 20:20:39 +0000122 if (tryRemoving(E))
123 return true;
124 Pass.TA.replace(E->getSourceRange(), "self");
125 return true;
126 }
127 case ObjCMessageExpr::Instance:
128 break;
129 }
130
131 Expr *rec = E->getInstanceReceiver();
132 if (!rec) return true;
133
134 Transaction Trans(Pass.TA);
Argyrios Kyrtzidis6a8a14d2011-07-15 21:11:23 +0000135 clearDiagnostics(rec->getExprLoc());
136
Ted Kremenekf7639e12012-03-06 20:06:33 +0000137 ObjCMessageExpr *Msg = E;
138 Expr *RecContainer = Msg;
139 SourceRange RecRange = rec->getSourceRange();
140 checkForGCDOrXPC(Msg, RecContainer, rec, RecRange);
141
142 if (Msg->getMethodFamily() == OMF_release &&
143 isRemovable(RecContainer) && isInAtFinally(RecContainer)) {
Argyrios Kyrtzidisf59daff2011-07-15 22:04:00 +0000144 // Change the -release to "receiver = nil" in a finally to avoid a leak
Argyrios Kyrtzidis6a8a14d2011-07-15 21:11:23 +0000145 // when an exception is thrown.
Ted Kremenekf7639e12012-03-06 20:06:33 +0000146 Pass.TA.replace(RecContainer->getSourceRange(), RecRange);
Argyrios Kyrtzidis93907472011-07-27 05:28:18 +0000147 std::string str = " = ";
148 str += getNilString(Pass.Ctx);
Ted Kremenekf7639e12012-03-06 20:06:33 +0000149 Pass.TA.insertAfterToken(RecRange.getEnd(), str);
Argyrios Kyrtzidis6a8a14d2011-07-15 21:11:23 +0000150 return true;
151 }
152
Ted Kremenekf7639e12012-03-06 20:06:33 +0000153 if (!hasSideEffects(rec, Pass.Ctx)) {
154 if (tryRemoving(RecContainer))
Argyrios Kyrtzidise5b475c2011-06-21 20:20:39 +0000155 return true;
156 }
Ted Kremenekf7639e12012-03-06 20:06:33 +0000157 Pass.TA.replace(RecContainer->getSourceRange(), RecRange);
Argyrios Kyrtzidise5b475c2011-06-21 20:20:39 +0000158
159 return true;
160 }
161
162private:
Argyrios Kyrtzidis0b21d822012-05-23 21:50:04 +0000163 /// \brief Checks for idioms where an unused -autorelease is common.
164 ///
Argyrios Kyrtzidisb7b89b52013-01-04 18:29:59 +0000165 /// Returns true for this idiom which is common in property
Argyrios Kyrtzidis0b21d822012-05-23 21:50:04 +0000166 /// setters:
167 ///
168 /// [backingValue autorelease];
169 /// backingValue = [newValue retain]; // in general a +1 assign
170 ///
Argyrios Kyrtzidisb7b89b52013-01-04 18:29:59 +0000171 /// For these as well:
172 ///
173 /// [[var retain] autorelease];
174 /// return var;
175 ///
Argyrios Kyrtzidis0b21d822012-05-23 21:50:04 +0000176 bool isCommonUnusedAutorelease(ObjCMessageExpr *E) {
Argyrios Kyrtzidisd12c3322013-01-04 18:30:11 +0000177 if (isPlusOneAssignBeforeOrAfterAutorelease(E))
Argyrios Kyrtzidisb7b89b52013-01-04 18:29:59 +0000178 return true;
179 if (isReturnedAfterAutorelease(E))
180 return true;
181 return false;
182 }
183
184 bool isReturnedAfterAutorelease(ObjCMessageExpr *E) {
Argyrios Kyrtzidis0b21d822012-05-23 21:50:04 +0000185 Expr *Rec = E->getInstanceReceiver();
186 if (!Rec)
187 return false;
188
189 Decl *RefD = getReferencedDecl(Rec);
190 if (!RefD)
191 return false;
192
Argyrios Kyrtzidisb7b89b52013-01-04 18:29:59 +0000193 Stmt *nextStmt = getNextStmt(E);
194 if (!nextStmt)
195 return false;
196
197 // Check for "return <variable>;".
198
199 if (ReturnStmt *RetS = dyn_cast<ReturnStmt>(nextStmt))
200 return RefD == getReferencedDecl(RetS->getRetValue());
201
202 return false;
203 }
204
Argyrios Kyrtzidisd12c3322013-01-04 18:30:11 +0000205 bool isPlusOneAssignBeforeOrAfterAutorelease(ObjCMessageExpr *E) {
Argyrios Kyrtzidisb7b89b52013-01-04 18:29:59 +0000206 Expr *Rec = E->getInstanceReceiver();
207 if (!Rec)
208 return false;
209
210 Decl *RefD = getReferencedDecl(Rec);
211 if (!RefD)
212 return false;
213
Argyrios Kyrtzidisd12c3322013-01-04 18:30:11 +0000214 Stmt *prevStmt, *nextStmt;
215 llvm::tie(prevStmt, nextStmt) = getPreviousAndNextStmt(E);
216
217 return isPlusOneAssignToVar(prevStmt, RefD) ||
218 isPlusOneAssignToVar(nextStmt, RefD);
219 }
220
221 bool isPlusOneAssignToVar(Stmt *S, Decl *RefD) {
222 if (!S)
Argyrios Kyrtzidisb7b89b52013-01-04 18:29:59 +0000223 return false;
224
225 // Check for "RefD = [+1 retained object];".
226
Argyrios Kyrtzidisd12c3322013-01-04 18:30:11 +0000227 if (BinaryOperator *Bop = dyn_cast<BinaryOperator>(S)) {
Argyrios Kyrtzidisb7b89b52013-01-04 18:29:59 +0000228 if (RefD != getReferencedDecl(Bop->getLHS()))
229 return false;
230 if (isPlusOneAssign(Bop))
231 return true;
Argyrios Kyrtzidisd12c3322013-01-04 18:30:11 +0000232 return false;
Argyrios Kyrtzidisb7b89b52013-01-04 18:29:59 +0000233 }
Argyrios Kyrtzidisd12c3322013-01-04 18:30:11 +0000234
235 if (DeclStmt *DS = dyn_cast<DeclStmt>(S)) {
236 if (DS->isSingleDecl() && DS->getSingleDecl() == RefD) {
237 if (VarDecl *VD = dyn_cast<VarDecl>(RefD))
238 return isPlusOne(VD->getInit());
239 }
240 return false;
241 }
242
Argyrios Kyrtzidisb7b89b52013-01-04 18:29:59 +0000243 return false;
244 }
245
246 Stmt *getNextStmt(Expr *E) {
Argyrios Kyrtzidisd12c3322013-01-04 18:30:11 +0000247 return getPreviousAndNextStmt(E).second;
248 }
249
250 std::pair<Stmt *, Stmt *> getPreviousAndNextStmt(Expr *E) {
251 Stmt *prevStmt = 0, *nextStmt = 0;
Argyrios Kyrtzidisb7b89b52013-01-04 18:29:59 +0000252 if (!E)
Argyrios Kyrtzidisd12c3322013-01-04 18:30:11 +0000253 return std::make_pair(prevStmt, nextStmt);
Argyrios Kyrtzidisb7b89b52013-01-04 18:29:59 +0000254
Argyrios Kyrtzidis0b21d822012-05-23 21:50:04 +0000255 Stmt *OuterS = E, *InnerS;
256 do {
257 InnerS = OuterS;
258 OuterS = StmtMap->getParent(InnerS);
259 }
260 while (OuterS && (isa<ParenExpr>(OuterS) ||
261 isa<CastExpr>(OuterS) ||
262 isa<ExprWithCleanups>(OuterS)));
263
264 if (!OuterS)
Argyrios Kyrtzidisd12c3322013-01-04 18:30:11 +0000265 return std::make_pair(prevStmt, nextStmt);
Argyrios Kyrtzidis0b21d822012-05-23 21:50:04 +0000266
267 Stmt::child_iterator currChildS = OuterS->child_begin();
268 Stmt::child_iterator childE = OuterS->child_end();
Argyrios Kyrtzidisd12c3322013-01-04 18:30:11 +0000269 Stmt::child_iterator prevChildS = childE;
Argyrios Kyrtzidis0b21d822012-05-23 21:50:04 +0000270 for (; currChildS != childE; ++currChildS) {
271 if (*currChildS == InnerS)
272 break;
Argyrios Kyrtzidisd12c3322013-01-04 18:30:11 +0000273 prevChildS = currChildS;
Argyrios Kyrtzidis0b21d822012-05-23 21:50:04 +0000274 }
Argyrios Kyrtzidisd12c3322013-01-04 18:30:11 +0000275
276 if (prevChildS != childE) {
277 prevStmt = *prevChildS;
278 if (prevStmt)
279 prevStmt = prevStmt->IgnoreImplicit();
280 }
281
Argyrios Kyrtzidis0b21d822012-05-23 21:50:04 +0000282 if (currChildS == childE)
Argyrios Kyrtzidisd12c3322013-01-04 18:30:11 +0000283 return std::make_pair(prevStmt, nextStmt);
Argyrios Kyrtzidis0b21d822012-05-23 21:50:04 +0000284 ++currChildS;
285 if (currChildS == childE)
Argyrios Kyrtzidisd12c3322013-01-04 18:30:11 +0000286 return std::make_pair(prevStmt, nextStmt);
Argyrios Kyrtzidis0b21d822012-05-23 21:50:04 +0000287
Argyrios Kyrtzidisd12c3322013-01-04 18:30:11 +0000288 nextStmt = *currChildS;
289 if (nextStmt)
290 nextStmt = nextStmt->IgnoreImplicit();
291
292 return std::make_pair(prevStmt, nextStmt);
Argyrios Kyrtzidis0b21d822012-05-23 21:50:04 +0000293 }
294
295 Decl *getReferencedDecl(Expr *E) {
296 if (!E)
297 return 0;
298
299 E = E->IgnoreParenCasts();
Argyrios Kyrtzidisb7b89b52013-01-04 18:29:59 +0000300 if (ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(E)) {
301 switch (ME->getMethodFamily()) {
302 case OMF_copy:
303 case OMF_autorelease:
304 case OMF_release:
305 case OMF_retain:
306 return getReferencedDecl(ME->getInstanceReceiver());
307 default:
308 return 0;
309 }
310 }
Argyrios Kyrtzidis0b21d822012-05-23 21:50:04 +0000311 if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E))
312 return DRE->getDecl();
313 if (MemberExpr *ME = dyn_cast<MemberExpr>(E))
314 return ME->getMemberDecl();
315 if (ObjCIvarRefExpr *IRE = dyn_cast<ObjCIvarRefExpr>(E))
316 return IRE->getDecl();
317
318 return 0;
319 }
320
Ted Kremenekf7639e12012-03-06 20:06:33 +0000321 /// \brief Check if the retain/release is due to a GCD/XPC macro that are
322 /// defined as:
323 ///
324 /// #define dispatch_retain(object) ({ dispatch_object_t _o = (object); _dispatch_object_validate(_o); (void)[_o retain]; })
325 /// #define dispatch_release(object) ({ dispatch_object_t _o = (object); _dispatch_object_validate(_o); [_o release]; })
326 /// #define xpc_retain(object) ({ xpc_object_t _o = (object); _xpc_object_validate(_o); [_o retain]; })
327 /// #define xpc_release(object) ({ xpc_object_t _o = (object); _xpc_object_validate(_o); [_o release]; })
328 ///
329 /// and return the top container which is the StmtExpr and the macro argument
330 /// expression.
331 void checkForGCDOrXPC(ObjCMessageExpr *Msg, Expr *&RecContainer,
332 Expr *&Rec, SourceRange &RecRange) {
333 SourceLocation Loc = Msg->getExprLoc();
334 if (!Loc.isMacroID())
335 return;
336 SourceManager &SM = Pass.Ctx.getSourceManager();
337 StringRef MacroName = Lexer::getImmediateMacroName(Loc, SM,
David Blaikiebbafb8a2012-03-11 07:00:24 +0000338 Pass.Ctx.getLangOpts());
Ted Kremenekf7639e12012-03-06 20:06:33 +0000339 bool isGCDOrXPC = llvm::StringSwitch<bool>(MacroName)
340 .Case("dispatch_retain", true)
341 .Case("dispatch_release", true)
342 .Case("xpc_retain", true)
343 .Case("xpc_release", true)
344 .Default(false);
345 if (!isGCDOrXPC)
346 return;
347
348 StmtExpr *StmtE = 0;
349 Stmt *S = Msg;
350 while (S) {
351 if (StmtExpr *SE = dyn_cast<StmtExpr>(S)) {
352 StmtE = SE;
353 break;
354 }
355 S = StmtMap->getParent(S);
356 }
357
358 if (!StmtE)
359 return;
360
361 Stmt::child_range StmtExprChild = StmtE->children();
362 if (!StmtExprChild)
363 return;
364 CompoundStmt *CompS = dyn_cast_or_null<CompoundStmt>(*StmtExprChild);
365 if (!CompS)
366 return;
367
368 Stmt::child_range CompStmtChild = CompS->children();
369 if (!CompStmtChild)
370 return;
371 DeclStmt *DeclS = dyn_cast_or_null<DeclStmt>(*CompStmtChild);
372 if (!DeclS)
373 return;
374 if (!DeclS->isSingleDecl())
375 return;
376 VarDecl *VD = dyn_cast_or_null<VarDecl>(DeclS->getSingleDecl());
377 if (!VD)
378 return;
379 Expr *Init = VD->getInit();
380 if (!Init)
381 return;
382
383 RecContainer = StmtE;
384 Rec = Init->IgnoreParenImpCasts();
385 if (ExprWithCleanups *EWC = dyn_cast<ExprWithCleanups>(Rec))
386 Rec = EWC->getSubExpr()->IgnoreParenImpCasts();
387 RecRange = Rec->getSourceRange();
388 if (SM.isMacroArgExpansion(RecRange.getBegin()))
389 RecRange.setBegin(SM.getImmediateSpellingLoc(RecRange.getBegin()));
390 if (SM.isMacroArgExpansion(RecRange.getEnd()))
391 RecRange.setEnd(SM.getImmediateSpellingLoc(RecRange.getEnd()));
392 }
393
Argyrios Kyrtzidis6a8a14d2011-07-15 21:11:23 +0000394 void clearDiagnostics(SourceLocation loc) const {
395 Pass.TA.clearDiagnostic(diag::err_arc_illegal_explicit_message,
396 diag::err_unavailable,
397 diag::err_unavailable_message,
398 loc);
399 }
400
Argyrios Kyrtzidisa6fe4bf2011-07-15 23:48:56 +0000401 bool isDelegateMessage(Expr *E) const {
402 if (!E) return false;
403
404 E = E->IgnoreParenCasts();
John McCallfe96e0b2011-11-06 09:01:30 +0000405
406 // Also look through property-getter sugar.
407 if (PseudoObjectExpr *pseudoOp = dyn_cast<PseudoObjectExpr>(E))
408 E = pseudoOp->getResultExpr()->IgnoreImplicit();
409
Argyrios Kyrtzidisa6fe4bf2011-07-15 23:48:56 +0000410 if (ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(E))
411 return (ME->isInstanceMessage() && ME->getSelector() == DelegateSel);
412
Argyrios Kyrtzidisa6fe4bf2011-07-15 23:48:56 +0000413 return false;
414 }
415
Argyrios Kyrtzidis6a8a14d2011-07-15 21:11:23 +0000416 bool isInAtFinally(Expr *E) const {
417 assert(E);
418 Stmt *S = E;
419 while (S) {
420 if (isa<ObjCAtFinallyStmt>(S))
421 return true;
422 S = StmtMap->getParent(S);
423 }
424
425 return false;
426 }
427
Argyrios Kyrtzidise5b475c2011-06-21 20:20:39 +0000428 bool isRemovable(Expr *E) const {
429 return Removables.count(E);
430 }
431
432 bool tryRemoving(Expr *E) const {
433 if (isRemovable(E)) {
434 Pass.TA.removeStmt(E);
435 return true;
436 }
437
John McCall4db5c3c2011-07-07 06:58:02 +0000438 Stmt *parent = StmtMap->getParent(E);
439
440 if (ImplicitCastExpr *castE = dyn_cast_or_null<ImplicitCastExpr>(parent))
441 return tryRemoving(castE);
442
443 if (ParenExpr *parenE = dyn_cast_or_null<ParenExpr>(parent))
Argyrios Kyrtzidise5b475c2011-06-21 20:20:39 +0000444 return tryRemoving(parenE);
445
446 if (BinaryOperator *
John McCall4db5c3c2011-07-07 06:58:02 +0000447 bopE = dyn_cast_or_null<BinaryOperator>(parent)) {
Argyrios Kyrtzidise5b475c2011-06-21 20:20:39 +0000448 if (bopE->getOpcode() == BO_Comma && bopE->getLHS() == E &&
449 isRemovable(bopE)) {
450 Pass.TA.replace(bopE->getSourceRange(), bopE->getRHS()->getSourceRange());
451 return true;
452 }
453 }
454
455 return false;
456 }
457
458};
459
460} // anonymous namespace
461
Argyrios Kyrtzidisd2b91122011-11-04 15:58:22 +0000462void trans::removeRetainReleaseDeallocFinalize(MigrationPass &pass) {
Argyrios Kyrtzidise5b475c2011-06-21 20:20:39 +0000463 BodyTransform<RetainReleaseDeallocRemover> trans(pass);
464 trans.TraverseDecl(pass.Ctx.getTranslationUnitDecl());
465}