@@ -17,7 +17,14 @@ using namespace clang::interp;
1717
1818InterpState::InterpState (State &Parent, Program &P, InterpStack &Stk,
1919 Context &Ctx, SourceMapper *M)
20- : Parent(Parent), M(M), P(P), Stk(Stk), Ctx(Ctx), Current(nullptr ) {}
20+ : Parent(Parent), M(M), P(P), Stk(Stk), Ctx(Ctx), BottomFrame(*this ),
21+ Current(&BottomFrame) {}
22+
23+ InterpState::InterpState (State &Parent, Program &P, InterpStack &Stk,
24+ Context &Ctx, const Function *Func)
25+ : Parent(Parent), M(nullptr ), P(P), Stk(Stk), Ctx(Ctx),
26+ BottomFrame(*this , Func, nullptr , CodePtr(), Func->getArgSize()),
27+ Current(&BottomFrame) {}
2128
2229bool InterpState::inConstantContext () const {
2330 if (ConstantContextOverride)
@@ -27,11 +34,12 @@ bool InterpState::inConstantContext() const {
2734}
2835
2936InterpState::~InterpState () {
30- while (Current) {
37+ while (Current && !Current-> isBottomFrame () ) {
3138 InterpFrame *Next = Current->Caller ;
3239 delete Current;
3340 Current = Next;
3441 }
42+ BottomFrame.destroyScopes ();
3543
3644 while (DeadBlocks) {
3745 DeadBlock *Next = DeadBlocks->Next ;
0 commit comments