Skip to content

Commit 319a026

Browse files
committed
Sema: Always compute captures when we type check a function body
1 parent 2c2d087 commit 319a026

File tree

3 files changed

+2
-10
lines changed

3 files changed

+2
-10
lines changed

lib/Sema/MiscDiagnostics.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2385,12 +2385,8 @@ class VarDeclUsageChecker : public ASTWalker {
23852385
}
23862386
}
23872387

2388-
if (afd->isBodyTypeChecked()) {
2389-
// FIXME: We don't actually need captures here anymore, but this happens
2390-
// to be the place where they get computed. Move this somewhere else.
2391-
TypeChecker::computeCaptures(afd);
2388+
if (afd->isBodyTypeChecked())
23922389
return true;
2393-
}
23942390

23952391
// Don't walk into a body that has not yet been type checked. This should
23962392
// only occur for top-level code.

lib/Sema/TypeCheckStmt.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,6 +1688,7 @@ static Type getFunctionBuilderType(FuncDecl *FD) {
16881688
bool TypeChecker::typeCheckAbstractFunctionBody(AbstractFunctionDecl *AFD) {
16891689
auto res = TypeChecker::typeCheckAbstractFunctionBodyUntil(AFD, SourceLoc());
16901690
TypeChecker::checkFunctionErrorHandling(AFD);
1691+
TypeChecker::computeCaptures(AFD);
16911692
return res;
16921693
}
16931694

lib/Sema/TypeChecker.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,6 @@ static void typeCheckDelayedFunctions(SourceFile &SF) {
306306
} while (currentFunctionIdx < SF.DelayedFunctions.size() ||
307307
currentSynthesizedDecl < SF.SynthesizedDecls.size());
308308

309-
310-
for (AbstractFunctionDecl *FD : llvm::reverse(SF.DelayedFunctions)) {
311-
TypeChecker::computeCaptures(FD);
312-
}
313-
314309
SF.DelayedFunctions.clear();
315310
}
316311

0 commit comments

Comments
 (0)