diff options
Diffstat (limited to 'contrib/llvm-project/clang/lib/AST/Interp/InterpState.h')
-rw-r--r-- | contrib/llvm-project/clang/lib/AST/Interp/InterpState.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/contrib/llvm-project/clang/lib/AST/Interp/InterpState.h b/contrib/llvm-project/clang/lib/AST/Interp/InterpState.h index c2209bbcbb92..8f84bf6ed2ea 100644 --- a/contrib/llvm-project/clang/lib/AST/Interp/InterpState.h +++ b/contrib/llvm-project/clang/lib/AST/Interp/InterpState.h @@ -15,6 +15,7 @@ #include "Context.h" #include "Function.h" +#include "InterpFrame.h" #include "InterpStack.h" #include "State.h" #include "clang/AST/APValue.h" @@ -38,15 +39,20 @@ public: ~InterpState(); + InterpState(const InterpState &) = delete; + InterpState &operator=(const InterpState &) = delete; + // Stack frame accessors. Frame *getSplitFrame() { return Parent.getCurrentFrame(); } Frame *getCurrentFrame() override; - unsigned getCallStackDepth() override { return CallStackDepth; } + unsigned getCallStackDepth() override { + return Current ? (Current->getDepth() + 1) : 1; + } const Frame *getBottomFrame() const override { return Parent.getBottomFrame(); } - // Acces objects from the walker context. + // Access objects from the walker context. Expr::EvalStatus &getEvalStatus() const override { return Parent.getEvalStatus(); } @@ -65,6 +71,7 @@ public: bool noteUndefinedBehavior() override { return Parent.noteUndefinedBehavior(); } + bool inConstantContext() const { return Parent.InConstantContext; } bool hasActiveDiagnostic() override { return Parent.hasActiveDiagnostic(); } void setActiveDiagnostic(bool Flag) override { Parent.setActiveDiagnostic(Flag); @@ -81,10 +88,12 @@ public: void deallocate(Block *B); /// Delegates source mapping to the mapper. - SourceInfo getSource(Function *F, CodePtr PC) const override { + SourceInfo getSource(const Function *F, CodePtr PC) const override { return M ? M->getSource(F, PC) : F->getSource(PC); } + Context &getContext() const { return Ctx; } + private: /// AST Walker state. State &Parent; @@ -102,8 +111,6 @@ public: Context &Ctx; /// The current frame. InterpFrame *Current = nullptr; - /// Call stack depth. - unsigned CallStackDepth; }; } // namespace interp |