Lines Matching refs:scope
12 // Calls to NSAutoreleasePools will be rewritten as an @autorelease scope.
23 // - There is not a corresponding -release/-drain in the same scope
25 // - There is a variable that is declared inside the intended @autorelease scope
98 PoolScope &scope = *scpI;
99 clearRefsIn(*scope.Begin, info.Refs);
100 clearRefsIn(*scope.End, info.Refs);
101 clearRefsIn(scope.Releases.begin(), scope.Releases.end(), info.Refs);
122 PoolScope &scope = *scpI;
123 clearUnavailableDiags(*scope.Begin);
124 clearUnavailableDiags(*scope.End);
125 if (scope.IsFollowedBySimpleReturnStmt) {
126 // Include the return in the scope.
127 Pass.TA.replaceStmt(*scope.Begin, "@autoreleasepool {");
128 Pass.TA.removeStmt(*scope.End);
129 Stmt::child_iterator retI = scope.End;
138 SourceRange(scope.getIndentedRange().getBegin(),
140 scope.CompoundParent->getLocStart());
142 Pass.TA.replaceStmt(*scope.Begin, "@autoreleasepool {");
143 Pass.TA.replaceStmt(*scope.End, "}");
144 Pass.TA.increaseIndentation(scope.getIndentedRange(),
145 scope.CompoundParent->getLocStart());
153 PoolScope &scope = *scpI;
155 relI = scope.Releases.begin(),
156 relE = scope.Releases.end(); relI != relE; ++relI) {
208 PoolScope &scope = Scopes.back();
209 scope.End = I;
210 handlePoolScope(scope, S);
254 NameReferenceChecker(ASTContext &ctx, PoolScope &scope,
259 ScopeRange = SourceRange((*scope.Begin)->getLocStart(),
260 (*scope.End)->getLocStart());
297 void handlePoolScope(PoolScope &scope, CompoundStmt *compoundS) {
298 // Check that all names declared inside the scope are not used
299 // outside the scope.
303 Stmt::child_iterator SI = scope.End, SE = compoundS->body_end();
305 // Check if the autoreleasepool scope is followed by a simple return
306 // statement, in which case we will include the return in the scope.
312 scope.IsFollowedBySimpleReturnStmt = true;
313 ++SI; // the return will be included in scope, don't check it.
317 nameUsedOutsideScope = !NameReferenceChecker(Pass.Ctx, scope,
325 // declared inside the pool scope are used outside of it.
329 "NSAutoreleasePool scope that it was declared in", referenceLoc);
331 Pass.TA.reportNote("intended @autoreleasepool scope begins here",
332 (*scope.Begin)->getLocStart());
333 Pass.TA.reportNote("intended @autoreleasepool scope ends here",
334 (*scope.End)->getLocStart());
341 ReleaseCollector releaseColl(scope.PoolVar, scope.Releases);
342 Stmt::child_iterator I = scope.Begin;
344 for (; I != scope.End; ++I)
348 PoolVars[scope.PoolVar].Scopes.push_back(scope);