From 369d3a738082a2fac1a98aae8a8cfded9a010e10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 9 Jul 2024 09:59:15 +0200 Subject: [clang][Interp][NFC] Remove ExprScope It's been nothing but a LocalScope for a while. --- clang/lib/AST/Interp/Compiler.cpp | 10 +++++----- clang/lib/AST/Interp/Compiler.h | 5 ----- 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::VisitCompoundAssignOperator( template bool Compiler::VisitExprWithCleanups(const ExprWithCleanups *E) { - ExprScope ES(this); + LocalScope ES(this); const Expr *SubExpr = E->getSubExpr(); assert(E->getNumObjects() == 0 && "TODO: Implement cleanups"); @@ -3425,7 +3425,7 @@ const Function *Compiler::getFunction(const FunctionDecl *FD) { } template bool Compiler::visitExpr(const Expr *E) { - ExprScope RootScope(this); + LocalScope RootScope(this); // Void expressions. if (E->getType()->isVoidType()) { if (!visit(E)) @@ -3610,10 +3610,10 @@ VarCreationState Compiler::visitVarDecl(const VarDecl *VD, bool Topleve // If this is a toplevel declaration, create a scope for the // initializer. if (Toplevel) { - ExprScope Scope(this); + LocalScope 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::visitReturnStmt(const ReturnStmt *RS) { return this->emitUnsupported(RS); if (const Expr *RE = RS->getRetValue()) { - ExprScope RetScope(this); + LocalScope 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 ExprScope final : public AutoScope { -public: - ExprScope(Compiler *Ctx) : AutoScope(Ctx) {} -}; - template class ArrayIndexScope final { public: ArrayIndexScope(Compiler *Ctx, uint64_t Index) : Ctx(Ctx) { -- cgit v1.1