clang 18.0.0git
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
clang::interp::EvalEmitter Class Referenceabstract

An emitter which evaluates opcodes as they are emitted. More...

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

Inheritance diagram for clang::interp::EvalEmitter:
Inheritance graph

Public Types

using LabelTy = uint32_t
using AddrTy = uintptr_t
using Local = Scope::Local

Public Member Functions

llvm::Expected< boolinterpretExpr (const Expr *E)
llvm::Expected< boolinterpretDecl (const VarDecl *VD)
- 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

Protected Member Functions

 EvalEmitter (Context &Ctx, Program &P, State &Parent, InterpStack &Stk, APValue &Result)
virtual ~EvalEmitter ()
void emitLabel (LabelTy Label)
 Define a label.
LabelTy getLabel ()
 Create a label.
virtual bool visitExpr (const Expr *E)=0
 Methods implemented by the compiler.
virtual bool visitDecl (const VarDecl *VD)=0
bool bail (const Stmt *S)
bool bail (const Decl *D)
bool bail (const SourceLocation &Loc)
bool jumpTrue (const LabelTy &Label)
 Emits jumps.
bool jumpFalse (const LabelTy &Label)
bool jump (const LabelTy &Label)
bool fallthrough (const LabelTy &Label)
Local createLocal (Descriptor *D)
 Callback for registering a local.
SourceInfo getSource (const Function *F, CodePtr PC) const override
 Returns the source location of the current opcode.

Protected Attributes

llvm::DenseMap< const ParmVarDecl *, ParamOffsetParams
 Parameter indices.
llvm::DenseMap< const ValueDecl *, ParamOffsetLambdaCaptures
 Lambda captures.
unsigned LambdaThisCapture
llvm::SmallVector< SmallVector< Local, 8 >, 2 > Descriptors
 Local descriptors.

Detailed Description

An emitter which evaluates opcodes as they are emitted.

Definition at line 30 of file EvalEmitter.h.

Member Typedef Documentation

◆ AddrTy

Definition at line 33 of file EvalEmitter.h.

◆ LabelTy

Definition at line 32 of file EvalEmitter.h.

◆ Local

Definition at line 34 of file EvalEmitter.h.

Constructor & Destructor Documentation

◆ EvalEmitter()

EvalEmitter::EvalEmitter ( Context Ctx,
Program P,
State Parent,
InterpStack Stk,
APValue Result 

Definition at line 19 of file EvalEmitter.cpp.

References clang::interp::InterpState::Current.

◆ ~EvalEmitter()

virtual clang::interp::EvalEmitter::~EvalEmitter ( )

Definition at line 43 of file EvalEmitter.h.

Member Function Documentation

◆ bail() [1/3]

bool clang::interp::EvalEmitter::bail ( const Decl D)

Definition at line 55 of file EvalEmitter.h.

References bail(), and clang::Decl::getBeginLoc().

Referenced by bail().

◆ bail() [2/3]

bool EvalEmitter::bail ( const SourceLocation Loc)

Definition at line 71 of file EvalEmitter.cpp.

◆ bail() [3/3]

bool clang::interp::EvalEmitter::bail ( const Stmt S)

Definition at line 54 of file EvalEmitter.h.

References bail().

Referenced by bail().

◆ createLocal()

Scope::Local EvalEmitter::createLocal ( Descriptor D)

◆ emitLabel()

void EvalEmitter::emitLabel ( LabelTy  Label)

Define a label.

Definition at line 43 of file EvalEmitter.cpp.

References Label.

◆ fallthrough()

bool EvalEmitter::fallthrough ( const LabelTy Label)

Definition at line 99 of file EvalEmitter.cpp.

References Label.

◆ getLabel()

EvalEmitter::LabelTy EvalEmitter::getLabel ( )

Create a label.

Definition at line 47 of file EvalEmitter.cpp.

◆ getSource()

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

Returns the source location of the current opcode.

Implements clang::interp::SourceMapper.

Definition at line 68 of file EvalEmitter.h.

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

◆ interpretDecl()

llvm::Expected< bool > EvalEmitter::interpretDecl ( const VarDecl VD)

Definition at line 35 of file EvalEmitter.cpp.

References visitDecl().

◆ interpretExpr()

llvm::Expected< bool > EvalEmitter::interpretExpr ( const Expr E)

Definition at line 27 of file EvalEmitter.cpp.

References visitExpr().

◆ jump()

bool EvalEmitter::jump ( const LabelTy Label)

Definition at line 93 of file EvalEmitter.cpp.

References Label.

◆ jumpFalse()

bool EvalEmitter::jumpFalse ( const LabelTy Label)

◆ jumpTrue()

bool EvalEmitter::jumpTrue ( const LabelTy Label)

Emits jumps.

Definition at line 77 of file EvalEmitter.cpp.

References Label, clang::interp::InterpStack::pop(), and clang::interp::InterpState::Stk.

◆ visitDecl()

virtual bool clang::interp::EvalEmitter::visitDecl ( const VarDecl VD)
protectedpure virtual

Referenced by interpretDecl().

◆ visitExpr()

virtual bool clang::interp::EvalEmitter::visitExpr ( const Expr E)
protectedpure virtual

Methods implemented by the compiler.

Referenced by interpretExpr().

Member Data Documentation

◆ Descriptors

llvm::SmallVector<SmallVector<Local, 8>, 2> clang::interp::EvalEmitter::Descriptors

Local descriptors.

Definition at line 78 of file EvalEmitter.h.

◆ LambdaCaptures

llvm::DenseMap<const ValueDecl *, ParamOffset> clang::interp::EvalEmitter::LambdaCaptures

Lambda captures.

Definition at line 75 of file EvalEmitter.h.

◆ LambdaThisCapture

unsigned clang::interp::EvalEmitter::LambdaThisCapture

Definition at line 76 of file EvalEmitter.h.

◆ Params

llvm::DenseMap<const ParmVarDecl *, ParamOffset> clang::interp::EvalEmitter::Params

Parameter indices.

Definition at line 73 of file EvalEmitter.h.

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