clang
10.0.0git
|
Holds all information required to evaluate constexpr code in a module. More...
#include "/work/www-prereleases/10.0.0/rc2/docsbuild/clang/lib/AST/Interp/Context.h"
Public Member Functions | |
Context (ASTContext &Ctx) | |
Initialises the constexpr VM. More... | |
~Context () | |
Cleans up the constexpr VM. More... | |
bool | isPotentialConstantExpr (State &Parent, const FunctionDecl *FnDecl) |
Checks if a function is a potential constant expression. More... | |
bool | evaluateAsRValue (State &Parent, const Expr *E, APValue &Result) |
Evaluates a toplevel expression as an rvalue. More... | |
bool | evaluateAsInitializer (State &Parent, const VarDecl *VD, APValue &Result) |
Evaluates a toplevel initializer. More... | |
ASTContext & | getASTContext () const |
Returns the AST context. More... | |
const LangOptions & | getLangOpts () const |
Returns the language options. More... | |
InterpStack & | getStack () |
Returns the interpreter stack. More... | |
unsigned | getCharBit () const |
Returns CHAR_BIT. More... | |
llvm::Optional< PrimType > | classify (QualType T) |
Classifies an expression. More... | |
Holds all information required to evaluate constexpr code in a module.
Context::Context | ( | ASTContext & | Ctx | ) |
Initialises the constexpr VM.
Definition at line 24 of file Context.cpp.
Context::~Context | ( | ) |
Cleans up the constexpr VM.
Definition at line 26 of file Context.cpp.
llvm::Optional< PrimType > Context::classify | ( | QualType | T | ) |
Classifies an expression.
Definition at line 61 of file Context.cpp.
References clang::ASTContext::getIntWidth(), clang::Type::isBooleanType(), clang::Type::isNullPtrType(), clang::Type::isPointerType(), clang::Type::isReferenceType(), clang::Type::isSignedIntegerOrEnumerationType(), clang::Type::isUnsignedIntegerOrEnumerationType(), clang::interp::PT_Bool, clang::interp::PT_Ptr, clang::interp::PT_Sint16, clang::interp::PT_Sint32, clang::interp::PT_Sint64, clang::interp::PT_Sint8, clang::interp::PT_Uint16, clang::interp::PT_Uint32, clang::interp::PT_Uint64, and clang::interp::PT_Uint8.
Referenced by clang::interp::ByteCodeExprGen< Emitter >::classify(), clang::interp::ByteCodeEmitter::compileFunc(), clang::interp::Program::createDescriptor(), clang::interp::Program::createGlobal(), clang::interp::InterpFrame::describe(), clang::interp::EvalEmitter::fallthrough(), clang::interp::Program::getOrCreateRecord(), and getStack().
Evaluates a toplevel initializer.
Definition at line 53 of file Context.cpp.
Evaluates a toplevel expression as an rvalue.
Definition at line 48 of file Context.cpp.
|
inline |
Returns the AST context.
Definition at line 56 of file Context.h.
References getLangOpts().
Referenced by clang::interp::EvalEmitter::fallthrough(), clang::interp::ByteCodeExprGen< Emitter >::getCharBit(), clang::interp::ByteCodeExprGen< Emitter >::getIntWidth(), and clang::interp::Program::getOrCreateDummy().
unsigned Context::getCharBit | ( | ) | const |
Returns CHAR_BIT.
Definition at line 108 of file Context.cpp.
References clang::TargetInfo::getCharWidth(), clang::ASTContext::getTargetInfo(), and Parent.
Referenced by getStack().
const LangOptions & Context::getLangOpts | ( | ) | const |
Returns the language options.
Definition at line 59 of file Context.cpp.
References clang::ASTContext::getLangOpts().
Referenced by getASTContext().
|
inline |
Returns the interpreter stack.
Definition at line 60 of file Context.h.
References classify(), and getCharBit().
bool Context::isPotentialConstantExpr | ( | State & | Parent, |
const FunctionDecl * | FnDecl | ||
) |
Checks if a function is a potential constant expression.
Definition at line 28 of file Context.cpp.
References clang::interp::State::FFDiag(), clang::interp::Function::isConstexpr(), P, and Parent.