Skip to content

Commit 8b9cced

Browse files
committed
CheckErrorCoverage doesn't need a TypeChecker
1 parent 049d56a commit 8b9cced

File tree

7 files changed

+79
-72
lines changed

7 files changed

+79
-72
lines changed

lib/Sema/PCMacro.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ class Instrumenter : InstrumenterBase {
321321

322322
if (NB != B) {
323323
FD->setBody(NB);
324-
TypeChecker::createForContext(Context).checkFunctionErrorHandling(FD);
324+
TypeChecker::checkFunctionErrorHandling(FD);
325325
}
326326
}
327327
} else if (auto *NTD = dyn_cast<NominalTypeDecl>(D)) {
@@ -691,9 +691,8 @@ void swift::performPCMacro(SourceFile &SF, TopLevelContext &TLC) {
691691
BraceStmt *NewBody = I.transformBraceStmt(Body, true);
692692
if (NewBody != Body) {
693693
TLCD->setBody(NewBody);
694-
TypeChecker &TC = TypeChecker::createForContext(ctx);
695-
TC.checkTopLevelErrorHandling(TLCD);
696-
TC.contextualizeTopLevelCode(TLC, TLCD);
694+
TypeChecker::checkTopLevelErrorHandling(TLCD);
695+
TypeChecker::contextualizeTopLevelCode(TLC, TLCD);
697696
}
698697
return false;
699698
}

lib/Sema/PlaygroundTransform.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ class Instrumenter : InstrumenterBase {
279279
BraceStmt *NB = transformBraceStmt(B);
280280
if (NB != B) {
281281
FD->setBody(NB);
282-
TypeChecker::createForContext(Context).checkFunctionErrorHandling(FD);
282+
TypeChecker::checkFunctionErrorHandling(FD);
283283
}
284284
}
285285
} else if (auto *NTD = dyn_cast<NominalTypeDecl>(D)) {
@@ -903,7 +903,7 @@ void swift::performPlaygroundTransform(SourceFile &SF, bool HighPerformance) {
903903
BraceStmt *NewBody = I.transformBraceStmt(Body);
904904
if (NewBody != Body) {
905905
FD->setBody(NewBody);
906-
TypeChecker::createForContext(ctx).checkFunctionErrorHandling(FD);
906+
TypeChecker::checkFunctionErrorHandling(FD);
907907
}
908908
return false;
909909
}
@@ -915,8 +915,7 @@ void swift::performPlaygroundTransform(SourceFile &SF, bool HighPerformance) {
915915
BraceStmt *NewBody = I.transformBraceStmt(Body, true);
916916
if (NewBody != Body) {
917917
TLCD->setBody(NewBody);
918-
TypeChecker::createForContext(ctx)
919-
.checkTopLevelErrorHandling(TLCD);
918+
TypeChecker::checkTopLevelErrorHandling(TLCD);
920919
}
921920
return false;
922921
}

lib/Sema/TypeCheckDecl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,7 @@ EnumRawValuesRequest::evaluate(Evaluator &eval, EnumDecl *ED,
16431643
Expr *exprToCheck = prevValue;
16441644
if (TC->typeCheckExpression(exprToCheck, ED, TypeLoc::withoutLoc(rawTy),
16451645
CTP_EnumCaseRawValue)) {
1646-
TC->checkEnumElementErrorHandling(elt, exprToCheck);
1646+
TypeChecker::checkEnumElementErrorHandling(elt, exprToCheck);
16471647
}
16481648
}
16491649

@@ -1999,7 +1999,7 @@ static void checkDefaultArguments(TypeChecker &tc, ParameterList *params) {
19991999
param->setDefaultValue(e);
20002000
}
20012001

2002-
tc.checkInitializerErrorHandling(initContext, e);
2002+
TypeChecker::checkInitializerErrorHandling(initContext, e);
20032003

20042004
// Walk the checked initializer and contextualize any closures
20052005
// we saw there.
@@ -2564,7 +2564,7 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
25642564
PBD->getInitContext(i));
25652565
if (initContext) {
25662566
// Check safety of error-handling in the declaration, too.
2567-
TC.checkInitializerErrorHandling(initContext, init);
2567+
TypeChecker::checkInitializerErrorHandling(initContext, init);
25682568
(void) TC.contextualizeInitializer(initContext, init);
25692569
}
25702570
}

0 commit comments

Comments
 (0)