class Context

Declaration

class Context { /* full declaration omitted */ };

Description

Holds all information required to evaluate constexpr code in a module.

Declared at: clang/lib/AST/Interp/Context.h:36

Member Variables

private clang::ASTContext& Ctx
Current compilation context.
private clang::interp::InterpStack Stk
Interpreter stack, shared across invocations.
private std::unique_ptr<Program> P
Constexpr program.

Method Overview

  • private bool Check(clang::interp::State & Parent, llvm::Expected<bool> && R)
  • public Context(clang::ASTContext & Ctx)
  • private bool Run(clang::interp::State & Parent, clang::interp::Function * Func, clang::APValue & Result)
  • public llvm::Optional<PrimType> classify(clang::QualType T)
  • public bool evaluateAsInitializer(clang::interp::State & Parent, const clang::VarDecl * VD, clang::APValue & Result)
  • public bool evaluateAsRValue(clang::interp::State & Parent, const clang::Expr * E, clang::APValue & Result)
  • public clang::ASTContext & getASTContext() const
  • public unsigned int getCharBit() const
  • public const clang::LangOptions & getLangOpts() const
  • public clang::interp::InterpStack & getStack()
  • public bool isPotentialConstantExpr(clang::interp::State & Parent, const clang::FunctionDecl * FnDecl)
  • public ~Context()

Methods

bool Check(clang::interp::State& Parent,
           llvm::Expected<bool>&& R)

Description

Checks a result from the interpreter.

Declared at: clang/lib/AST/Interp/Context.h:70

Parameters

clang::interp::State& Parent
llvm::Expected<bool>&& R

Context(clang::ASTContext& Ctx)

Description

Initialises the constexpr VM.

Declared at: clang/lib/AST/Interp/Context.h:39

Parameters

clang::ASTContext& Ctx

bool Run(clang::interp::State& Parent,
         clang::interp::Function* Func,
         clang::APValue& Result)

Description

Runs a function.

Declared at: clang/lib/AST/Interp/Context.h:67

Parameters

clang::interp::State& Parent
clang::interp::Function* Func
clang::APValue& Result

llvm::Optional<PrimType> classify(
    clang::QualType T)

Description

Classifies an expression.

Declared at: clang/lib/AST/Interp/Context.h:63

Parameters

clang::QualType T

bool evaluateAsInitializer(
    clang::interp::State& Parent,
    const clang::VarDecl* VD,
    clang::APValue& Result)

Description

Evaluates a toplevel initializer.

Declared at: clang/lib/AST/Interp/Context.h:51

Parameters

clang::interp::State& Parent
const clang::VarDecl* VD
clang::APValue& Result

bool evaluateAsRValue(
    clang::interp::State& Parent,
    const clang::Expr* E,
    clang::APValue& Result)

Description

Evaluates a toplevel expression as an rvalue.

Declared at: clang/lib/AST/Interp/Context.h:48

Parameters

clang::interp::State& Parent
const clang::Expr* E
clang::APValue& Result

clang::ASTContext& getASTContext() const

Description

Returns the AST context.

Declared at: clang/lib/AST/Interp/Context.h:54

unsigned int getCharBit() const

Description

Returns CHAR_BIT.

Declared at: clang/lib/AST/Interp/Context.h:60

const clang::LangOptions& getLangOpts() const

Description

Returns the language options.

Declared at: clang/lib/AST/Interp/Context.h:56

clang::interp::InterpStack& getStack()

Description

Returns the interpreter stack.

Declared at: clang/lib/AST/Interp/Context.h:58

bool isPotentialConstantExpr(
    clang::interp::State& Parent,
    const clang::FunctionDecl* FnDecl)

Description

Checks if a function is a potential constant expression.

Declared at: clang/lib/AST/Interp/Context.h:45

Parameters

clang::interp::State& Parent
const clang::FunctionDecl* FnDecl

~Context()

Description

Cleans up the constexpr VM.

Declared at: clang/lib/AST/Interp/Context.h:42