clang 22.0.0git
|
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"
Public Member Functions | |
virtual | ~State () |
virtual bool | noteUndefinedBehavior ()=0 |
virtual bool | keepEvaluatingAfterFailure () const =0 |
virtual bool | keepEvaluatingAfterSideEffect () 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 & | getASTContext () const =0 |
virtual bool | hasPriorDiagnostic ()=0 |
virtual unsigned | getCallStackDepth ()=0 |
virtual bool | noteSideEffect ()=0 |
bool | checkingPotentialConstantExpression () const |
Are we checking whether the expression is a potential constant expression? | |
bool | checkingForUndefinedBehavior () const |
Are we checking an expression for overflow? | |
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. |
Public Attributes | |
bool | InConstantContext = false |
Whether or not we're in a context where the front end requires a constant value. | |
bool | CheckingPotentialConstantExpression = false |
Whether we're checking that an expression is a potential constant expression. | |
bool | CheckingForUndefinedBehavior = false |
Whether we're checking for an expression that has undefined behavior. | |
EvaluationMode | EvalMode |
Interface for the VM to interact with the AST walker's context.
|
virtual |
|
default |
void State::addNotes | ( | ArrayRef< PartialDiagnosticAt > | Diags | ) |
Add a stack of notes to a prior diagnostic.
Definition at line 69 of file State.cpp.
References addNotes(), Diag(), getEvalStatus(), and hasActiveDiagnostic().
Referenced by addNotes().
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 CCEDiag(), and clang::Expr::getExprLoc().
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 CCEDiag(), and clang::interp::SourceInfo::getLoc().
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 CCEDiag(), Diag(), getEvalStatus(), and setActiveDiagnostic().
Referenced by clang::interp::Assume(), clang::interp::CallVirt(), clang::interp::CastFloatingIntegral(), clang::interp::CastPointerIntegral(), CCEDiag(), CCEDiag(), CCEDiag(), clang::interp::CheckCallable(), clang::interp::CheckConstant(), clang::interp::CheckDecl(), clang::interp::CheckDivRem(), clang::interp::CheckDowncast(), clang::interp::CheckDynamicMemoryAllocation(), clang::interp::CheckFloatResult(), clang::interp::CheckNonNullArg(), clang::interp::CheckNonNullArgs(), clang::interp::CheckPointerToIntegralCast(), clang::interp::CheckPseudoDtor(), clang::interp::CheckShift(), clang::interp::CmpHelper< Pointer >(), clang::interp::CmpHelperEQ< MemberPointer >(), clang::interp::diagnoseEnumValue(), clang::interp::diagnoseNonConstexprBuiltin(), clang::interp::DiagTypeid(), clang::interp::DoShift(), clang::interp::DoShiftAP(), clang::interp::FnPtrCast(), clang::interp::GetIntPtr(), clang::interp::GetPtrDerivedPop(), clang::interp::handleFixedPointOverflow(), clang::interp::handleOverflow(), clang::interp::interp__builtin_assume_aligned(), clang::interp::interp__builtin_is_within_lifetime(), clang::interp::interp__builtin_operator_delete(), clang::interp::InvalidCast(), clang::interp::InterpState::maybeDiagnoseDanglingAllocations(), clang::interp::OffsetHelper(), clang::interp::PtrPtrCast(), clang::interp::ShiftFixedPoint(), and clang::interp::SizelessVectorElementSize().
|
inline |
Are we checking an expression for overflow?
Definition at line 103 of file State.h.
References CheckingForUndefinedBehavior.
Referenced by clang::interp::AddSubMulHelper(), clang::interp::handleFixedPointOverflow(), clang::interp::IncDecHelper(), and clang::interp::Neg().
|
inline |
Are we checking whether the expression is a potential constant expression?
Definition at line 99 of file State.h.
References CheckingPotentialConstantExpression.
Referenced by clang::interp::ActivateThisField(), clang::interp::Call(), clang::interp::CallBI(), clang::interp::CallVar(), clang::interp::CheckCallable(), clang::interp::CheckExtern(), clang::interp::CheckLifetime(), clang::interp::CheckLive(), clang::interp::DiagnoseUninitialized(), clang::interp::GetParam(), clang::interp::GetPtrParam(), clang::interp::GetPtrThisBase(), clang::interp::GetPtrThisField(), clang::interp::GetPtrThisVirtBase(), clang::interp::GetThisField(), clang::interp::InitThisBitField(), clang::interp::InitThisBitFieldActivate(), clang::interp::InitThisField(), clang::interp::InitThisFieldActivate(), clang::interp::interp__builtin_is_constant_evaluated(), clang::interp::interp__builtin_operator_delete(), clang::interp::InvalidCast(), clang::interp::InterpState::maybeDiagnoseDanglingAllocations(), clang::interp::Ret(), clang::interp::RetVoid(), clang::interp::RVOPtr(), clang::interp::SetThisField(), and clang::interp::This().
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(), FFDiag(), getEvalStatus(), clang::Expr::getExprLoc(), and setActiveDiagnostic().
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(), FFDiag(), getEvalStatus(), clang::interp::SourceInfo::getLoc(), and setActiveDiagnostic().
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 FFDiag().
Referenced by clang::interp::AllocN(), clang::interp::ArrayDecay(), clang::interp::BitCastPrim(), clang::interp::CallPtr(), clang::interp::CallVirt(), clang::interp::CheckActive(), clang::interp::CheckArray(), clang::interp::CheckArraySize(), clang::interp::CheckArraySize(), clang::interp::CheckBitCast(), CheckBitcastType(), clang::interp::CheckCallable(), clang::interp::CheckCallDepth(), clang::interp::CheckConst(), clang::interp::checkConstructor(), clang::interp::CheckDeleteSource(), clang::interp::CheckDestructor(), clang::interp::CheckDivRem(), clang::interp::CheckDummy(), clang::interp::CheckFieldsInitialized(), clang::interp::CheckFloatResult(), CheckGlobal(), clang::interp::CheckGlobalLoad(), clang::interp::CheckLifetime(), clang::interp::CheckLiteralType(), clang::interp::CheckLive(), clang::interp::CheckLoad(), clang::interp::CheckLocalLoad(), clang::interp::CheckMutable(), clang::interp::CheckNewDeleteForms(), clang::interp::CheckNewTypeMismatch(), clang::interp::CheckNull(), clang::interp::CheckNull(), clang::interp::CheckRange(), clang::interp::CheckRange(), clang::interp::EvaluationResult::checkReturnValue(), clang::interp::CheckSubobject(), CheckTemporary(), clang::interp::CheckThis(), clang::interp::CheckVolatile(), clang::interp::CheckWeak(), clang::interp::CMP3(), clang::interp::CmpHelper< Pointer >(), clang::interp::CmpHelperEQ< MemberPointer >(), clang::interp::CmpHelperEQ< Pointer >(), clang::interp::Destroy(), diagnoseMissingInitializer(), diagnoseNonConstVariable(), clang::interp::DiagnoseUninitialized(), clang::interp::DiagnoseUninitializedSubobject(), diagnoseUnknownDecl(), clang::interp::Divc(), clang::interp::DoBitCastPtr(), FFDiag(), FFDiag(), FFDiag(), clang::interp::Free(), clang::interp::getField(), clang::interp::InitElem(), clang::interp::InitElemPop(), clang::interp::interp__builtin_elementwise_countzeroes(), clang::interp::interp__builtin_is_aligned_up_down(), clang::interp::interp__builtin_memchr(), clang::interp::interp__builtin_memcmp(), clang::interp::interp__builtin_memcpy(), clang::interp::interp__builtin_operator_delete(), clang::interp::interp__builtin_operator_new(), clang::interp::InterpretBuiltin(), clang::interp::Invalid(), clang::interp::InvalidCast(), clang::interp::InvalidDeclRef(), clang::interp::InvalidNewDeleteExpr(), clang::interp::InvalidShuffleVectorIndex(), clang::interp::NoRet(), clang::interp::runRecordDestructor(), clang::interp::SubPtr(), and clang::interp::Unsupported().
|
pure virtual |
Implemented in clang::interp::InterpState.
Referenced by report().
|
pure virtual |
Implemented in clang::interp::InterpState.
|
pure virtual |
Implemented in clang::interp::InterpState.
|
pure virtual |
Implemented in clang::interp::InterpState.
|
pure virtual |
Implemented in clang::interp::InterpState.
Referenced by addNotes(), CCEDiag(), FFDiag(), and FFDiag().
|
pure virtual |
Implemented in clang::interp::InterpState.
Referenced by addNotes(), and Note().
|
pure virtual |
Implemented in clang::interp::InterpState.
|
pure virtual |
Implemented in clang::interp::InterpState.
|
pure virtual |
Implemented in clang::interp::InterpState.
OptionalDiagnostic State::Note | ( | SourceLocation | Loc, |
diag::kind | DiagId ) |
Add a note to a prior diagnostic.
Definition at line 63 of file State.cpp.
References hasActiveDiagnostic(), and Note().
Referenced by clang::interp::CallVirt(), CheckBitcastType(), clang::interp::CheckCallable(), clang::interp::CheckConstant(), clang::interp::CheckDeleteSource(), clang::interp::CheckGlobalLoad(), clang::interp::CheckLive(), clang::interp::CheckLocalLoad(), clang::interp::CheckMutable(), clang::interp::CheckNewDeleteForms(), clang::interp::EvaluationResult::checkReturnValue(), CheckTemporary(), clang::interp::CheckVolatile(), clang::interp::CheckWeak(), diagnoseMissingInitializer(), diagnoseNonConstVariable(), clang::interp::DiagnoseUninitialized(), clang::interp::DiagnoseUninitializedSubobject(), diagnoseUnknownDecl(), clang::interp::interp__builtin_operator_delete(), clang::interp::InvalidDeclRef(), and Note().
|
pure virtual |
Implemented in clang::interp::InterpState.
|
pure virtual |
Implemented in clang::interp::InterpState.
DiagnosticBuilder State::report | ( | SourceLocation | Loc, |
diag::kind | DiagId ) |
Directly reports a diagnostic message.
Definition at line 74 of file State.cpp.
References getASTContext(), and report().
Referenced by clang::interp::AddSubMulHelper(), clang::interp::IncDecHelper(), clang::interp::interp__builtin_is_constant_evaluated(), clang::interp::Neg(), and report().
|
pure virtual |
Implemented in clang::interp::InterpState.
|
pure virtual |
Implemented in clang::interp::InterpState.
Whether we're checking for an expression that has undefined behavior.
If so, we will produce warnings if we encounter an operation that is always undefined.
Note that we still need to evaluate the expression normally when this is set; this is used when evaluating ICEs in C.
Definition at line 169 of file State.h.
Referenced by checkingForUndefinedBehavior(), clang::interp::InterpState::InterpState(), and clang::interp::InterpState::InterpState().
Whether we're checking that an expression is a potential constant expression.
If so, do not fail on constructs that could become constant later on (such as a use of an undefined global).
Definition at line 161 of file State.h.
Referenced by checkingPotentialConstantExpression(), clang::interp::InterpState::InterpState(), and clang::interp::InterpState::InterpState().
EvaluationMode clang::interp::State::EvalMode |
Definition at line 171 of file State.h.
Referenced by clang::interp::InitGlobalTemp(), clang::interp::InitGlobalTempComp(), clang::interp::InterpState::InterpState(), and clang::interp::InterpState::InterpState().
Whether or not we're in a context where the front end requires a constant value.
Definition at line 156 of file State.h.
Referenced by clang::interp::InterpState::inConstantContext(), clang::interp::InterpState::InterpState(), and clang::interp::InterpState::InterpState().