|
clang 24.0.0git
|
EvalStatus is a struct with detailed info about an evaluation in progress. More...
#include "clang/AST/Expr.h"
Public Member Functions | |
| EvalStatus ()=default | |
| bool | hasSideEffects () const |
| Return true if the evaluated expression has side effects. | |
Public Attributes | |
| bool | HasSideEffects = false |
| Whether the evaluated expression has side effects. | |
| bool | HasUndefinedBehavior = false |
| Whether the evaluation hit undefined behavior. | |
| bool | DiagEmitted = false |
| Whether any diagnostic has been emitted. | |
| SmallVectorImpl< PartialDiagnosticAt > * | Diag = nullptr |
| Diag - If this is non-null, it will be filled in with a stack of notes indicating why evaluation failed (or why it failed to produce a constant expression). | |
| SmallVectorImpl< PartialDiagnosticAt > * | ExtendedDiag = nullptr |
| Location where we spot ptr to int cast or null subobject while evaluating constant expression in MS compatibility mode. | |
EvalStatus is a struct with detailed info about an evaluation in progress.
|
default |
|
inline |
Return true if the evaluated expression has side effects.
Definition at line 660 of file Expr.h.
References HasSideEffects.
Referenced by clang::CIRGen::CIRGenFunction::emitBuiltinExpr(), clang::CodeGen::CodeGenModule::GetAddrOfGlobalTemporary(), clang::CIRGen::CIRGenModule::getAddrOfGlobalTemporary(), and clang::CIRGen::ConstantEmitter::tryEmitPrivate().
| SmallVectorImpl<PartialDiagnosticAt>* clang::Expr::EvalStatus::Diag = nullptr |
Diag - If this is non-null, it will be filled in with a stack of notes indicating why evaluation failed (or why it failed to produce a constant expression).
If the expression is unfoldable, the notes will indicate why it's not foldable. If the expression is foldable, but not a constant expression, the notes will describes why it isn't a constant expression. If the expression is a constant expression, no notes will be produced.
FIXME: this causes significant performance concerns and should be refactored at some point. Not all evaluations of the constant expression interpreter will display the given diagnostics, this means those kinds of uses are paying the expense of generating a diagnostic (which may include expensive operations like converting APValue objects to a string representation).
Definition at line 650 of file Expr.h.
Referenced by clang::Sema::ComputeExpansionSize(), clang::Sema::ConstantFoldAttrArgs(), diagnoseWellFormedUnsatisfiedConstraintExpr(), clang::interp::InterpState::diagnosing(), EvaluateAndDiagnoseImmediateInvocation(), clang::Sema::EvaluateConvertedConstantExpression(), clang::VarDecl::evaluateDestruction(), clang::interp::interp__builtin_is_constant_evaluated(), isNullPointerValueTemplateArgument(), clang::Expr::isPotentialConstantExpr(), clang::Expr::isPotentialConstantExprUnevaluated(), clang::interp::LoadPopL(), clang::interp::PopIgnoreDiags(), clang::processConstant32BitIntArgument(), clang::interp::PushIgnoreDiags(), and clang::Sema::VerifyIntegerConstantExpression().
Whether any diagnostic has been emitted.
This is set regardless of whether Diag is set or not.
Definition at line 634 of file Expr.h.
Referenced by clang::Sema::CheckForImmediateInvocation(), clang::interp::PopIgnoreDiags(), and clang::interp::PushIgnoreDiags().
| SmallVectorImpl<PartialDiagnosticAt>* clang::Expr::EvalStatus::ExtendedDiag = nullptr |
Location where we spot ptr to int cast or null subobject while evaluating constant expression in MS compatibility mode.
Definition at line 654 of file Expr.h.
Referenced by clang::Sema::EvaluateConvertedConstantExpression(), and clang::Sema::VerifyIntegerConstantExpression().
Whether the evaluated expression has side effects.
For example, (f() && 0) can be folded, but it still has side effects.
Definition at line 625 of file Expr.h.
Referenced by CheckEvalInICE(), clang::Expr::EvaluateAsInitializer(), EvaluateDestruction(), clang::VarDecl::evaluateDestruction(), hasSideEffects(), isNullPointerValueTemplateArgument(), clang::CIRGen::CIRGenFunction::tryEmitAsConstant(), clang::CodeGen::CodeGenFunction::tryEmitAsConstant(), and clang::Sema::VerifyIntegerConstantExpression().
Whether the evaluation hit undefined behavior.
For example, 1.0 / 0.0 can be folded to Inf, but has undefined behavior. Likewise, INT_MAX + 1 can be folded to INT_MIN, but has UB.
Definition at line 630 of file Expr.h.
Referenced by clang::Sema::VerifyIntegerConstantExpression().