16#ifndef LLVM_CLANG_AST_INTERP_CONTEXT_H
17#define LLVM_CLANG_AST_INTERP_CONTEXT_H
102 if (
const auto *BT = dyn_cast<BuiltinType>(
T)) {
103 if (BT->isInteger() || BT->isFloatingPoint())
105 if (BT->getKind() == BuiltinType::Bool)
109 if (
T->isArrayType() ||
T->isRecordType() ||
T->isAnyComplexType() ||
131 if (
const auto *
V = dyn_cast<VarDecl>(VD))
132 return V->hasGlobalStorage() ||
V->isConstexpr();
158 template <
typename ResultT>
159 bool evaluateStringRepr(
State &Parent,
const Expr *SizeExpr,
167 std::unique_ptr<Program> P;
174 unsigned LongLongWidth;
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.
const LangOptions & getLangOpts() const
Returns the language options.
OptPrimType classify(const Expr *E) const
Classifies an expression.
const Function * getOrCreateObjCBlock(const BlockExpr *E)
~Context()
Cleans up the constexpr VM.
Context(ASTContext &Ctx)
Initialises the constexpr VM.
bool evaluateCharRange(State &Parent, const Expr *SizeExpr, const Expr *PtrExpr, APValue &Result)
bool canClassify(QualType T)
bool evaluateString(State &Parent, const Expr *E, std::string &Result)
Evaluate.
static bool isUnevaluatedBuiltin(unsigned ID)
Unevaluated builtins don't get their arguments put on the stack automatically.
unsigned getCharBit() const
Returns CHAR_BIT.
Program & getProgram() const
Returns the program. This is only needed for unittests.
bool evaluateStrlen(State &Parent, const Expr *E, uint64_t &Result)
Evalute.
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.
void isPotentialConstantExprUnevaluated(State &Parent, const Expr *E, const FunctionDecl *FD)
unsigned collectBaseOffset(const RecordDecl *BaseDecl, const RecordDecl *DerivedDecl) const
bool canClassify(const Expr *E)
const Record * getRecord(const RecordDecl *D) const
bool isPotentialConstantExpr(State &Parent, const FunctionDecl *FD)
Checks if a function is a potential constant expression.
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 evaluateAsRValue(State &Parent, const Expr *E, APValue &Result)
Evaluates a toplevel expression as an rvalue.
const CXXMethodDecl * getOverridingFunction(const CXXRecordDecl *DynamicDecl, const CXXRecordDecl *StaticDecl, const CXXMethodDecl *InitialFunction) const
bool evaluate(State &Parent, const Expr *E, APValue &Result, ConstantExprKind Kind)
Like evaluateAsRvalue(), but does no implicit lvalue-to-rvalue conversion.
bool evaluateAsInitializer(State &Parent, const VarDecl *VD, const Expr *Init, APValue &Result)
Evaluates a toplevel initializer.
unsigned getEvalID() const
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.
PrimType
Enumeration of the primitive types of the VM.
bool Init(InterpState &S, CodePtr OpPC)
The JSON file list parser is used to communicate input to InstallAPI.
Expr::ConstantExprKind ConstantExprKind
@ Result
The result type of a method or function.
const FunctionProtoType * T