void BlockObjCVariableTraverser::traverseBody(BodyContext &BodyCtx) { MigrationPass &Pass = BodyCtx.getMigrationContext().Pass; llvm::DenseSet<VarDecl *> VarsToChange; BlockObjCVarRewriter trans(VarsToChange); trans.TraverseStmt(BodyCtx.getTopStmt()); for (llvm::DenseSet<VarDecl *>::iterator I = VarsToChange.begin(), E = VarsToChange.end(); I != E; ++I) { VarDecl *var = *I; BlocksAttr *attr = var->getAttr<BlocksAttr>(); if(!attr) continue; bool useWeak = canApplyWeak(Pass.Ctx, var->getType()); SourceManager &SM = Pass.Ctx.getSourceManager(); Transaction Trans(Pass.TA); Pass.TA.replaceText(SM.getExpansionLoc(attr->getLocation()), "__block", useWeak ? "__weak" : "__unsafe_unretained"); } }
void GCCollectableCallsTraverser::traverseBody(BodyContext &BodyCtx) { GCCollectableCallsChecker(BodyCtx.getMigrationContext()) .TraverseStmt(BodyCtx.getTopStmt()); }