clang 20.0.0git
|
Interpreter context. More...
#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/AST/ByteCode/InterpState.h"
Public Member Functions | |
InterpState (State &Parent, Program &P, InterpStack &Stk, Context &Ctx, SourceMapper *M=nullptr) | |
~InterpState () | |
void | cleanup () |
InterpState (const InterpState &)=delete | |
InterpState & | operator= (const InterpState &)=delete |
Frame * | getSplitFrame () |
Frame * | getCurrentFrame () override |
unsigned | getCallStackDepth () override |
const Frame * | getBottomFrame () const override |
Expr::EvalStatus & | getEvalStatus () const override |
ASTContext & | getCtx () const override |
bool | checkingForUndefinedBehavior () const override |
bool | keepEvaluatingAfterFailure () const override |
bool | checkingPotentialConstantExpression () const override |
bool | noteUndefinedBehavior () override |
bool | inConstantContext () const |
bool | hasActiveDiagnostic () override |
void | setActiveDiagnostic (bool Flag) override |
void | setFoldFailureDiagnostic (bool Flag) override |
bool | hasPriorDiagnostic () override |
bool | reportOverflow (const Expr *E, const llvm::APSInt &Value) |
Reports overflow and return true if evaluation should continue. | |
void | deallocate (Block *B) |
Deallocates a pointer. | |
SourceInfo | getSource (const Function *F, CodePtr PC) const override |
Delegates source mapping to the mapper. | |
Context & | getContext () const |
void | setEvalLocation (SourceLocation SL) |
DynamicAllocator & | getAllocator () |
bool | maybeDiagnoseDanglingAllocations () |
Diagnose any dynamic allocations that haven't been freed yet. | |
Public Member Functions inherited from clang::interp::State | |
virtual | ~State () |
virtual bool | checkingForUndefinedBehavior () const =0 |
virtual bool | checkingPotentialConstantExpression () const =0 |
virtual bool | noteUndefinedBehavior ()=0 |
virtual bool | keepEvaluatingAfterFailure () const =0 |
virtual Frame * | getCurrentFrame ()=0 |
virtual const Frame * | getBottomFrame () const =0 |
virtual bool | hasActiveDiagnostic ()=0 |
virtual void | setActiveDiagnostic (bool Flag)=0 |
virtual void | setFoldFailureDiagnostic (bool Flag)=0 |
virtual Expr::EvalStatus & | getEvalStatus () const =0 |
virtual ASTContext & | getCtx () const =0 |
virtual bool | hasPriorDiagnostic ()=0 |
virtual unsigned | getCallStackDepth ()=0 |
State ()=default | |
OptionalDiagnostic | FFDiag (SourceLocation Loc, diag::kind DiagId=diag::note_invalid_subexpr_in_const_expr, unsigned ExtraNotes=0) |
Diagnose that the evaluation could not be folded (FF => FoldFailure) | |
OptionalDiagnostic | FFDiag (const Expr *E, diag::kind DiagId=diag::note_invalid_subexpr_in_const_expr, unsigned ExtraNotes=0) |
OptionalDiagnostic | FFDiag (const SourceInfo &SI, diag::kind DiagId=diag::note_invalid_subexpr_in_const_expr, unsigned ExtraNotes=0) |
OptionalDiagnostic | CCEDiag (SourceLocation Loc, diag::kind DiagId=diag::note_invalid_subexpr_in_const_expr, unsigned ExtraNotes=0) |
Diagnose that the evaluation does not produce a C++11 core constant expression. | |
OptionalDiagnostic | CCEDiag (const Expr *E, diag::kind DiagId=diag::note_invalid_subexpr_in_const_expr, unsigned ExtraNotes=0) |
OptionalDiagnostic | CCEDiag (const SourceInfo &SI, diag::kind DiagId=diag::note_invalid_subexpr_in_const_expr, unsigned ExtraNotes=0) |
OptionalDiagnostic | Note (SourceLocation Loc, diag::kind DiagId) |
Add a note to a prior diagnostic. | |
void | addNotes (ArrayRef< PartialDiagnosticAt > Diags) |
Add a stack of notes to a prior diagnostic. | |
DiagnosticBuilder | report (SourceLocation Loc, diag::kind DiagId) |
Directly reports a diagnostic message. | |
const LangOptions & | getLangOpts () const |
Public Member Functions inherited from clang::interp::SourceMapper | |
virtual | ~SourceMapper () |
virtual SourceInfo | getSource (const Function *F, CodePtr PC) const =0 |
Returns source information for a given PC in a function. | |
const Expr * | getExpr (const Function *F, CodePtr PC) const |
Returns the expression if an opcode belongs to one, null otherwise. | |
SourceLocation | getLocation (const Function *F, CodePtr PC) const |
Returns the location from which an opcode originates. | |
SourceRange | getRange (const Function *F, CodePtr PC) const |
Public Attributes | |
Program & | P |
Reference to the module containing all bytecode. | |
InterpStack & | Stk |
Temporary stack. | |
Context & | Ctx |
Interpreter Context. | |
InterpFrame * | Current = nullptr |
The current frame. | |
SourceLocation | EvalLocation |
Source location of the evaluating expression. | |
const VarDecl * | EvaluatingDecl = nullptr |
Declaration we're initializing/evaluting, if any. | |
llvm::SmallVector< std::pair< const Expr *, const LifetimeExtendedTemporaryDecl * > > | SeenGlobalTemporaries |
Public Attributes inherited from clang::interp::State | |
bool | InConstantContext = false |
Whether or not we're in a context where the front end requires a constant value. | |
Friends | |
class | EvaluationResult |
Interpreter context.
Definition at line 36 of file InterpState.h.
InterpState::InterpState | ( | State & | Parent, |
Program & | P, | ||
InterpStack & | Stk, | ||
Context & | Ctx, | ||
SourceMapper * | M = nullptr |
||
) |
Definition at line 18 of file InterpState.cpp.
InterpState::~InterpState | ( | ) |
Definition at line 22 of file InterpState.cpp.
References clang::interp::InterpFrame::Caller, and Current.
|
delete |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Implements clang::interp::State.
Definition at line 71 of file InterpState.h.
References Parent.
Referenced by maybeDiagnoseDanglingAllocations().
void InterpState::cleanup | ( | ) |
Definition at line 36 of file InterpState.cpp.
References clang::interp::DynamicAllocator::cleanup(), and P.
Referenced by clang::interp::EvalEmitter::cleanup().
void InterpState::deallocate | ( | Block * | B | ) |
Deallocates a pointer.
Definition at line 60 of file InterpState.cpp.
References D, clang::interp::Block::data(), clang::interp::Block::getDescriptor(), clang::interp::Descriptor::getMetadataSize(), clang::interp::Block::getSize(), clang::interp::Block::hasPointers(), clang::interp::Block::invokeDtor(), clang::interp::Descriptor::MoveFn, and clang::interp::Block::rawData().
Referenced by clang::interp::InterpFrame::destroy(), and clang::interp::InterpFrame::~InterpFrame().
|
inline |
Definition at line 106 of file InterpState.h.
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Implements clang::interp::State.
Definition at line 51 of file InterpState.h.
References Current, and clang::interp::InterpFrame::getDepth().
|
inline |
Definition at line 102 of file InterpState.h.
References Ctx.
|
inlineoverridevirtual |
Implements clang::interp::State.
Definition at line 62 of file InterpState.h.
References Parent.
Referenced by clang::interp::InterpFrame::describe().
|
overridevirtual |
Implements clang::interp::State.
Definition at line 48 of file InterpState.cpp.
References clang::interp::InterpFrame::Caller, Current, and clang::interp::State::getCurrentFrame().
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Delegates source mapping to the mapper.
Implements clang::interp::SourceMapper.
Definition at line 94 of file InterpState.h.
References clang::interp::Function::getSource(), and clang::interp::SourceMapper::getSource().
Referenced by clang::interp::InterpFrame::getSource().
|
inline |
Definition at line 49 of file InterpState.h.
References Parent.
Referenced by clang::interp::InterpFrame::getCaller().
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
inline |
Definition at line 77 of file InterpState.h.
References Parent.
Referenced by clang::interp::EvalEmitter::interpretDecl().
|
inlineoverridevirtual |
bool InterpState::maybeDiagnoseDanglingAllocations | ( | ) |
Diagnose any dynamic allocations that haven't been freed yet.
Will return false
if there were any allocations to diagnose, true
otherwise.
Definition at line 89 of file InterpState.cpp.
References clang::interp::DynamicAllocator::allocation_sites(), clang::interp::State::CCEDiag(), checkingPotentialConstantExpression(), clang::Expr::getExprLoc(), clang::interp::DynamicAllocator::getNumAllocations(), and clang::Stmt::getSourceRange().
|
inlineoverridevirtual |
Implements clang::interp::State.
Definition at line 74 of file InterpState.h.
References Parent.
Referenced by reportOverflow().
|
delete |
Reports overflow and return true if evaluation should continue.
Definition at line 54 of file InterpState.cpp.
References clang::interp::State::CCEDiag(), E, clang::Expr::getType(), and noteUndefinedBehavior().
|
inlineoverridevirtual |
|
inline |
Definition at line 104 of file InterpState.h.
References EvalLocation.
Referenced by clang::interp::EvalEmitter::interpretExpr().
|
inlineoverridevirtual |
|
friend |
Definition at line 114 of file InterpState.h.
Context& clang::interp::InterpState::Ctx |
Definition at line 130 of file InterpState.h.
Referenced by clang::interp::InterpFrame::describe(), getContext(), and clang::interp::InterpFrame::getParamPointer().
InterpFrame* clang::interp::InterpState::Current = nullptr |
The current frame.
Definition at line 132 of file InterpState.h.
Referenced by clang::interp::EvalEmitter::EvalEmitter(), getCallStackDepth(), getCurrentFrame(), and ~InterpState().
SourceLocation clang::interp::InterpState::EvalLocation |
Source location of the evaluating expression.
Definition at line 134 of file InterpState.h.
Referenced by clang::interp::InterpFrame::getCallRange(), and setEvalLocation().
const VarDecl* clang::interp::InterpState::EvaluatingDecl = nullptr |
Declaration we're initializing/evaluting, if any.
Definition at line 136 of file InterpState.h.
Referenced by clang::interp::EvalEmitter::interpretDecl().
Program& clang::interp::InterpState::P |
Reference to the module containing all bytecode.
Definition at line 126 of file InterpState.h.
Referenced by cleanup().
llvm::SmallVector< std::pair<const Expr *, const LifetimeExtendedTemporaryDecl *> > clang::interp::InterpState::SeenGlobalTemporaries |
Definition at line 140 of file InterpState.h.
InterpStack& clang::interp::InterpState::Stk |
Temporary stack.
Definition at line 128 of file InterpState.h.
Referenced by clang::interp::EvalEmitter::jumpFalse(), clang::interp::EvalEmitter::jumpTrue(), and clang::interp::InterpFrame::popArgs().