16#ifndef LLVM_CLANG_AST_INTERP_CONTEXT_H
17#define LLVM_CLANG_AST_INTERP_CONTEXT_H
80 if (
E->getType()->isFunctionType())
98 if (
const auto *
V = dyn_cast<VarDecl>(VD))
99 return V->hasGlobalStorage() ||
V->isConstexpr();
123 std::unique_ptr<Program> P;
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 ...
unsigned getIntWidth(QualType T) const
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.
const LangOptions & getLangOpts() const
Returns the language options.
~Context()
Cleans up the constexpr VM.
bool evaluate(State &Parent, const Expr *E, APValue &Result)
Like evaluateAsRvalue(), but does no implicit lvalue-to-rvalue conversion.
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.
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.
unsigned collectBaseOffset(const RecordDecl *BaseDecl, const RecordDecl *DerivedDecl) const
const Record * getRecord(const RecordDecl *D) const
std::optional< PrimType > classify(const Expr *E) const
Classifies an expression.
ASTContext & getASTContext() const
Returns the AST context.
uint32_t getBitWidth(QualType T) const
Return the size of T in bits.
bool isPotentialConstantExpr(State &Parent, const FunctionDecl *FnDecl)
Checks if a function is a potential constant expression.
bool evaluateAsRValue(State &Parent, const Expr *E, APValue &Result)
Evaluates a toplevel expression as an rvalue.
InterpStack & getStack()
Returns the interpreter stack.
const CXXMethodDecl * getOverridingFunction(const CXXRecordDecl *DynamicDecl, const CXXRecordDecl *StaticDecl, const CXXMethodDecl *InitialFunction) const
std::optional< PrimType > classify(QualType T) const
Classifies a type.
const Function * getOrCreateFunction(const FunctionDecl *FD)
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