32 if (!Func || !Func->
hasBody()) {
37 Parent.FFDiag(Err.getRange().getBegin(),
38 diag::err_experimental_clang_interp_failed)
46 if (!Run(
Parent, Func, DummyResult)) {
56 if (Check(
Parent,
C.interpretExpr(E))) {
69 if (Check(
Parent,
C.interpretDecl(VD))) {
124 if (
auto *AT = dyn_cast<AtomicType>(T))
125 return classify(AT->getValueType());
147 Parent.FFDiag(Err.getRange().getBegin(),
148 diag::err_experimental_clang_interp_failed)
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
const LangOptions & getLangOpts() const
const TargetInfo & getTargetInfo() const
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.
unsigned getCharWidth() const
bool isBooleanType() const
bool isSignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is signed or an enumeration types whose underlying ty...
bool isUnsignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is unsigned or an enumeration types whose underlying ...
bool isPointerType() const
bool isReferenceType() const
bool isFloatingType() const
bool isNullPtrType() const
Represents a variable declaration or definition.
Compilation context for expressions.
Compilation context for statements.
const LangOptions & getLangOpts() const
Returns the language options.
~Context()
Cleans up the constexpr VM.
Context(ASTContext &Ctx)
Initialises the constexpr VM.
unsigned getCharBit() const
Returns CHAR_BIT.
bool evaluateAsInitializer(State &Parent, const VarDecl *VD, APValue &Result)
Evaluates a toplevel initializer.
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.
std::optional< PrimType > classify(QualType T) const
Classifies an expression.
bool isConstexpr() const
Checks if the function is valid to call in constexpr.
Frame storing local variables.
void clear()
Clears the stack without calling any destructors.
The program contains and links the bytecode for all functions.
Interface for the VM to interact with the AST walker's context.
Defines the clang::TargetInfo interface.
bool Interpret(InterpState &S, APValue &Result)
Interpreter entry point.
@ C
Languages that the frontend can parse and compile.
@ Result
The result type of a method or function.
Error thrown by the compiler.