clang 19.0.0git
Public Member Functions | Public Attributes | List of all members
clang::interp::InterpState Class Referencefinal

Interpreter context. More...

#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/AST/Interp/InterpState.h"

Inheritance diagram for clang::interp::InterpState:
Inheritance graph
[legend]

Public Member Functions

 InterpState (State &Parent, Program &P, InterpStack &Stk, Context &Ctx, SourceMapper *M=nullptr)
 
 ~InterpState ()
 
 InterpState (const InterpState &)=delete
 
InterpStateoperator= (const InterpState &)=delete
 
FramegetSplitFrame ()
 
FramegetCurrentFrame () override
 
unsigned getCallStackDepth () override
 
const FramegetBottomFrame () const override
 
Expr::EvalStatusgetEvalStatus () const override
 
ASTContextgetCtx () 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.
 
ContextgetContext () const
 
void setEvalLocation (SourceLocation SL)
 
- 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 FramegetCurrentFrame ()=0
 
virtual const FramegetBottomFrame () const =0
 
virtual bool hasActiveDiagnostic ()=0
 
virtual void setActiveDiagnostic (bool Flag)=0
 
virtual void setFoldFailureDiagnostic (bool Flag)=0
 
virtual Expr::EvalStatusgetEvalStatus () const =0
 
virtual ASTContextgetCtx () 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 LangOptionsgetLangOpts () 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 ExprgetExpr (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

ProgramP
 Reference to the module containing all bytecode.
 
InterpStackStk
 Temporary stack.
 
ContextCtx
 Interpreter Context.
 
InterpFrameCurrent = nullptr
 The current frame.
 
SourceLocation EvalLocation
 Source location of the evaluating expression.
 
- 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.
 

Detailed Description

Interpreter context.

Definition at line 35 of file InterpState.h.

Constructor & Destructor Documentation

◆ InterpState() [1/2]

InterpState::InterpState ( State Parent,
Program P,
InterpStack Stk,
Context Ctx,
SourceMapper M = nullptr 
)

Definition at line 18 of file InterpState.cpp.

◆ ~InterpState()

InterpState::~InterpState ( )

Definition at line 22 of file InterpState.cpp.

References clang::interp::InterpFrame::Caller, and Current.

◆ InterpState() [2/2]

clang::interp::InterpState::InterpState ( const InterpState )
delete

Member Function Documentation

◆ checkingForUndefinedBehavior()

bool clang::interp::InterpState::checkingForUndefinedBehavior ( ) const
inlineoverridevirtual

Implements clang::interp::State.

Definition at line 62 of file InterpState.h.

References Parent.

◆ checkingPotentialConstantExpression()

bool clang::interp::InterpState::checkingPotentialConstantExpression ( ) const
inlineoverridevirtual

Implements clang::interp::State.

Definition at line 68 of file InterpState.h.

References Parent.

◆ deallocate()

void InterpState::deallocate ( Block B)

◆ getBottomFrame()

const Frame * clang::interp::InterpState::getBottomFrame ( ) const
inlineoverridevirtual

Implements clang::interp::State.

Definition at line 51 of file InterpState.h.

References Parent.

◆ getCallStackDepth()

unsigned clang::interp::InterpState::getCallStackDepth ( )
inlineoverridevirtual

Implements clang::interp::State.

Definition at line 48 of file InterpState.h.

References Current, and clang::interp::InterpFrame::getDepth().

◆ getContext()

Context & clang::interp::InterpState::getContext ( ) const
inline

Definition at line 99 of file InterpState.h.

References Ctx.

◆ getCtx()

ASTContext & clang::interp::InterpState::getCtx ( ) const
inlineoverridevirtual

Implements clang::interp::State.

Definition at line 59 of file InterpState.h.

References Parent.

Referenced by clang::interp::InterpFrame::describe().

◆ getCurrentFrame()

Frame * InterpState::getCurrentFrame ( )
overridevirtual

◆ getEvalStatus()

Expr::EvalStatus & clang::interp::InterpState::getEvalStatus ( ) const
inlineoverridevirtual

Implements clang::interp::State.

Definition at line 56 of file InterpState.h.

References Parent.

◆ getSource()

SourceInfo clang::interp::InterpState::getSource ( const Function F,
CodePtr  PC 
) const
inlineoverridevirtual

Delegates source mapping to the mapper.

Implements clang::interp::SourceMapper.

Definition at line 91 of file InterpState.h.

References clang::interp::Function::getSource(), and clang::interp::SourceMapper::getSource().

Referenced by clang::interp::InterpFrame::getSource().

◆ getSplitFrame()

Frame * clang::interp::InterpState::getSplitFrame ( )
inline

Definition at line 46 of file InterpState.h.

References Parent.

Referenced by clang::interp::InterpFrame::getCaller().

◆ hasActiveDiagnostic()

bool clang::interp::InterpState::hasActiveDiagnostic ( )
inlineoverridevirtual

Implements clang::interp::State.

Definition at line 75 of file InterpState.h.

References Parent.

◆ hasPriorDiagnostic()

bool clang::interp::InterpState::hasPriorDiagnostic ( )
inlineoverridevirtual

Implements clang::interp::State.

Definition at line 82 of file InterpState.h.

References Parent.

◆ inConstantContext()

bool clang::interp::InterpState::inConstantContext ( ) const
inline

Definition at line 74 of file InterpState.h.

References Parent.

◆ keepEvaluatingAfterFailure()

bool clang::interp::InterpState::keepEvaluatingAfterFailure ( ) const
inlineoverridevirtual

Implements clang::interp::State.

Definition at line 65 of file InterpState.h.

References Parent.

◆ noteUndefinedBehavior()

bool clang::interp::InterpState::noteUndefinedBehavior ( )
inlineoverridevirtual

Implements clang::interp::State.

Definition at line 71 of file InterpState.h.

References Parent.

Referenced by reportOverflow().

◆ operator=()

InterpState & clang::interp::InterpState::operator= ( const InterpState )
delete

◆ reportOverflow()

bool InterpState::reportOverflow ( const Expr E,
const llvm::APSInt &  Value 
)

Reports overflow and return true if evaluation should continue.

Definition at line 42 of file InterpState.cpp.

References clang::interp::State::CCEDiag(), clang::Expr::getType(), and noteUndefinedBehavior().

◆ setActiveDiagnostic()

void clang::interp::InterpState::setActiveDiagnostic ( bool  Flag)
inlineoverridevirtual

Implements clang::interp::State.

Definition at line 76 of file InterpState.h.

References Parent.

◆ setEvalLocation()

void clang::interp::InterpState::setEvalLocation ( SourceLocation  SL)
inline

Definition at line 101 of file InterpState.h.

References EvalLocation.

Referenced by clang::interp::EvalEmitter::interpretExpr().

◆ setFoldFailureDiagnostic()

void clang::interp::InterpState::setFoldFailureDiagnostic ( bool  Flag)
inlineoverridevirtual

Implements clang::interp::State.

Definition at line 79 of file InterpState.h.

References Parent.

Member Data Documentation

◆ Ctx

Context& clang::interp::InterpState::Ctx

Interpreter Context.

Definition at line 117 of file InterpState.h.

Referenced by clang::interp::InterpFrame::describe(), and getContext().

◆ Current

InterpFrame* clang::interp::InterpState::Current = nullptr

The current frame.

Definition at line 119 of file InterpState.h.

Referenced by clang::interp::EvalEmitter::EvalEmitter(), getCallStackDepth(), getCurrentFrame(), and ~InterpState().

◆ EvalLocation

SourceLocation clang::interp::InterpState::EvalLocation

Source location of the evaluating expression.

Definition at line 121 of file InterpState.h.

Referenced by clang::interp::InterpFrame::getCallRange(), and setEvalLocation().

◆ P

Program& clang::interp::InterpState::P

Reference to the module containing all bytecode.

Definition at line 113 of file InterpState.h.

◆ Stk

InterpStack& clang::interp::InterpState::Stk

The documentation for this class was generated from the following files: