@@ -2204,7 +2204,7 @@ bool Compiler<Emitter>::VisitCompoundAssignOperator(
2204
2204
2205
2205
template <class Emitter >
2206
2206
bool Compiler<Emitter>::VisitExprWithCleanups(const ExprWithCleanups *E) {
2207
- ExprScope <Emitter> ES (this );
2207
+ LocalScope <Emitter> ES (this );
2208
2208
const Expr *SubExpr = E->getSubExpr ();
2209
2209
2210
2210
assert (E->getNumObjects () == 0 && " TODO: Implement cleanups" );
@@ -3425,7 +3425,7 @@ const Function *Compiler<Emitter>::getFunction(const FunctionDecl *FD) {
3425
3425
}
3426
3426
3427
3427
template <class Emitter > bool Compiler<Emitter>::visitExpr(const Expr *E) {
3428
- ExprScope <Emitter> RootScope (this );
3428
+ LocalScope <Emitter> RootScope (this );
3429
3429
// Void expressions.
3430
3430
if (E->getType ()->isVoidType ()) {
3431
3431
if (!visit (E))
@@ -3610,10 +3610,10 @@ VarCreationState Compiler<Emitter>::visitVarDecl(const VarDecl *VD, bool Topleve
3610
3610
// If this is a toplevel declaration, create a scope for the
3611
3611
// initializer.
3612
3612
if (Toplevel) {
3613
- ExprScope <Emitter> Scope (this );
3613
+ LocalScope <Emitter> Scope (this );
3614
3614
if (!this ->visit (Init))
3615
3615
return false ;
3616
- return this ->emitSetLocal (*VarT, Offset, VD);
3616
+ return this ->emitSetLocal (*VarT, Offset, VD) && Scope. destroyLocals () ;
3617
3617
} else {
3618
3618
if (!this ->visit (Init))
3619
3619
return false ;
@@ -4120,7 +4120,7 @@ bool Compiler<Emitter>::visitReturnStmt(const ReturnStmt *RS) {
4120
4120
return this ->emitUnsupported (RS);
4121
4121
4122
4122
if (const Expr *RE = RS->getRetValue ()) {
4123
- ExprScope <Emitter> RetScope (this );
4123
+ LocalScope <Emitter> RetScope (this );
4124
4124
if (ReturnType) {
4125
4125
// Primitive types are simply returned.
4126
4126
if (!this ->visit (RE))
0 commit comments