Skip to content

Commit 369d3a7

Browse files
committed
[clang][Interp][NFC] Remove ExprScope
It's been nothing but a LocalScope for a while.
1 parent a2a0ef5 commit 369d3a7

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

clang/lib/AST/Interp/Compiler.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2204,7 +2204,7 @@ bool Compiler<Emitter>::VisitCompoundAssignOperator(
22042204

22052205
template <class Emitter>
22062206
bool Compiler<Emitter>::VisitExprWithCleanups(const ExprWithCleanups *E) {
2207-
ExprScope<Emitter> ES(this);
2207+
LocalScope<Emitter> ES(this);
22082208
const Expr *SubExpr = E->getSubExpr();
22092209

22102210
assert(E->getNumObjects() == 0 && "TODO: Implement cleanups");
@@ -3425,7 +3425,7 @@ const Function *Compiler<Emitter>::getFunction(const FunctionDecl *FD) {
34253425
}
34263426

34273427
template <class Emitter> bool Compiler<Emitter>::visitExpr(const Expr *E) {
3428-
ExprScope<Emitter> RootScope(this);
3428+
LocalScope<Emitter> RootScope(this);
34293429
// Void expressions.
34303430
if (E->getType()->isVoidType()) {
34313431
if (!visit(E))
@@ -3610,10 +3610,10 @@ VarCreationState Compiler<Emitter>::visitVarDecl(const VarDecl *VD, bool Topleve
36103610
// If this is a toplevel declaration, create a scope for the
36113611
// initializer.
36123612
if (Toplevel) {
3613-
ExprScope<Emitter> Scope(this);
3613+
LocalScope<Emitter> Scope(this);
36143614
if (!this->visit(Init))
36153615
return false;
3616-
return this->emitSetLocal(*VarT, Offset, VD);
3616+
return this->emitSetLocal(*VarT, Offset, VD) && Scope.destroyLocals();
36173617
} else {
36183618
if (!this->visit(Init))
36193619
return false;
@@ -4120,7 +4120,7 @@ bool Compiler<Emitter>::visitReturnStmt(const ReturnStmt *RS) {
41204120
return this->emitUnsupported(RS);
41214121

41224122
if (const Expr *RE = RS->getRetValue()) {
4123-
ExprScope<Emitter> RetScope(this);
4123+
LocalScope<Emitter> RetScope(this);
41244124
if (ReturnType) {
41254125
// Primitive types are simply returned.
41264126
if (!this->visit(RE))

clang/lib/AST/Interp/Compiler.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -612,11 +612,6 @@ template <class Emitter> class BlockScope final : public AutoScope<Emitter> {
612612
}
613613
};
614614

615-
template <class Emitter> class ExprScope final : public AutoScope<Emitter> {
616-
public:
617-
ExprScope(Compiler<Emitter> *Ctx) : AutoScope<Emitter>(Ctx) {}
618-
};
619-
620615
template <class Emitter> class ArrayIndexScope final {
621616
public:
622617
ArrayIndexScope(Compiler<Emitter> *Ctx, uint64_t Index) : Ctx(Ctx) {

0 commit comments

Comments
 (0)