|
clang 23.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 | |
| State (ASTContext &ASTCtx, Expr::EvalStatus &EvalStatus) | |
| virtual | ~State () |
| virtual const Frame * | getCurrentFrame ()=0 |
| virtual const Frame * | getBottomFrame () const =0 |
| virtual unsigned | getCallStackDepth ()=0 |
| virtual bool | stepsLeft () const =0 |
| Expr::EvalStatus & | getEvalStatus () const |
| ASTContext & | getASTContext () const |
| const LangOptions & | getLangOpts () const |
| bool | noteSideEffect () const |
| Note that we have had a side-effect, and determine whether we should keep evaluating. | |
| bool | keepEvaluatingAfterFailure () const |
| Should we continue evaluation as much as possible after encountering a construct which can't be reduced to a value? | |
| bool | keepEvaluatingAfterSideEffect () const |
| Should we continue evaluation after encountering a side-effect that we couldn't model? | |
| bool | noteUndefinedBehavior () const |
| Note that we hit something that was technically undefined behavior, but that we can evaluate past it (such as signed overflow or floating-point division by zero.) | |
| bool | checkingPotentialConstantExpression () const |
| Are we checking whether the expression is a potential constant expression? | |
| bool | checkingForUndefinedBehavior () const |
| Are we checking an expression for overflow? | |
| 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 (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 (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 |
| ASTContext & | Ctx |
| Expr::EvalStatus & | EvalStatus |
Interface for the VM to interact with the AST walker's context.
|
inline |
Definition at line 83 of file State.h.
References Ctx, and EvalStatus.
Referenced by clang::interp::InterpState::InterpState(), and clang::interp::InterpState::InterpState().
|
virtual |
| 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(), and EvalStatus.
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 | ( | 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(), and EvalStatus.
Referenced by clang::interp::Assume(), clang::interp::CallVirt(), clang::interp::CastFloatingIntegral(), CCEDiag(), CCEDiag(), CCEDiag(), clang::interp::CheckBitCast(), 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::convertDoubleToFloatStrict(), 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_infer_alloc_token(), 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 124 of file State.h.
References CheckingForUndefinedBehavior.
Referenced by clang::interp::AddSubMulHelper(), clang::interp::handleFixedPointOverflow(), clang::interp::IncDecHelper(), keepEvaluatingAfterFailure(), keepEvaluatingAfterSideEffect(), and clang::interp::Neg().
|
inline |
Are we checking whether the expression is a potential constant expression?
Definition at line 120 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::CheckFunctionDecl(), clang::interp::CheckLifetime(), clang::interp::CheckLive(), clang::interp::CtorCheck(), clang::interp::diagnoseCallableDecl(), clang::interp::DiagnoseUninitialized(), clang::interp::GetParam(), 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(), keepEvaluatingAfterFailure(), keepEvaluatingAfterSideEffect(), 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 EvalStatus, FFDiag(), and clang::Expr::getExprLoc().
| OptionalDiagnostic State::FFDiag | ( | SourceInfo | SI, |
| diag::kind | DiagId = diag::note_invalid_subexpr_in_const_expr, | ||
| unsigned | ExtraNotes = 0 ) |
Definition at line 34 of file State.cpp.
References EvalStatus, FFDiag(), and clang::interp::SourceInfo::getLoc().
| 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::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(), clang::interp::diagnoseCallableDecl(), diagnoseMissingInitializer(), diagnoseNonConstVariable(), clang::interp::DiagnoseUninitialized(), clang::interp::DiagnoseUninitializedSubobject(), diagnoseUnknownDecl(), clang::interp::Divc(), clang::interp::DoBitCastPtr(), FFDiag(), FFDiag(), FFDiag(), clang::interp::Free(), clang::interp::GetDynamicDecl(), clang::interp::getField(), clang::interp::InitElem(), clang::interp::InitElemPop(), clang::interp::interp__builtin_elementwise_countzeroes(), clang::interp::interp__builtin_ia32_vcvtps2ph(), 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::InvalidStore(), clang::interp::NoRet(), clang::interp::InterpState::noteStep(), clang::interp::runRecordDestructor(), clang::interp::SubPtr(), and clang::interp::Unsupported().
|
inline |
Definition at line 93 of file State.h.
References Ctx.
Referenced by clang::interp::AllocN(), clang::interp::BitCastPrim(), clang::interp::CallPtr(), clang::interp::CheckArraySize(), clang::interp::CheckBitCast(), CheckBitcastType(), clang::interp::CheckConstant(), clang::interp::CheckDecl(), clang::interp::CheckDeleteSource(), clang::interp::CheckNewDeleteForms(), clang::interp::CheckNewTypeMismatch(), clang::interp::CheckPointerToIntegralCast(), CheckTemporary(), clang::interp::CMP3(), clang::interp::CmpHelper< Pointer >(), clang::interp::CmpHelperEQ< Pointer >(), clang::interp::Destroy(), clang::interp::diagnoseNonConstexprBuiltin(), clang::interp::DiagnoseUninitialized(), clang::interp::DoBitCast(), clang::interp::DoBitCastPtr(), clang::interp::DoBitCastPtr(), clang::interp::Free(), clang::interp::GetDynamicDecl(), clang::interp::getField(), clang::interp::GetPtrBase(), clang::interp::GetPtrBasePop(), clang::interp::handleFixedPointOverflow(), clang::interp::interp__builtin_assume_aligned(), clang::interp::interp__builtin_atomic_lock_free(), clang::interp::interp__builtin_c11_atomic_is_lock_free(), clang::interp::interp__builtin_eh_return_data_regno(), clang::interp::interp__builtin_elementwise_countzeroes(), clang::interp::interp__builtin_ia32_cvt_vec2mask(), clang::interp::interp__builtin_ia32_cvtpd2ps(), clang::interp::interp__builtin_ia32_cvtsd2ss(), clang::interp::interp__builtin_ia32_movmsk_op(), clang::interp::interp__builtin_ia32_phminposuw(), clang::interp::interp__builtin_ia32_pternlog(), clang::interp::interp__builtin_ia32_shift_with_count(), clang::interp::interp__builtin_ia32_shuffle_generic(), clang::interp::interp__builtin_ia32_test_op(), clang::interp::interp__builtin_ia32_vcvtps2ph(), clang::interp::interp__builtin_inf(), clang::interp::interp__builtin_infer_alloc_token(), 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_nan(), clang::interp::interp__builtin_object_size(), clang::interp::interp__builtin_operator_delete(), clang::interp::interp__builtin_operator_new(), clang::interp::interp__builtin_os_log_format_buffer_size(), clang::interp::interp__builtin_overflowop(), clang::interp::interp__builtin_strcmp(), clang::interp::interp__builtin_strlen(), clang::interp::interp__builtin_x86_pack(), clang::interp::interp_builtin_horizontal_fp_binop(), clang::interp::interp_builtin_horizontal_int_binop(), clang::interp::InterpretBuiltin(), clang::interp::InterpretOffsetOf(), clang::interp::InterpState::InterpState(), clang::interp::InterpState::InterpState(), clang::interp::PtrPtrCast(), clang::interp::pushInteger(), and clang::interp::SubPtr().
|
pure virtual |
Implemented in clang::interp::InterpState.
|
pure virtual |
Implemented in clang::interp::InterpState.
|
pure virtual |
Implemented in clang::interp::InterpState.
|
inline |
Definition at line 92 of file State.h.
References EvalStatus.
Referenced by clang::interp::InterpState::diagnosing(), clang::interp::EndSpeculation(), clang::interp::interp__builtin_is_constant_evaluated(), clang::interp::InterpState::InterpState(), clang::interp::InterpState::InterpState(), and clang::interp::StartSpeculation().
|
inline |
Definition at line 94 of file State.h.
References Ctx.
Referenced by clang::interp::Call(), clang::interp::CallVirt(), clang::interp::CheckArraySize(), clang::interp::CheckBitCast(), clang::interp::CheckBitCast(), clang::interp::CheckCallable(), clang::interp::CheckCallDepth(), clang::interp::CheckConstant(), clang::interp::CheckDummy(), clang::interp::CheckDynamicMemoryAllocation(), clang::interp::CheckExtern(), clang::interp::CheckGlobalLoad(), clang::interp::CheckLiteralType(), clang::interp::CheckLocalLoad(), clang::interp::CheckMutable(), clang::interp::CheckPointerToIntegralCast(), clang::interp::CheckPseudoDtor(), clang::interp::CheckRange(), clang::interp::CheckShift(), clang::interp::CheckThis(), clang::interp::CheckVolatile(), clang::interp::diagnoseCallableDecl(), clang::interp::diagnoseNonConstexprBuiltin(), diagnoseNonConstVariable(), clang::interp::DiagnoseUninitialized(), diagnoseUnknownDecl(), clang::interp::DoBitCastPtr(), clang::interp::DoShift(), clang::interp::DoShiftAP(), clang::interp::FnPtrCast(), clang::interp::getField(), clang::interp::GetIntPtr(), clang::interp::IncDecHelper(), clang::interp::InitElem(), clang::interp::InitElemPop(), clang::interp::interp__builtin_classify_type(), clang::interp::interp__builtin_operator_new(), clang::interp::InterpState::InterpState(), clang::interp::InterpState::InterpState(), clang::interp::InvalidCast(), clang::interp::InvalidNewDeleteExpr(), clang::interp::InvalidStore(), clang::interp::InterpState::maybeDiagnoseDanglingAllocations(), clang::interp::OffsetHelper(), clang::interp::PtrPtrCast(), and clang::interp::SubPtr().
| bool State::keepEvaluatingAfterFailure | ( | ) | const |
Should we continue evaluation as much as possible after encountering a construct which can't be reduced to a value?
Definition at line 178 of file State.cpp.
References checkingForUndefinedBehavior(), checkingPotentialConstantExpression(), clang::ConstantExpression, clang::ConstantExpressionUnevaluated, clang::ConstantFold, Ctx, EvalMode, clang::IgnoreSideEffects, keepEvaluatingAfterFailure(), and stepsLeft().
Referenced by keepEvaluatingAfterFailure().
| bool State::keepEvaluatingAfterSideEffect | ( | ) | const |
Should we continue evaluation after encountering a side-effect that we couldn't model?
Definition at line 194 of file State.cpp.
References checkingForUndefinedBehavior(), checkingPotentialConstantExpression(), clang::ConstantExpression, clang::ConstantExpressionUnevaluated, clang::ConstantFold, EvalMode, clang::IgnoreSideEffects, and keepEvaluatingAfterSideEffect().
Referenced by keepEvaluatingAfterSideEffect(), and noteSideEffect().
| OptionalDiagnostic State::Note | ( | SourceLocation | Loc, |
| diag::kind | DiagId ) |
Add a note to a prior diagnostic.
Definition at line 63 of file State.cpp.
References Note().
Referenced by clang::interp::CallVirt(), CheckBitcastType(), 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(), clang::interp::diagnoseCallableDecl(), diagnoseMissingInitializer(), diagnoseNonConstVariable(), clang::interp::DiagnoseUninitialized(), clang::interp::DiagnoseUninitializedSubobject(), diagnoseUnknownDecl(), clang::interp::interp__builtin_operator_delete(), clang::interp::InvalidDeclRef(), and Note().
|
inline |
Note that we have had a side-effect, and determine whether we should keep evaluating.
Definition at line 98 of file State.h.
References EvalStatus, and keepEvaluatingAfterSideEffect().
Referenced by clang::interp::SideEffect().
|
inline |
Note that we hit something that was technically undefined behavior, but that we can evaluate past it (such as signed overflow or floating-point division by zero.)
Definition at line 113 of file State.h.
References EvalStatus.
Referenced by clang::interp::CastFloatingIntegral(), clang::interp::CheckFloatResult(), clang::interp::CheckNull(), clang::interp::CheckShift(), clang::interp::DoShift(), clang::interp::DoShiftAP(), clang::interp::handleFixedPointOverflow(), and clang::interp::handleOverflow().
| DiagnosticBuilder State::report | ( | SourceLocation | Loc, |
| diag::kind | DiagId ) |
Directly reports a diagnostic message.
Definition at line 74 of file State.cpp.
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.
Referenced by keepEvaluatingAfterFailure().
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 188 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 180 of file State.h.
Referenced by checkingPotentialConstantExpression(), clang::interp::InterpState::InterpState(), and clang::interp::InterpState::InterpState().
| ASTContext& clang::interp::State::Ctx |
Definition at line 191 of file State.h.
Referenced by getASTContext(), getLangOpts(), keepEvaluatingAfterFailure(), report(), and State().
| EvaluationMode clang::interp::State::EvalMode |
Definition at line 190 of file State.h.
Referenced by clang::interp::InitGlobalTemp(), clang::interp::InitGlobalTempComp(), clang::interp::InterpState::InterpState(), clang::interp::InterpState::InterpState(), keepEvaluatingAfterFailure(), and keepEvaluatingAfterSideEffect().
| Expr::EvalStatus& clang::interp::State::EvalStatus |
Definition at line 192 of file State.h.
Referenced by addNotes(), CCEDiag(), FFDiag(), FFDiag(), getEvalStatus(), noteSideEffect(), noteUndefinedBehavior(), and State().
Whether or not we're in a context where the front end requires a constant value.
Definition at line 175 of file State.h.
Referenced by clang::interp::InterpState::inConstantContext(), clang::interp::InterpState::InterpState(), and clang::interp::InterpState::InterpState().