aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clang/lib/AST/Interp/Compiler.cpp10
-rw-r--r--clang/lib/AST/Interp/Compiler.h5
2 files changed, 5 insertions, 10 deletions
diff --git a/clang/lib/AST/Interp/Compiler.cpp b/clang/lib/AST/Interp/Compiler.cpp
index 1d39d7b..5fad24a 100644
--- a/clang/lib/AST/Interp/Compiler.cpp
+++ b/clang/lib/AST/Interp/Compiler.cpp
@@ -2204,7 +2204,7 @@ bool Compiler<Emitter>::VisitCompoundAssignOperator(
template <class Emitter>
bool Compiler<Emitter>::VisitExprWithCleanups(const ExprWithCleanups *E) {
- ExprScope<Emitter> ES(this);
+ LocalScope<Emitter> ES(this);
const Expr *SubExpr = E->getSubExpr();
assert(E->getNumObjects() == 0 && "TODO: Implement cleanups");
@@ -3425,7 +3425,7 @@ const Function *Compiler<Emitter>::getFunction(const FunctionDecl *FD) {
}
template <class Emitter> bool Compiler<Emitter>::visitExpr(const Expr *E) {
- ExprScope<Emitter> RootScope(this);
+ LocalScope<Emitter> RootScope(this);
// Void expressions.
if (E->getType()->isVoidType()) {
if (!visit(E))
@@ -3610,10 +3610,10 @@ VarCreationState Compiler<Emitter>::visitVarDecl(const VarDecl *VD, bool Topleve
// If this is a toplevel declaration, create a scope for the
// initializer.
if (Toplevel) {
- ExprScope<Emitter> Scope(this);
+ LocalScope<Emitter> Scope(this);
if (!this->visit(Init))
return false;
- return this->emitSetLocal(*VarT, Offset, VD);
+ return this->emitSetLocal(*VarT, Offset, VD) && Scope.destroyLocals();
} else {
if (!this->visit(Init))
return false;
@@ -4120,7 +4120,7 @@ bool Compiler<Emitter>::visitReturnStmt(const ReturnStmt *RS) {
return this->emitUnsupported(RS);
if (const Expr *RE = RS->getRetValue()) {
- ExprScope<Emitter> RetScope(this);
+ LocalScope<Emitter> RetScope(this);
if (ReturnType) {
// Primitive types are simply returned.
if (!this->visit(RE))
diff --git a/clang/lib/AST/Interp/Compiler.h b/clang/lib/AST/Interp/Compiler.h
index fbeda8a..246ff25 100644
--- a/clang/lib/AST/Interp/Compiler.h
+++ b/clang/lib/AST/Interp/Compiler.h
@@ -612,11 +612,6 @@ public:
}
};
-template <class Emitter> class ExprScope final : public AutoScope<Emitter> {
-public:
- ExprScope(Compiler<Emitter> *Ctx) : AutoScope<Emitter>(Ctx) {}
-};
-
template <class Emitter> class ArrayIndexScope final {
public:
ArrayIndexScope(Compiler<Emitter> *Ctx, uint64_t Index) : Ctx(Ctx) {