Skip to content

Commit a2dc034

Browse files
committed
[Effects handling] Stop storing an ApplyClassifier as an instance.
1 parent 52591ef commit a2dc034

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lib/Sema/TypeCheckEffects.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,8 +1226,7 @@ class CheckEffectsCoverage : public EffectsHandlingWalker<CheckEffectsCoverage>
12261226

12271227
ASTContext &Ctx;
12281228

1229-
ApplyClassifier Classifier;
1230-
1229+
DeclContext *RethrowsDC = nullptr;
12311230
Context CurContext;
12321231

12331232
class ContextFlags {
@@ -1296,7 +1295,7 @@ class CheckEffectsCoverage : public EffectsHandlingWalker<CheckEffectsCoverage>
12961295
public:
12971296
ContextScope(CheckEffectsCoverage &self, Optional<Context> newContext)
12981297
: Self(self), OldContext(self.CurContext),
1299-
OldRethrowsDC(self.Classifier.RethrowsDC),
1298+
OldRethrowsDC(self.RethrowsDC),
13001299
OldFlags(self.Flags),
13011300
OldMaxThrowingKind(self.MaxThrowingKind) {
13021301
if (newContext) self.CurContext = *newContext;
@@ -1306,7 +1305,7 @@ class CheckEffectsCoverage : public EffectsHandlingWalker<CheckEffectsCoverage>
13061305
ContextScope &operator=(const ContextScope &) = delete;
13071306

13081307
void enterSubFunction() {
1309-
Self.Classifier.RethrowsDC = nullptr;
1308+
Self.RethrowsDC = nullptr;
13101309
}
13111310

13121311
void enterTry() {
@@ -1372,7 +1371,7 @@ class CheckEffectsCoverage : public EffectsHandlingWalker<CheckEffectsCoverage>
13721371

13731372
~ContextScope() {
13741373
Self.CurContext = OldContext;
1375-
Self.Classifier.RethrowsDC = OldRethrowsDC;
1374+
Self.RethrowsDC = OldRethrowsDC;
13761375
Self.Flags = OldFlags;
13771376
Self.MaxThrowingKind = OldMaxThrowingKind;
13781377
}
@@ -1384,7 +1383,7 @@ class CheckEffectsCoverage : public EffectsHandlingWalker<CheckEffectsCoverage>
13841383
MaxThrowingKind(ThrowingKind::None) {
13851384

13861385
if (auto rethrowsDC = initialContext.getRethrowsDC()) {
1387-
Classifier.RethrowsDC = rethrowsDC;
1386+
RethrowsDC = rethrowsDC;
13881387
}
13891388
}
13901389

@@ -1494,7 +1493,9 @@ class CheckEffectsCoverage : public EffectsHandlingWalker<CheckEffectsCoverage>
14941493
ShouldRecurse_t checkApply(ApplyExpr *E) {
14951494
// An apply expression is a potential throw site if the function throws.
14961495
// But if the expression didn't type-check, suppress diagnostics.
1497-
auto classification = Classifier.classifyApply(E);
1496+
ApplyClassifier classifier;
1497+
classifier.RethrowsDC = RethrowsDC;
1498+
auto classification = classifier.classifyApply(E);
14981499

14991500
checkThrowAsyncSite(E, /*requiresTry*/ true, classification);
15001501

0 commit comments

Comments
 (0)