16#ifndef LLVM_CLANG_AST_INTERP_CONTEXT_H
17#define LLVM_CLANG_AST_INTERP_CONTEXT_H
83 if (
const auto *
V = dyn_cast<VarDecl>(VD))
84 return V->hasGlobalStorage() ||
V->isConstexpr();
104 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.
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.
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.
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 an expression.
const Function * getOrCreateFunction(const FunctionDecl *FD)
Stack frame storing temporaries and parameters.
The program contains and links the bytecode for all functions.
Interface for the VM to interact with the AST walker's context.
PrimType
Enumeration of the primitive types of the VM.
@ Result
The result type of a method or function.