diff --git a/clang/lib/AST/ByteCode/InterpFrame.cpp b/clang/lib/AST/ByteCode/InterpFrame.cpp index 18400b10c47b0..b9dc2aed23113 100644 --- a/clang/lib/AST/ByteCode/InterpFrame.cpp +++ b/clang/lib/AST/ByteCode/InterpFrame.cpp @@ -195,12 +195,6 @@ void InterpFrame::describe(llvm::raw_ostream &OS) const { OS << ")"; } -Frame *InterpFrame::getCaller() const { - if (Caller->Caller) - return Caller; - return S.getSplitFrame(); -} - SourceRange InterpFrame::getCallRange() const { if (!Caller->Func) { if (SourceRange NullRange = S.getRange(nullptr, {}); NullRange.isValid()) diff --git a/clang/lib/AST/ByteCode/InterpFrame.h b/clang/lib/AST/ByteCode/InterpFrame.h index 4be53911b615e..cf4d27d341e91 100644 --- a/clang/lib/AST/ByteCode/InterpFrame.h +++ b/clang/lib/AST/ByteCode/InterpFrame.h @@ -59,7 +59,7 @@ class InterpFrame final : public Frame { void describe(llvm::raw_ostream &OS) const override; /// Returns the parent frame object. - Frame *getCaller() const override; + Frame *getCaller() const override { return Caller; } /// Returns the location of the call to the frame. SourceRange getCallRange() const override; diff --git a/clang/lib/AST/ByteCode/InterpState.cpp b/clang/lib/AST/ByteCode/InterpState.cpp index f89967759ff9b..a2a1e5826d7c5 100644 --- a/clang/lib/AST/ByteCode/InterpState.cpp +++ b/clang/lib/AST/ByteCode/InterpState.cpp @@ -62,11 +62,7 @@ void InterpState::cleanup() { Alloc.cleanup(); } -Frame *InterpState::getCurrentFrame() { - if (Current && Current->Caller) - return Current; - return Parent.getCurrentFrame(); -} +Frame *InterpState::getCurrentFrame() { return Current; } bool InterpState::reportOverflow(const Expr *E, const llvm::APSInt &Value) { QualType Type = E->getType(); diff --git a/clang/lib/AST/ByteCode/InterpState.h b/clang/lib/AST/ByteCode/InterpState.h index 861e4c38049ab..f123a1f169c02 100644 --- a/clang/lib/AST/ByteCode/InterpState.h +++ b/clang/lib/AST/ByteCode/InterpState.h @@ -57,14 +57,11 @@ class InterpState final : public State, public SourceMapper { bool diagnosing() const { return getEvalStatus().Diag != nullptr; } // Stack frame accessors. - Frame *getSplitFrame() { return Parent.getCurrentFrame(); } Frame *getCurrentFrame() override; unsigned getCallStackDepth() override { return Current ? (Current->getDepth() + 1) : 1; } - const Frame *getBottomFrame() const override { - return Parent.getBottomFrame(); - } + const Frame *getBottomFrame() const override { return &BottomFrame; } // Access objects from the walker context. Expr::EvalStatus &getEvalStatus() const override {