File tree Expand file tree Collapse file tree 2 files changed +9
-14
lines changed Expand file tree Collapse file tree 2 files changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -1794,6 +1794,8 @@ bool Compiler<Emitter>::VisitArrayInitLoopExpr(const ArrayInitLoopExpr *E) {
1794
1794
1795
1795
if (!this ->visitArrayElemInit (I, SubExpr))
1796
1796
return false ;
1797
+ if (!BS.destroyLocals ())
1798
+ return false ;
1797
1799
}
1798
1800
return true ;
1799
1801
}
@@ -3080,7 +3082,7 @@ bool Compiler<Emitter>::VisitStmtExpr(const StmtExpr *E) {
3080
3082
return false ;
3081
3083
}
3082
3084
3083
- return true ;
3085
+ return BS. destroyLocals () ;
3084
3086
}
3085
3087
3086
3088
template <class Emitter > bool Compiler<Emitter>::discard(const Expr *E) {
@@ -4190,7 +4192,7 @@ template <class Emitter> bool Compiler<Emitter>::visitIfStmt(const IfStmt *IS) {
4190
4192
this ->emitLabel (LabelEnd);
4191
4193
}
4192
4194
4193
- return true ;
4195
+ return IfScope. destroyLocals () ;
4194
4196
}
4195
4197
4196
4198
template <class Emitter >
@@ -4656,6 +4658,9 @@ bool Compiler<Emitter>::visitFunc(const FunctionDecl *F) {
4656
4658
if (!this ->emitPopPtr (InitExpr))
4657
4659
return false ;
4658
4660
}
4661
+
4662
+ if (!Scope.destroyLocals ())
4663
+ return false ;
4659
4664
}
4660
4665
}
4661
4666
Original file line number Diff line number Diff line change @@ -589,20 +589,10 @@ template <class Emitter> class DestructorScope final {
589
589
LocalScope<Emitter> &OtherScope;
590
590
};
591
591
592
- // / Like a regular LocalScope, except that the destructors of all local
593
- // / variables are automatically emitted when the AutoScope is destroyed.
594
- template <class Emitter > class AutoScope : public LocalScope <Emitter> {
595
- public:
596
- AutoScope (Compiler<Emitter> *Ctx) : LocalScope<Emitter>(Ctx), DS(*this ) {}
597
-
598
- private:
599
- DestructorScope<Emitter> DS;
600
- };
601
-
602
592
// / Scope for storage declared in a compound statement.
603
- template <class Emitter > class BlockScope final : public AutoScope <Emitter> {
593
+ template <class Emitter > class BlockScope final : public LocalScope <Emitter> {
604
594
public:
605
- BlockScope (Compiler<Emitter> *Ctx) : AutoScope <Emitter>(Ctx) {}
595
+ BlockScope (Compiler<Emitter> *Ctx) : LocalScope <Emitter>(Ctx) {}
606
596
607
597
void addExtended (const Scope::Local &Local) override {
608
598
// If we to this point, just add the variable as a normal local
You can’t perform that action at this time.
0 commit comments