clang 22.0.0git
|
Defines the result of an evaluation. More...
Public Types | |
enum | ResultKind { Empty , Invalid , Valid } |
using | DeclTy = llvm::PointerUnion<const Decl *, const Expr *> |
Public Member Functions | |
EvaluationResult (const Context *Ctx) | |
bool | empty () const |
bool | isInvalid () const |
APValue | toAPValue () const |
Returns an APValue for the evaluation result. | |
APValue | stealAPValue () |
bool | checkFullyInitialized (InterpState &S, const Pointer &Ptr) const |
Check that all subobjects of the given pointer have been initialized. | |
bool | checkReturnValue (InterpState &S, const Context &Ctx, const Pointer &Ptr, const SourceInfo &Info) |
Check that none of the blocks the given pointer (transitively) points to are dynamically allocated. | |
QualType | getSourceType () const |
void | dump () const |
Dump to stderr. |
Friends | |
class | EvalEmitter |
class | InterpState |
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 31 of file EvaluationResult.h.
using clang::interp::EvaluationResult::DeclTy = llvm::PointerUnion<const Decl *, const Expr *> |
Definition at line 39 of file EvaluationResult.h.
Enumerator | |
---|---|
Empty | |
Invalid | |
Valid |
Definition at line 33 of file EvaluationResult.h.
|
inline |
Definition at line 67 of file EvaluationResult.h.
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 129 of file EvaluationResult.cpp.
References clang::cast(), clang::interp::CheckArrayInitialized(), clang::interp::CheckFieldsInitialized(), empty(), clang::Type::getAsArrayTypeUnsafe(), clang::interp::Pointer::getRecord(), clang::interp::Pointer::getType(), InterpState, clang::interp::Pointer::isLive(), and clang::interp::Pointer::isZero().
bool clang::interp::EvaluationResult::checkReturnValue | ( | InterpState & | S, |
const Context & | Ctx, | ||
const Pointer & | Ptr, | ||
const SourceInfo & | Info ) |
Check that none of the blocks the given pointer (transitively) points to are dynamically allocated.
Definition at line 199 of file EvaluationResult.cpp.
References clang::interp::collectBlocks(), clang::interp::State::FFDiag(), clang::interp::Pointer::getType(), InterpState, clang::interp::Pointer::isArrayElement(), clang::Type::isReferenceType(), clang::interp::Pointer::isRoot(), and clang::interp::State::Note().
LLVM_DUMP_METHOD void EvaluationResult::dump | ( | ) | const |
|
inline |
Definition at line 72 of file EvaluationResult.h.
References Empty.
Referenced by checkFullyInitialized(), dump(), and toAPValue().
|
inline |
Definition at line 91 of file EvaluationResult.h.
|
inline |
|
inline |
Definition at line 82 of file EvaluationResult.h.
|
inline |
Returns an APValue for the evaluation result.
Definition at line 76 of file EvaluationResult.h.
References empty(), and isInvalid().
|
friend |
Definition at line 103 of file EvaluationResult.h.
References EvalEmitter.
Referenced by EvalEmitter.
|
friend |
Definition at line 104 of file EvaluationResult.h.
References InterpState.
Referenced by checkFullyInitialized(), checkReturnValue(), and InterpState.