clang 19.0.0git
Public Types | Public Member Functions | Friends | List of all members
clang::interp::EvaluationResult Class Referencefinal

Defines the result of an evaluation. More...

#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/AST/Interp/EvaluationResult.h"

Public Types

enum  ResultKind {
  Empty , LValue , RValue , Invalid ,
using DeclTy = llvm::PointerUnion< const Decl *, const Expr * >

Public Member Functions

 EvaluationResult (const Context *Ctx)
bool empty () const
bool isInvalid () const
bool isLValue () const
bool isRValue () const
APValue toAPValue () const
 Returns an APValue for the evaluation result.
std::optional< APValuetoRValue () const
 If the result is an LValue, convert that to an RValue and return it.
bool checkFullyInitialized (InterpState &S, const Pointer &Ptr) const
void dump () const
 Dump to stderr.


class EvalEmitter

Detailed Description

Defines the result of an evaluation.

The result might be in different forms–one of the pointer types, an APValue, or nothing.

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

Definition at line 32 of file EvaluationResult.h.

Member Typedef Documentation

◆ DeclTy

using clang::interp::EvaluationResult::DeclTy = llvm::PointerUnion<const Decl *, const Expr *>

Definition at line 42 of file EvaluationResult.h.

Member Enumeration Documentation

◆ ResultKind


Definition at line 34 of file EvaluationResult.h.

Constructor & Destructor Documentation

◆ EvaluationResult()

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

Definition at line 85 of file EvaluationResult.h.

Member Function Documentation

◆ checkFullyInitialized()

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

◆ dump()

void clang::interp::EvaluationResult::dump ( ) const

Dump to stderr.

Definition at line 162 of file EvaluationResult.cpp.

References Empty, clang::interp::Context::getASTContext(), Invalid, LValue, P, RValue, and Valid.

◆ empty()

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

Definition at line 87 of file EvaluationResult.h.

References Empty.

Referenced by checkFullyInitialized(), clang::interp::EvalEmitter::interpretDecl(), and toAPValue().

◆ isInvalid()

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

Definition at line 88 of file EvaluationResult.h.

References Invalid.

◆ isLValue()

bool clang::interp::EvaluationResult::isLValue ( ) const

Definition at line 89 of file EvaluationResult.h.

References LValue.

◆ isRValue()

bool clang::interp::EvaluationResult::isRValue ( ) const

Definition at line 90 of file EvaluationResult.h.

References RValue.

◆ toAPValue()

APValue clang::interp::EvaluationResult::toAPValue ( ) const

Returns an APValue for the evaluation result.

The returned APValue might be an LValue or RValue.

Definition at line 18 of file EvaluationResult.cpp.

References empty(), LValue, P, RValue, and Valid.

Referenced by toRValue().

◆ toRValue()

std::optional< APValue > clang::interp::EvaluationResult::toRValue ( ) const

If the result is an LValue, convert that to an RValue and return it.

This may fail, e.g. if the result is an LValue and we can't read from it.

Definition at line 39 of file EvaluationResult.cpp.

References LValue, P, RValue, and toAPValue().

Friends And Related Function Documentation

◆ EvalEmitter

friend class EvalEmitter

Definition at line 106 of file EvaluationResult.h.

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