16#ifndef LLVM_CLANG_AST_INTERP_CONTEXT_H
17#define LLVM_CLANG_AST_INTERP_CONTEXT_H
97 if (
const auto *BT = dyn_cast<BuiltinType>(
T)) {
98 if (BT->isInteger() || BT->isFloatingPoint())
100 if (BT->getKind() == BuiltinType::Bool)
126 if (
const auto *
V = dyn_cast<VarDecl>(VD))
127 return V->hasGlobalStorage() ||
V->isConstexpr();
153 template <
typename ResultT>
162 std::unique_ptr<Program> P;
169 unsigned LongLongWidth;
Defines the clang::ASTContext interface.
enum clang::sema::@1840::IndirectLocalPathEntry::EntryKind Kind
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.
bool isAnyComplexType() const
bool isVectorType() const
bool isRecordType() const
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.
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.
bool evaluateCharRange(State &Parent, const Expr *SizeExpr, const Expr *PtrExpr, APValue &Result)
bool canClassify(QualType T)
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 evaluateAsInitializer(State &Parent, const VarDecl *VD, APValue &Result)
Evaluates a toplevel initializer.
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.
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.
The JSON file list parser is used to communicate input to InstallAPI.
@ Result
The result type of a method or function.
const FunctionProtoType * T