clang 20.0.0git
Public Member Functions | Public Attributes | List of all members
clang::interp::State Class Referenceabstract

Interface for the VM to interact with the AST walker's context. More...

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

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

Public Member Functions

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 Attributes

bool InConstantContext = false
 Whether or not we're in a context where the front end requires a constant value.
 

Detailed Description

Interface for the VM to interact with the AST walker's context.

Definition at line 56 of file State.h.

Constructor & Destructor Documentation

◆ ~State()

State::~State ( )
virtual

Definition at line 19 of file State.cpp.

◆ State()

clang::interp::State::State ( )
default

Member Function Documentation

◆ addNotes()

void State::addNotes ( ArrayRef< PartialDiagnosticAt Diags)

Add a stack of notes to a prior diagnostic.

Definition at line 69 of file State.cpp.

References Diag().

◆ CCEDiag() [1/3]

OptionalDiagnostic State::CCEDiag ( const Expr E,
diag::kind  DiagId = diag::note_invalid_subexpr_in_const_expr,
unsigned  ExtraNotes = 0 
)

Definition at line 53 of file State.cpp.

References E, and clang::Expr::getExprLoc().

◆ CCEDiag() [2/3]

OptionalDiagnostic State::CCEDiag ( const SourceInfo SI,
diag::kind  DiagId = diag::note_invalid_subexpr_in_const_expr,
unsigned  ExtraNotes = 0 
)

Definition at line 58 of file State.cpp.

References clang::interp::SourceInfo::getLoc().

◆ CCEDiag() [3/3]

OptionalDiagnostic State::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.

FIXME: Stop evaluating if we're in EM_ConstantExpression or EM_PotentialConstantExpression mode and we produce one of these.

Definition at line 42 of file State.cpp.

References Diag(), and Loc.

Referenced by clang::interp::InterpState::maybeDiagnoseDanglingAllocations(), and clang::interp::InterpState::reportOverflow().

◆ checkingForUndefinedBehavior()

virtual bool clang::interp::State::checkingForUndefinedBehavior ( ) const
pure virtual

Implemented in clang::interp::InterpState.

◆ checkingPotentialConstantExpression()

virtual bool clang::interp::State::checkingPotentialConstantExpression ( ) const
pure virtual

Implemented in clang::interp::InterpState.

◆ FFDiag() [1/3]

OptionalDiagnostic State::FFDiag ( const Expr E,
diag::kind  DiagId = diag::note_invalid_subexpr_in_const_expr,
unsigned  ExtraNotes = 0 
)

Definition at line 26 of file State.cpp.

References Diag(), E, and clang::Expr::getExprLoc().

◆ FFDiag() [2/3]

OptionalDiagnostic State::FFDiag ( const SourceInfo SI,
diag::kind  DiagId = diag::note_invalid_subexpr_in_const_expr,
unsigned  ExtraNotes = 0 
)

Definition at line 34 of file State.cpp.

References Diag(), and clang::interp::SourceInfo::getLoc().

◆ FFDiag() [3/3]

OptionalDiagnostic State::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)

Definition at line 21 of file State.cpp.

References Loc.

◆ getBottomFrame()

virtual const Frame * clang::interp::State::getBottomFrame ( ) const
pure virtual

Implemented in clang::interp::InterpState.

◆ getCallStackDepth()

virtual unsigned clang::interp::State::getCallStackDepth ( )
pure virtual

Implemented in clang::interp::InterpState.

◆ getCtx()

virtual ASTContext & clang::interp::State::getCtx ( ) const
pure virtual

Implemented in clang::interp::InterpState.

◆ getCurrentFrame()

virtual Frame * clang::interp::State::getCurrentFrame ( )
pure virtual

◆ getEvalStatus()

virtual Expr::EvalStatus & clang::interp::State::getEvalStatus ( ) const
pure virtual

Implemented in clang::interp::InterpState.

◆ getLangOpts()

const LangOptions & State::getLangOpts ( ) const

Definition at line 116 of file State.cpp.

◆ hasActiveDiagnostic()

virtual bool clang::interp::State::hasActiveDiagnostic ( )
pure virtual

Implemented in clang::interp::InterpState.

◆ hasPriorDiagnostic()

virtual bool clang::interp::State::hasPriorDiagnostic ( )
pure virtual

Implemented in clang::interp::InterpState.

◆ keepEvaluatingAfterFailure()

virtual bool clang::interp::State::keepEvaluatingAfterFailure ( ) const
pure virtual

Implemented in clang::interp::InterpState.

◆ Note()

OptionalDiagnostic State::Note ( SourceLocation  Loc,
diag::kind  DiagId 
)

Add a note to a prior diagnostic.

Definition at line 63 of file State.cpp.

References Loc.

◆ noteUndefinedBehavior()

virtual bool clang::interp::State::noteUndefinedBehavior ( )
pure virtual

Implemented in clang::interp::InterpState.

◆ report()

DiagnosticBuilder State::report ( SourceLocation  Loc,
diag::kind  DiagId 
)

Directly reports a diagnostic message.

Definition at line 76 of file State.cpp.

References Loc.

◆ setActiveDiagnostic()

virtual void clang::interp::State::setActiveDiagnostic ( bool  Flag)
pure virtual

Implemented in clang::interp::InterpState.

◆ setFoldFailureDiagnostic()

virtual void clang::interp::State::setFoldFailureDiagnostic ( bool  Flag)
pure virtual

Implemented in clang::interp::InterpState.

Member Data Documentation

◆ InConstantContext

bool clang::interp::State::InConstantContext = false

Whether or not we're in a context where the front end requires a constant value.

Definition at line 125 of file State.h.


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