aboutsummaryrefslogtreecommitdiff
path: root/clang
diff options
context:
space:
mode:
authorTimm Bäder <tbaeder@redhat.com>2024-07-09 09:59:15 +0200
committerTimm Bäder <tbaeder@redhat.com>2024-07-09 11:52:40 +0200
commit369d3a738082a2fac1a98aae8a8cfded9a010e10 (patch)
treed6b4f70bd3bddbc31fb8fe65468d8a58f74cf8d4 /clang
parenta2a0ef567cd92e3df03f10cab8a9ebc62aff3be9 (diff)
downloadllvm-369d3a738082a2fac1a98aae8a8cfded9a010e10.zip
llvm-369d3a738082a2fac1a98aae8a8cfded9a010e10.tar.gz
llvm-369d3a738082a2fac1a98aae8a8cfded9a010e10.tar.bz2
[clang][Interp][NFC] Remove ExprScope
It's been nothing but a LocalScope for a while.
Diffstat (limited to 'clang')
-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) {