16#ifndef LLVM_CLANG_AST_INTERP_CONTEXT_H
17#define LLVM_CLANG_AST_INTERP_CONTEXT_H
106 const Expr *E,
unsigned Kind,
139 T =
T.getCanonicalType();
140 if (
const auto *BT = dyn_cast<BuiltinType>(
T)) {
141 if (BT->isInteger() || BT->isFloatingPoint())
143 if (BT->getKind() == BuiltinType::NullPtr ||
144 BT->getKind() == BuiltinType::BoundMember)
147 if (
T->isPointerOrReferenceType())
150 if (
T->isArrayType() ||
T->isRecordType() ||
T->isAnyComplexType() ||
154 if (
T->isEnumeralType())
176 if (
const auto *
V = dyn_cast<VarDecl>(VD))
177 return V->hasGlobalStorage() ||
V->isConstexpr();
204 template <
typename ResultT>
215 std::unique_ptr<Program> P;
222 unsigned LongLongWidth;
234 const unsigned OldID;
Defines the clang::ASTContext interface.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Represents a static or instance method of a struct/union/class.
Represents a C++ struct/union/class.
This represents one expression.
Represents a function declaration or definition.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
A (possibly-)qualified type.
Represents a struct/union/class.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a variable declaration or definition.
Holds all information required to evaluate constexpr code in a module.
std::optional< uint64_t > tryEvaluateObjectSize(const EvalSettings &Settings, const Expr *E, unsigned Kind, bool IsDynamic)
If.
const LangOptions & getLangOpts() const
Returns the language options.
void registerRedecl(const VarDecl *VD, const APValue &V)
OptPrimType classify(const Expr *E) const
Classifies an expression.
const Function * getOrCreateObjCBlock(const BlockExpr *E)
bool evaluateString(const EvalSettings &Settings, const Expr *E, std::string &Result)
Evaluate.
~Context()
Cleans up the constexpr VM.
bool evaluateDestruction(const EvalSettings &Settings, const VarDecl *VD, APValue Value)
Evaluates the destruction of a variable.
Context(ASTContext &Ctx)
Initialises the constexpr VM.
bool isPotentialConstantExpr(const EvalSettings &Settings, const FunctionDecl *FD)
Checks if a function is a potential constant expression.
static bool isUnevaluatedBuiltin(unsigned ID)
Unevaluated builtins don't get their arguments put on the stack automatically.
unsigned getCharBit() const
Returns CHAR_BIT.
bool canClassify(const Expr *E) const
std::optional< bool > evaluateWithSubstitution(const EvalSettings &Settings, const FunctionDecl *Callee, ArrayRef< const Expr * > Args, const Expr *This, const Expr *Condition)
Program & getProgram() const
Returns the program. This is only needed for unittests.
bool evaluate(const EvalSettings &Settings, const Expr *E, APValue &Result)
Like evaluateAsRvalue(), but does no implicit lvalue-to-rvalue conversion.
const llvm::fltSemantics & getFloatSemantics(QualType T) const
Return the floating-point semantics for T.
static bool shouldBeGloballyIndexed(const ValueDecl *VD)
Returns whether we should create a global variable for the given ValueDecl.
bool evaluateAsInitializer(const EvalSettings &Settings, const VarDecl *VD, const Expr *Init, APValue &Result)
Evaluates a toplevel initializer.
unsigned collectBaseOffset(const RecordDecl *BaseDecl, const RecordDecl *DerivedDecl) const
const Record * getRecord(const RecordDecl *D) const
bool evaluateAsRValue(const EvalSettings &Settings, const Expr *E, APValue &Result)
Evaluates a toplevel expression as an rvalue.
const Function * getOrCreateFunction(const FunctionDecl *FuncDecl)
ASTContext & getASTContext() const
Returns the AST context.
uint32_t getBitWidth(QualType T) const
Return the size of T in bits.
OptPrimType classify(QualType T) const
Classifies a type.
bool evaluateCharRange(const EvalSettings &Settings, const Expr *SizeExpr, const Expr *PtrExpr, APValue &Result)
std::optional< uint64_t > evaluateStrlen(const EvalSettings &Settings, const Expr *E)
Evalute.
bool canClassify(QualType T) const
const CXXMethodDecl * getOverridingFunction(const CXXRecordDecl *DynamicDecl, const CXXRecordDecl *StaticDecl, const CXXMethodDecl *InitialFunction) const
unsigned getEvalID() const
void isPotentialConstantExprUnevaluated(const EvalSettings &Settings, const Expr *E, const FunctionDecl *FD)
EvalIDScope & operator=(const EvalIDScope &)=delete
EvalIDScope(const EvalIDScope &)=delete
EvalIDScope(Context &Ctx)
Allocator for function frames.
Stack frame storing temporaries and parameters.
The program contains and links the bytecode for all functions.
Structure/Class descriptor.
Interface for the VM to interact with the AST walker's context.
bool This(InterpState &S, CodePtr OpPC)
PrimType
Enumeration of the primitive types of the VM.
bool Init(InterpState &S, CodePtr OpPC)
Top level wrappers for InstallAPI frontend operations.
@ Result
The result type of a method or function.
const FunctionProtoType * T
__builtin_bitreverse32 uint32_t __builtin_riscv_aaddu_u32 __builtin_riscv_asubu_u32 __builtin_elementwise_add_sat __builtin_elementwise_sub_sat int32_t uint32_t uint32_t __builtin_riscv_mhacc_i32 __builtin_riscv_mhaccu_u32 __builtin_riscv_mhaccsu_i32 __builtin_riscv_mulq_i32 uint8_t