clang 24.0.0git
clang::interp::EvaluationResult Class Referencefinal

Defines the result of an evaluation. More...

#include "/work/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/AST/ByteCode/EvaluationResult.h"

Public Types

enum  ResultKind { Empty , Invalid , Valid }

Public Member Functions

 EvaluationResult (const Context &Ctx)
bool empty () const
bool isInvalid () const
APValue stealAPValue ()
bool checkFullyInitialized (InterpState &S, const Pointer &Ptr) const
 Check that all subobjects of the given pointer have been initialized.
bool checkDynamicAllocations (InterpState &S, const Pointer &Ptr, SourceInfo Info) const
 Check that none of the blocks the given pointer (transitively) points to are dynamically allocated.
bool checkLValue (InterpState &S, const Pointer &Ptr, SourceInfo Info, ConstantExprKind ConstexprKind) const
 Check the given pointer as an lvalue, i.e.
bool checkLValueFields (InterpState &S, const Pointer &Ptr, SourceInfo Info, ConstantExprKind ConstexprKind) const
 Check all fields of the given pointer.
bool checkFunctionPointer (InterpState &S, const Pointer &Ptr, SourceInfo Info, ConstantExprKind ConstexprKind) const
 Check if the given function pointer can be returned from an evaluation.
QualType getSourceType () const
void dump () const
 Dump to stderr.

Static Public Member Functions

static bool checkMemberPointer (InterpState &S, const MemberPointer &MemberPtr, SourceInfo Info, ConstantExprKind ConstexprKind)
 Check if the given member pointer can be returned from an evaluation.

Friends

class EvalEmitter
class InterpState

Detailed Description

Defines the result of an evaluation.

The Kind defined if the evaluation was invalid, valid (but empty, e.g. for void expressions) or if we have a valid evaluation result.

We use this class to inspect and diagnose the result, as well as convert it to the requested form.

Definition at line 33 of file EvaluationResult.h.

Member Enumeration Documentation

◆ ResultKind

Enumerator
Empty 
Invalid 
Valid 

Definition at line 35 of file EvaluationResult.h.

Constructor & Destructor Documentation

◆ EvaluationResult()

clang::interp::EvaluationResult::EvaluationResult ( const Context & Ctx)
inline

Definition at line 68 of file EvaluationResult.h.

Member Function Documentation

◆ checkDynamicAllocations()

bool clang::interp::EvaluationResult::checkDynamicAllocations ( InterpState & S,
const Pointer & Ptr,
SourceInfo Info ) const

Check that none of the blocks the given pointer (transitively) points to are dynamically allocated.

Definition at line 264 of file EvaluationResult.cpp.

References clang::interp::collectBlocks(), clang::interp::State::FFDiag(), InterpState, and clang::interp::State::Note().

◆ checkFullyInitialized()

bool clang::interp::EvaluationResult::checkFullyInitialized ( InterpState & S,
const Pointer & Ptr ) const

Check that all subobjects of the given pointer have been initialized.

Definition at line 152 of file EvaluationResult.cpp.

References clang::cast(), clang::interp::CheckArrayInitialized(), clang::interp::CheckFieldsInitialized(), empty(), and InterpState.

◆ checkFunctionPointer()

bool clang::interp::EvaluationResult::checkFunctionPointer ( InterpState & S,
const Pointer & Ptr,
SourceInfo Info,
ConstantExprKind ConstexprKind ) const

Check if the given function pointer can be returned from an evaluation.

Definition at line 648 of file EvaluationResult.cpp.

References clang::interp::checkFunctionPtr(), and InterpState.

◆ checkLValue()

bool clang::interp::EvaluationResult::checkLValue ( InterpState & S,
const Pointer & Ptr,
SourceInfo Info,
ConstantExprKind ConstexprKind ) const

Check the given pointer as an lvalue, i.e.

make sure it's a global lvalue and diagnose if it's not.

Definition at line 553 of file EvaluationResult.cpp.

References clang::interp::checkFunctionPtr(), clang::interp::State::FFDiag(), clang::interp::State::getASTContext(), InterpState, clang::Type::isReferenceType(), isTemplateArgument(), and clang::interp::lval().

◆ checkLValueFields()

bool clang::interp::EvaluationResult::checkLValueFields ( InterpState & S,
const Pointer & Ptr,
SourceInfo Info,
ConstantExprKind ConstexprKind ) const

Check all fields of the given pointer.

Toplevel accessor to check all lvalue fields.

Definition at line 540 of file EvaluationResult.cpp.

References clang::interp::State::getASTContext(), InterpState, and clang::interp::lvalFields().

◆ checkMemberPointer()

bool clang::interp::EvaluationResult::checkMemberPointer ( InterpState & S,
const MemberPointer & MemberPtr,
SourceInfo Info,
ConstantExprKind ConstexprKind )
static

◆ dump()

LLVM_DUMP_METHOD void EvaluationResult::dump ( ) const

Dump to stderr.

Definition at line 637 of file Disasm.cpp.

References empty(), and isInvalid().

◆ empty()

bool clang::interp::EvaluationResult::empty ( ) const
inline

Definition at line 70 of file EvaluationResult.h.

References Empty.

Referenced by checkFullyInitialized(), and dump().

◆ getSourceType()

QualType clang::interp::EvaluationResult::getSourceType ( ) const
inline

Definition at line 98 of file EvaluationResult.h.

◆ isInvalid()

bool clang::interp::EvaluationResult::isInvalid ( ) const
inline

Definition at line 71 of file EvaluationResult.h.

References Invalid.

◆ stealAPValue()

APValue clang::interp::EvaluationResult::stealAPValue ( )
inline

Definition at line 73 of file EvaluationResult.h.

◆ EvalEmitter

friend class EvalEmitter
friend

Definition at line 109 of file EvaluationResult.h.

References EvalEmitter.

Referenced by EvalEmitter.

◆ InterpState


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