clang: lib/AST/ByteCode/Context.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16#ifndef LLVM_CLANG_AST_INTERP_CONTEXT_H

17#define LLVM_CLANG_AST_INTERP_CONTEXT_H

18

20

22class ASTContext;

23class LangOptions;

24class FunctionDecl;

25class VarDecl;

27

28namespace interp {

30class Program;

31class State;

33

37};

38

39

41public:

42

44

45

47

48

50

51

53

54

57

58

60

61

63

65

67

69

71

73

74

76

77

79 assert(E);

80 if (E->isGLValue()) {

81 if (E->getType()->isFunctionType())

84 }

85

87 }

88

93

95

96

97

99 if (const auto *V = dyn_cast(VD))

100 return V->hasGlobalStorage() || V->isConstexpr();

101

102 return false;

103 }

104

105

107

109 const RecordDecl *DerivedDecl) const;

110

112

113 unsigned getEvalID() const { return EvalID; }

114

115private:

116

118

119

121

123

124 std::unique_ptr P;

125

126 unsigned EvalID = 0;

127};

128

129}

130}

131

132#endif

enum clang::sema::@1725::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 ...

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.

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

bool evaluate(State &Parent, const Expr *E, APValue &Result, ConstantExprKind Kind)

Like evaluateAsRvalue(), but does no implicit lvalue-to-rvalue conversion.

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