@@ -885,16 +885,14 @@ namespace {
885
885
};
886
886
887
887
ASTContext &Context;
888
- unsigned CheckingThreshold;
889
888
const SwitchStmt *Switch;
890
889
const DeclContext *DC;
891
890
APIntMap<Expr *> IntLiteralCache;
892
891
llvm::DenseMap<APFloat, Expr *, ::DenseMapAPFloatKeyInfo> FloatLiteralCache;
893
892
llvm::DenseMap<StringRef, Expr *> StringLiteralCache;
894
893
895
- SpaceEngine (ASTContext &C, unsigned Threashold,
896
- const SwitchStmt *SS, const DeclContext *DC)
897
- : Context(C), CheckingThreshold(Threashold), Switch(SS), DC(DC) {}
894
+ SpaceEngine (ASTContext &C, const SwitchStmt *SS, const DeclContext *DC)
895
+ : Context(C), Switch(SS), DC(DC) {}
898
896
899
897
bool checkRedundantLiteral (const Pattern *Pat, Expr *&PrevPattern) {
900
898
if (Pat->getKind () != PatternKind::Expr) {
@@ -1010,7 +1008,8 @@ namespace {
1010
1008
Space totalSpace = Space::forType (subjectType, Identifier ());
1011
1009
Space coveredSpace = Space::forDisjunct (spaces);
1012
1010
1013
- unsigned minusCount = CheckingThreshold;
1011
+ unsigned minusCount
1012
+ = Context.TypeCheckerOpts .SwitchCheckingInvocationThreshold ;
1014
1013
auto diff = totalSpace.minus (coveredSpace, DC, &minusCount);
1015
1014
if (!diff) {
1016
1015
diagnoseMissingCases (RequiresDefault::SpaceTooLarge, Space (),
@@ -1519,8 +1518,7 @@ namespace {
1519
1518
void TypeChecker::checkSwitchExhaustiveness (const SwitchStmt *stmt,
1520
1519
const DeclContext *DC,
1521
1520
bool limited) {
1522
- SpaceEngine (Context, getSwitchCheckingInvocationThreshold (), stmt, DC)
1523
- .checkExhaustiveness (limited);
1521
+ SpaceEngine (DC->getASTContext (), stmt, DC).checkExhaustiveness (limited);
1524
1522
}
1525
1523
1526
1524
void SpaceEngine::Space::dump () const {
0 commit comments