clang 22.0.0git
clang::Expr::EvalStatus Struct Reference

EvalStatus is a struct with detailed info about an evaluation in progress. More...

#include "clang/AST/Expr.h"

Inheritance diagram for clang::Expr::EvalStatus:
[legend]

Public Member Functions

 EvalStatus ()=default
bool hasSideEffects () const

Public Attributes

bool HasSideEffects = false
 Whether the evaluated expression has side effects.
bool HasUndefinedBehavior = false
 Whether the evaluation hit undefined behavior.
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).

Detailed Description

EvalStatus is a struct with detailed info about an evaluation in progress.

Definition at line 609 of file Expr.h.

Constructor & Destructor Documentation

◆ EvalStatus()

clang::Expr::EvalStatus::EvalStatus ( )
default

Member Function Documentation

◆ hasSideEffects()

bool clang::Expr::EvalStatus::hasSideEffects ( ) const
inline

Member Data Documentation

◆ Diag

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 633 of file Expr.h.

Referenced by calculateConstraintSatisfaction(), clang::Sema::CheckForImmediateInvocation(), clang::Sema::ConstantFoldAttrArgs(), diagnoseWellFormedUnsatisfiedConstraintExpr(), clang::interp::InterpState::diagnosing(), clang::interp::EndSpeculation(), EvaluateAndDiagnoseImmediateInvocation(), clang::Expr::EvaluateAsInitializer(), clang::Sema::EvaluateConvertedConstantExpression(), clang::VarDecl::evaluateDestruction(), clang::interp::interp__builtin_is_constant_evaluated(), isNullPointerValueTemplateArgument(), clang::Expr::isPotentialConstantExpr(), clang::Expr::isPotentialConstantExprUnevaluated(), clang::processConstant32BitIntArgument(), clang::interp::StartSpeculation(), and clang::Sema::VerifyIntegerConstantExpression().

◆ HasSideEffects

◆ HasUndefinedBehavior

bool clang::Expr::EvalStatus::HasUndefinedBehavior = false

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 617 of file Expr.h.

Referenced by clang::Sema::VerifyIntegerConstantExpression().


The documentation for this struct was generated from the following file: