clang 20.0.0git
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
clang::interp::Compiler< Emitter > Class Template Reference

Compilation context for expressions. More...

#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/AST/ByteCode/Compiler.h"

Inheritance diagram for clang::interp::Compiler< Emitter >:
Inheritance graph
[legend]

Public Member Functions

template<typename... Tys>
 Compiler (Context &Ctx, Program &P, Tys &&...Args)
 Initializes the compiler and the backend emitter.
 
bool VisitCastExpr (const CastExpr *E)
 
bool VisitIntegerLiteral (const IntegerLiteral *E)
 
bool VisitFloatingLiteral (const FloatingLiteral *E)
 
bool VisitImaginaryLiteral (const ImaginaryLiteral *E)
 
bool VisitParenExpr (const ParenExpr *E)
 
bool VisitBinaryOperator (const BinaryOperator *E)
 
bool VisitLogicalBinOp (const BinaryOperator *E)
 
bool VisitPointerArithBinOp (const BinaryOperator *E)
 Perform addition/subtraction of a pointer and an integer or subtraction of two pointers.
 
bool VisitComplexBinOp (const BinaryOperator *E)
 
bool VisitCXXDefaultArgExpr (const CXXDefaultArgExpr *E)
 
bool VisitCallExpr (const CallExpr *E)
 
bool VisitBuiltinCallExpr (const CallExpr *E)
 
bool VisitCXXDefaultInitExpr (const CXXDefaultInitExpr *E)
 
bool VisitCXXBoolLiteralExpr (const CXXBoolLiteralExpr *E)
 
bool VisitCXXNullPtrLiteralExpr (const CXXNullPtrLiteralExpr *E)
 
bool VisitGNUNullExpr (const GNUNullExpr *E)
 
bool VisitCXXThisExpr (const CXXThisExpr *E)
 
bool VisitUnaryOperator (const UnaryOperator *E)
 
bool VisitComplexUnaryOperator (const UnaryOperator *E)
 
bool VisitDeclRefExpr (const DeclRefExpr *E)
 
bool VisitImplicitValueInitExpr (const ImplicitValueInitExpr *E)
 
bool VisitSubstNonTypeTemplateParmExpr (const SubstNonTypeTemplateParmExpr *E)
 
bool VisitArraySubscriptExpr (const ArraySubscriptExpr *E)
 
bool VisitInitListExpr (const InitListExpr *E)
 
bool VisitCXXParenListInitExpr (const CXXParenListInitExpr *E)
 
bool VisitConstantExpr (const ConstantExpr *E)
 
bool VisitUnaryExprOrTypeTraitExpr (const UnaryExprOrTypeTraitExpr *E)
 
bool VisitMemberExpr (const MemberExpr *E)
 
bool VisitArrayInitIndexExpr (const ArrayInitIndexExpr *E)
 
bool VisitArrayInitLoopExpr (const ArrayInitLoopExpr *E)
 
bool VisitOpaqueValueExpr (const OpaqueValueExpr *E)
 
bool VisitAbstractConditionalOperator (const AbstractConditionalOperator *E)
 
bool VisitStringLiteral (const StringLiteral *E)
 
bool VisitObjCStringLiteral (const ObjCStringLiteral *E)
 
bool VisitObjCEncodeExpr (const ObjCEncodeExpr *E)
 
bool VisitSYCLUniqueStableNameExpr (const SYCLUniqueStableNameExpr *E)
 
bool VisitCharacterLiteral (const CharacterLiteral *E)
 
bool VisitCompoundAssignOperator (const CompoundAssignOperator *E)
 
bool VisitFloatCompoundAssignOperator (const CompoundAssignOperator *E)
 
bool VisitPointerCompoundAssignOperator (const CompoundAssignOperator *E)
 
bool VisitExprWithCleanups (const ExprWithCleanups *E)
 
bool VisitMaterializeTemporaryExpr (const MaterializeTemporaryExpr *E)
 
bool VisitCXXBindTemporaryExpr (const CXXBindTemporaryExpr *E)
 
bool VisitCompoundLiteralExpr (const CompoundLiteralExpr *E)
 
bool VisitTypeTraitExpr (const TypeTraitExpr *E)
 
bool VisitArrayTypeTraitExpr (const ArrayTypeTraitExpr *E)
 
bool VisitLambdaExpr (const LambdaExpr *E)
 
bool VisitPredefinedExpr (const PredefinedExpr *E)
 
bool VisitCXXThrowExpr (const CXXThrowExpr *E)
 
bool VisitCXXReinterpretCastExpr (const CXXReinterpretCastExpr *E)
 
bool VisitCXXNoexceptExpr (const CXXNoexceptExpr *E)
 
bool VisitCXXConstructExpr (const CXXConstructExpr *E)
 
bool VisitSourceLocExpr (const SourceLocExpr *E)
 
bool VisitOffsetOfExpr (const OffsetOfExpr *E)
 
bool VisitCXXScalarValueInitExpr (const CXXScalarValueInitExpr *E)
 
bool VisitSizeOfPackExpr (const SizeOfPackExpr *E)
 
bool VisitGenericSelectionExpr (const GenericSelectionExpr *E)
 
bool VisitChooseExpr (const ChooseExpr *E)
 
bool VisitEmbedExpr (const EmbedExpr *E)
 
bool VisitObjCBoolLiteralExpr (const ObjCBoolLiteralExpr *E)
 
bool VisitCXXInheritedCtorInitExpr (const CXXInheritedCtorInitExpr *E)
 
bool VisitExpressionTraitExpr (const ExpressionTraitExpr *E)
 
bool VisitCXXUuidofExpr (const CXXUuidofExpr *E)
 
bool VisitRequiresExpr (const RequiresExpr *E)
 
bool VisitConceptSpecializationExpr (const ConceptSpecializationExpr *E)
 
bool VisitCXXRewrittenBinaryOperator (const CXXRewrittenBinaryOperator *E)
 
bool VisitPseudoObjectExpr (const PseudoObjectExpr *E)
 
bool VisitPackIndexingExpr (const PackIndexingExpr *E)
 
bool VisitRecoveryExpr (const RecoveryExpr *E)
 
bool VisitAddrLabelExpr (const AddrLabelExpr *E)
 
bool VisitConvertVectorExpr (const ConvertVectorExpr *E)
 
bool VisitShuffleVectorExpr (const ShuffleVectorExpr *E)
 
bool VisitExtVectorElementExpr (const ExtVectorElementExpr *E)
 
bool VisitObjCBoxedExpr (const ObjCBoxedExpr *E)
 
bool VisitCXXStdInitializerListExpr (const CXXStdInitializerListExpr *E)
 
bool VisitStmtExpr (const StmtExpr *E)
 
bool VisitCXXNewExpr (const CXXNewExpr *E)
 
bool VisitCXXDeleteExpr (const CXXDeleteExpr *E)
 
bool VisitBlockExpr (const BlockExpr *E)
 
bool visitCompoundStmt (const CompoundStmt *S)
 
bool visitDeclStmt (const DeclStmt *DS)
 
bool visitReturnStmt (const ReturnStmt *RS)
 
bool visitIfStmt (const IfStmt *IS)
 
bool visitWhileStmt (const WhileStmt *S)
 
bool visitDoStmt (const DoStmt *S)
 
bool visitForStmt (const ForStmt *S)
 
bool visitCXXForRangeStmt (const CXXForRangeStmt *S)
 
bool visitBreakStmt (const BreakStmt *S)
 
bool visitContinueStmt (const ContinueStmt *S)
 
bool visitSwitchStmt (const SwitchStmt *S)
 
bool visitCaseStmt (const CaseStmt *S)
 
bool visitDefaultStmt (const DefaultStmt *S)
 
bool visitAttributedStmt (const AttributedStmt *S)
 
bool visitCXXTryStmt (const CXXTryStmt *S)
 
- Public Member Functions inherited from clang::StmtVisitorBase< Ptr, ImplClass, RetTy, ParamTys >
RetTy Visit (PTR(Stmt) S, ParamTys... P)
 
 BINOP_FALLBACK (PtrMemD) BINOP_FALLBACK(PtrMemI) BINOP_FALLBACK(Mul) BINOP_FALLBACK(Div) BINOP_FALLBACK(Rem) BINOP_FALLBACK(Add) BINOP_FALLBACK(Sub) BINOP_FALLBACK(Shl) BINOP_FALLBACK(LT) BINOP_FALLBACK(GT) BINOP_FALLBACK(LE) BINOP_FALLBACK(GE) BINOP_FALLBACK(EQ) BINOP_FALLBACK(NE) BINOP_FALLBACK(And) BINOP_FALLBACK(Xor) BINOP_FALLBACK(Or) BINOP_FALLBACK(LAnd) BINOP_FALLBACK(LOr) CAO_FALLBACK(MulAssign) CAO_FALLBACK(DivAssign) CAO_FALLBACK(RemAssign) CAO_FALLBACK(AddAssign) CAO_FALLBACK(SubAssign) CAO_FALLBACK(ShlAssign) CAO_FALLBACK(ShrAssign) CAO_FALLBACK(AndAssign) CAO_FALLBACK(OrAssign) UNARYOP_FALLBACK(PostInc) UNARYOP_FALLBACK(PostDec) UNARYOP_FALLBACK(PreInc) UNARYOP_FALLBACK(PreDec) UNARYOP_FALLBACK(AddrOf) UNARYOP_FALLBACK(Deref) UNARYOP_FALLBACK(Plus) UNARYOP_FALLBACK(Minus) UNARYOP_FALLBACK(Not) UNARYOP_FALLBACK(LNot) UNARYOP_FALLBACK(Real) UNARYOP_FALLBACK(Imag) UNARYOP_FALLBACK(Extension) UNARYOP_FALLBACK(Coawait) RetTy VisitStmt(PTR(Stmt) Node
 

Protected Types

using LabelTy = typename Emitter::LabelTy
 
using AddrTy = typename Emitter::AddrTy
 
using OptLabelTy = std::optional< LabelTy >
 
using CaseMap = llvm::DenseMap< const SwitchCase *, LabelTy >
 

Protected Member Functions

bool visitStmt (const Stmt *S)
 
bool visitExpr (const Expr *E) override
 
bool visitFunc (const FunctionDecl *F) override
 
bool visitDeclAndReturn (const VarDecl *VD, bool ConstantContext) override
 Toplevel visitDeclAndReturn().
 
void emitCleanup ()
 Emits scope cleanup instructions.
 
const RecordTypegetRecordTy (QualType Ty)
 Returns a record type from a record or pointer type.
 
RecordgetRecord (QualType Ty)
 Returns a record from a record or pointer type.
 
RecordgetRecord (const RecordDecl *RD)
 
const FunctiongetFunction (const FunctionDecl *FD)
 Returns a function for the given FunctionDecl.
 
std::optional< PrimTypeclassify (const Expr *E) const
 
std::optional< PrimTypeclassify (QualType Ty) const
 
PrimType classifyPrim (QualType Ty) const
 Classifies a known primitive type.
 
PrimType classifyPrim (const Expr *E) const
 Classifies a known primitive expression.
 
bool visit (const Expr *E)
 Evaluates an expression and places the result on the stack.
 
bool visitInitializer (const Expr *E)
 Compiles an initializer.
 
bool discard (const Expr *E)
 Evaluates an expression for side effects and discards the result.
 
bool delegate (const Expr *E)
 Just pass evaluation on to E.
 
VarCreationState visitVarDecl (const VarDecl *VD, bool Toplevel=false)
 Creates and initializes a variable from the given decl.
 
VarCreationState visitDecl (const VarDecl *VD)
 
bool visitAPValue (const APValue &Val, PrimType ValType, const Expr *E)
 Visit an APValue.
 
bool visitAPValueInitializer (const APValue &Val, const Expr *E)
 
bool visitDeclRef (const ValueDecl *D, const Expr *E)
 Visit the given decl as if we have a reference to it.
 
bool visitBool (const Expr *E)
 Visits an expression and converts it to a boolean.
 
bool visitInitList (ArrayRef< const Expr * > Inits, const Expr *ArrayFiller, const Expr *E)
 
bool visitArrayElemInit (unsigned ElemIndex, const Expr *Init)
 Pointer to the array(not the element!) must be on the stack when calling this.
 
unsigned allocateLocalPrimitive (DeclTy &&Decl, PrimType Ty, bool IsConst, bool IsExtended=false)
 Creates a local primitive value.
 
std::optional< unsignedallocateLocal (DeclTy &&Decl, const ValueDecl *ExtendingDecl=nullptr)
 Allocates a space storing a local given its type.
 
unsigned allocateTemporary (const Expr *E)
 

Protected Attributes

ContextCtx
 Current compilation context.
 
ProgramP
 Program to link to.
 
llvm::DenseMap< const ValueDecl *, Scope::LocalLocals
 Variable to storage mapping.
 
llvm::DenseMap< const OpaqueValueExpr *, unsignedOpaqueExprs
 OpaqueValueExpr to location mapping.
 
VariableScope< Emitter > * VarScope = nullptr
 Current scope.
 
std::optional< uint64_t > ArrayIndex
 Current argument index. Needed to emit ArrayInitIndexExpr.
 
const ExprSourceLocDefaultExpr = nullptr
 DefaultInit- or DefaultArgExpr, needed for SourceLocExpr.
 
bool DiscardResult = false
 Flag indicating if return value is to be discarded.
 
bool InStmtExpr = false
 
bool Initializing = false
 Flag inidicating if we're initializing an already created variable.
 
const ValueDeclInitializingDecl = nullptr
 
llvm::SmallVector< InitLinkInitStack
 
bool InitStackActive = false
 
std::optional< PrimTypeReturnType
 Type of the expression returned by the function.
 
CaseMap CaseLabels
 Switch case mapping.
 
OptLabelTy BreakLabel
 Point to break to.
 
OptLabelTy ContinueLabel
 Point to continue to.
 
OptLabelTy DefaultLabel
 Default case label.
 

Friends

class VariableScope< Emitter >
 
class LocalScope< Emitter >
 
class DestructorScope< Emitter >
 
class DeclScope< Emitter >
 
class InitLinkScope< Emitter >
 
class InitStackScope< Emitter >
 
class OptionScope< Emitter >
 
class ArrayIndexScope< Emitter >
 
class SourceLocScope< Emitter >
 
struct InitLink
 
class LoopScope< Emitter >
 
class LabelScope< Emitter >
 
class SwitchScope< Emitter >
 
class StmtExprScope< Emitter >
 

Additional Inherited Members

- Public Attributes inherited from clang::StmtVisitorBase< Ptr, ImplClass, RetTy, ParamTys >
ParamTys P { return RetTy()
 

Detailed Description

template<class Emitter>
class clang::interp::Compiler< Emitter >

Compilation context for expressions.

Definition at line 103 of file Compiler.h.

Member Typedef Documentation

◆ AddrTy

template<class Emitter >
using clang::interp::Compiler< Emitter >::AddrTy = typename Emitter::AddrTy
protected

Definition at line 108 of file Compiler.h.

◆ CaseMap

template<class Emitter >
using clang::interp::Compiler< Emitter >::CaseMap = llvm::DenseMap<const SwitchCase *, LabelTy>
protected

Definition at line 110 of file Compiler.h.

◆ LabelTy

template<class Emitter >
using clang::interp::Compiler< Emitter >::LabelTy = typename Emitter::LabelTy
protected

Definition at line 107 of file Compiler.h.

◆ OptLabelTy

template<class Emitter >
using clang::interp::Compiler< Emitter >::OptLabelTy = std::optional<LabelTy>
protected

Definition at line 109 of file Compiler.h.

Constructor & Destructor Documentation

◆ Compiler()

template<class Emitter >
template<typename... Tys>
clang::interp::Compiler< Emitter >::Compiler ( Context Ctx,
Program P,
Tys &&...  Args 
)
inline

Initializes the compiler and the backend emitter.

Definition at line 120 of file Compiler.h.

Member Function Documentation

◆ allocateLocal()

template<class Emitter >
std::optional< unsigned > Compiler::allocateLocal ( DeclTy &&  Decl,
const ValueDecl ExtendingDecl = nullptr 
)
protected

Allocates a space storing a local given its type.

Definition at line 3523 of file Compiler.cpp.

References D, E, clang::Expr::getType(), clang::QualType::getTypePtr(), clang::Init, clang::interp::Descriptor::InlineDescMD, clang::QualType::isConstQualified(), and P.

◆ allocateLocalPrimitive()

template<class Emitter >
unsigned Compiler::allocateLocalPrimitive ( DeclTy &&  Decl,
PrimType  Ty,
bool  IsConst,
bool  IsExtended = false 
)
protected

Creates a local primitive value.

Definition at line 3498 of file Compiler.cpp.

References D, clang::interp::Descriptor::InlineDescMD, and P.

◆ allocateTemporary()

template<class Emitter >
unsigned Compiler::allocateTemporary ( const Expr E)
protected

◆ classify() [1/2]

template<class Emitter >
std::optional< PrimType > clang::interp::Compiler< Emitter >::classify ( const Expr E) const
inlineprotected

◆ classify() [2/2]

template<class Emitter >
std::optional< PrimType > clang::interp::Compiler< Emitter >::classify ( QualType  Ty) const
inlineprotected

◆ classifyPrim() [1/2]

template<class Emitter >
PrimType clang::interp::Compiler< Emitter >::classifyPrim ( const Expr E) const
inlineprotected

Classifies a known primitive expression.

Definition at line 258 of file Compiler.h.

References clang::interp::Compiler< Emitter >::classify(), E, and clang::T.

◆ classifyPrim() [2/2]

template<class Emitter >
PrimType clang::interp::Compiler< Emitter >::classifyPrim ( QualType  Ty) const
inlineprotected

Classifies a known primitive type.

Definition at line 251 of file Compiler.h.

References clang::interp::Compiler< Emitter >::classify(), and clang::T.

◆ delegate()

template<class Emitter >
bool Compiler::delegate ( const Expr E)
protected

Just pass evaluation on to E.

This leaves all the parsing flags intact.

Definition at line 3240 of file Compiler.cpp.

References clang::Expr::containsErrors(), and E.

◆ discard()

template<class Emitter >
bool Compiler::discard ( const Expr E)
protected

Evaluates an expression for side effects and discards the result.

Definition at line 3234 of file Compiler.cpp.

References E.

◆ emitCleanup()

template<class Emitter >
void Compiler::emitCleanup
protected

Emits scope cleanup instructions.

Definition at line 5425 of file Compiler.cpp.

References clang::C.

◆ getFunction()

template<class Emitter >
const Function * Compiler::getFunction ( const FunctionDecl FD)
protected

Returns a function for the given FunctionDecl.

If the function does not exist yet, it is compiled.

Definition at line 3603 of file Compiler.cpp.

◆ getRecord() [1/2]

template<class Emitter >
Record * Compiler::getRecord ( const RecordDecl RD)
protected

Definition at line 3598 of file Compiler.cpp.

References P.

◆ getRecord() [2/2]

template<class Emitter >
Record * Compiler::getRecord ( QualType  Ty)
protected

Returns a record from a record or pointer type.

Definition at line 3591 of file Compiler.cpp.

◆ getRecordTy()

template<class Emitter >
const RecordType * Compiler::getRecordTy ( QualType  Ty)
protected

Returns a record type from a record or pointer type.

Definition at line 3585 of file Compiler.cpp.

References clang::Type::getAs(), and clang::Type::getPointeeType().

◆ visit()

template<class Emitter >
bool Compiler::visit ( const Expr E)
protected

Evaluates an expression and places the result on the stack.

If the expression is of composite type, a local variable will be created and a pointer to said variable will be placed on the stack.

Definition at line 3250 of file Compiler.cpp.

References E, clang::Expr::getType(), clang::Type::isAnyComplexType(), clang::Expr::isGLValue(), clang::QualType::isNull(), and clang::Type::isVoidType().

◆ VisitAbstractConditionalOperator()

template<class Emitter >
bool Compiler::VisitAbstractConditionalOperator ( const AbstractConditionalOperator E)

Definition at line 1860 of file Compiler.cpp.

References clang::Condition, and E.

◆ VisitAddrLabelExpr()

template<class Emitter >
bool Compiler::VisitAddrLabelExpr ( const AddrLabelExpr E)

◆ visitAPValue()

template<class Emitter >
bool Compiler::visitAPValue ( const APValue Val,
PrimType  ValType,
const Expr E 
)
protected

◆ visitAPValueInitializer()

template<class Emitter >
bool Compiler::visitAPValueInitializer ( const APValue Val,
const Expr E 
)
protected

◆ visitArrayElemInit()

template<class Emitter >
bool Compiler::visitArrayElemInit ( unsigned  ElemIndex,
const Expr Init 
)
protected

Pointer to the array(not the element!) must be on the stack when calling this.

Definition at line 1559 of file Compiler.cpp.

References clang::interp::InitLink::Elem(), clang::Init, and clang::T.

◆ VisitArrayInitIndexExpr()

template<class Emitter >
bool Compiler::VisitArrayInitIndexExpr ( const ArrayInitIndexExpr E)

Definition at line 1785 of file Compiler.cpp.

References E.

◆ VisitArrayInitLoopExpr()

template<class Emitter >
bool Compiler::VisitArrayInitLoopExpr ( const ArrayInitLoopExpr E)

Definition at line 1794 of file Compiler.cpp.

References clang::interp::LocalScope< Emitter >::destroyLocals(), and E.

◆ VisitArraySubscriptExpr()

template<class Emitter >
bool Compiler::VisitArraySubscriptExpr ( const ArraySubscriptExpr E)

Definition at line 1289 of file Compiler.cpp.

References E, clang::interp::PT_Ptr, and clang::Success.

◆ VisitArrayTypeTraitExpr()

template<class Emitter >
bool Compiler::VisitArrayTypeTraitExpr ( const ArrayTypeTraitExpr E)

Definition at line 2400 of file Compiler.cpp.

References E.

◆ visitAttributedStmt()

template<class Emitter >
bool Compiler::visitAttributedStmt ( const AttributedStmt S)

◆ VisitBinaryOperator()

template<class Emitter >
bool Compiler::VisitBinaryOperator ( const BinaryOperator E)

◆ VisitBlockExpr()

template<class Emitter >
bool Compiler::VisitBlockExpr ( const BlockExpr E)

Definition at line 2913 of file Compiler.cpp.

References E, clang::Func, and P.

◆ visitBool()

template<class Emitter >
bool Compiler::visitBool ( const Expr E)
protected

Visits an expression and converts it to a boolean.

Definition at line 3291 of file Compiler.cpp.

References E, clang::Expr::getType(), clang::Type::isAnyComplexType(), clang::interp::PT_Bool, clang::interp::PT_Float, clang::interp::PT_FnPtr, clang::interp::PT_Ptr, and clang::T.

◆ visitBreakStmt()

template<class Emitter >
bool Compiler::visitBreakStmt ( const BreakStmt S)

Definition at line 4571 of file Compiler.cpp.

◆ VisitBuiltinCallExpr()

template<class Emitter >
bool Compiler::VisitBuiltinCallExpr ( const CallExpr E)

◆ VisitCallExpr()

template<class Emitter >
bool Compiler::VisitCallExpr ( const CallExpr E)

◆ visitCaseStmt()

template<class Emitter >
bool Compiler::visitCaseStmt ( const CaseStmt S)

Definition at line 4659 of file Compiler.cpp.

◆ VisitCastExpr()

template<class Emitter >
bool Compiler::VisitCastExpr ( const CastExpr E)

◆ VisitCharacterLiteral()

template<class Emitter >
bool Compiler::VisitCharacterLiteral ( const CharacterLiteral E)

Definition at line 2000 of file Compiler.cpp.

References E.

◆ VisitChooseExpr()

template<class Emitter >
bool Compiler::VisitChooseExpr ( const ChooseExpr E)

Definition at line 2758 of file Compiler.cpp.

References E.

◆ VisitComplexBinOp()

template<class Emitter >
bool Compiler::VisitComplexBinOp ( const BinaryOperator E)

◆ VisitComplexUnaryOperator()

template<class Emitter >
bool Compiler::VisitComplexUnaryOperator ( const UnaryOperator E)

◆ VisitCompoundAssignOperator()

template<class Emitter >
bool Compiler::VisitCompoundAssignOperator ( const CompoundAssignOperator E)

◆ VisitCompoundLiteralExpr()

template<class Emitter >
bool Compiler::VisitCompoundLiteralExpr ( const CompoundLiteralExpr E)

Definition at line 2326 of file Compiler.cpp.

References E, clang::Expr::getType(), clang::Init, clang::Expr::isLValue(), P, and clang::T.

◆ visitCompoundStmt()

template<class Emitter >
bool Compiler::visitCompoundStmt ( const CompoundStmt S)

Definition at line 4306 of file Compiler.cpp.

◆ VisitConceptSpecializationExpr()

template<class Emitter >
bool Compiler::VisitConceptSpecializationExpr ( const ConceptSpecializationExpr E)

Definition at line 2975 of file Compiler.cpp.

References E, clang::Expr::getType(), and clang::interp::PT_Bool.

◆ VisitConstantExpr()

template<class Emitter >
bool Compiler::VisitConstantExpr ( const ConstantExpr E)

Definition at line 1598 of file Compiler.cpp.

References E, clang::Expr::getType(), and clang::T.

◆ visitContinueStmt()

template<class Emitter >
bool Compiler::visitContinueStmt ( const ContinueStmt S)

Definition at line 4580 of file Compiler.cpp.

◆ VisitConvertVectorExpr()

template<class Emitter >
bool Compiler::VisitConvertVectorExpr ( const ConvertVectorExpr E)

◆ VisitCXXBindTemporaryExpr()

template<class Emitter >
bool Compiler::VisitCXXBindTemporaryExpr ( const CXXBindTemporaryExpr E)

Definition at line 2320 of file Compiler.cpp.

References E.

◆ VisitCXXBoolLiteralExpr()

template<class Emitter >
bool Compiler::VisitCXXBoolLiteralExpr ( const CXXBoolLiteralExpr E)

Definition at line 4194 of file Compiler.cpp.

References E.

◆ VisitCXXConstructExpr()

template<class Emitter >
bool Compiler::VisitCXXConstructExpr ( const CXXConstructExpr E)

◆ VisitCXXDefaultArgExpr()

template<class Emitter >
bool Compiler::VisitCXXDefaultArgExpr ( const CXXDefaultArgExpr E)

Definition at line 4182 of file Compiler.cpp.

References E, and clang::T.

◆ VisitCXXDefaultInitExpr()

template<class Emitter >
bool Compiler::VisitCXXDefaultInitExpr ( const CXXDefaultInitExpr E)

Definition at line 4175 of file Compiler.cpp.

References E.

◆ VisitCXXDeleteExpr()

template<class Emitter >
bool Compiler::VisitCXXDeleteExpr ( const CXXDeleteExpr E)

Definition at line 2902 of file Compiler.cpp.

References E.

◆ visitCXXForRangeStmt()

template<class Emitter >
bool Compiler::visitCXXForRangeStmt ( const CXXForRangeStmt S)

Definition at line 4515 of file Compiler.cpp.

References clang::interp::Inc, and clang::Init.

◆ VisitCXXInheritedCtorInitExpr()

template<class Emitter >
bool Compiler::VisitCXXInheritedCtorInitExpr ( const CXXInheritedCtorInitExpr E)

◆ VisitCXXNewExpr()

template<class Emitter >
bool Compiler::VisitCXXNewExpr ( const CXXNewExpr E)

◆ VisitCXXNoexceptExpr()

template<class Emitter >
bool Compiler::VisitCXXNoexceptExpr ( const CXXNoexceptExpr E)

Definition at line 2474 of file Compiler.cpp.

References E, clang::Expr::getType(), and clang::Type::isBooleanType().

◆ VisitCXXNullPtrLiteralExpr()

template<class Emitter >
bool Compiler::VisitCXXNullPtrLiteralExpr ( const CXXNullPtrLiteralExpr E)

Definition at line 4202 of file Compiler.cpp.

References E.

◆ VisitCXXParenListInitExpr()

template<class Emitter >
bool Compiler::VisitCXXParenListInitExpr ( const CXXParenListInitExpr E)

Definition at line 1586 of file Compiler.cpp.

References E.

◆ VisitCXXReinterpretCastExpr()

template<class Emitter >
bool Compiler::VisitCXXReinterpretCastExpr ( const CXXReinterpretCastExpr E)

Definition at line 2462 of file Compiler.cpp.

References E.

◆ VisitCXXRewrittenBinaryOperator()

template<class Emitter >
bool Compiler::VisitCXXRewrittenBinaryOperator ( const CXXRewrittenBinaryOperator E)

Definition at line 2984 of file Compiler.cpp.

References E.

◆ VisitCXXScalarValueInitExpr()

template<class Emitter >
bool Compiler::VisitCXXScalarValueInitExpr ( const CXXScalarValueInitExpr E)

◆ VisitCXXStdInitializerListExpr()

template<class Emitter >
bool Compiler::VisitCXXStdInitializerListExpr ( const CXXStdInitializerListExpr E)

◆ VisitCXXThisExpr()

template<class Emitter >
bool Compiler::VisitCXXThisExpr ( const CXXThisExpr E)

◆ VisitCXXThrowExpr()

template<class Emitter >
bool Compiler::VisitCXXThrowExpr ( const CXXThrowExpr E)

Definition at line 2454 of file Compiler.cpp.

References E.

◆ visitCXXTryStmt()

template<class Emitter >
bool Compiler::visitCXXTryStmt ( const CXXTryStmt S)

Definition at line 4702 of file Compiler.cpp.

◆ VisitCXXUuidofExpr()

template<class Emitter >
bool Compiler::VisitCXXUuidofExpr ( const CXXUuidofExpr E)

◆ visitDecl()

template<class Emitter >
VarCreationState Compiler::visitDecl ( const VarDecl VD)
protected

◆ visitDeclAndReturn()

template<class Emitter >
bool Compiler::visitDeclAndReturn ( const VarDecl VD,
bool  ConstantContext 
)
overrideprotected

◆ visitDeclRef()

template<class Emitter >
bool Compiler::visitDeclRef ( const ValueDecl D,
const Expr E 
)
protected

Visit the given decl as if we have a reference to it.

Definition at line 5289 of file Compiler.cpp.

References D, E, clang::Type::getAs(), clang::Expr::getType(), clang::interp::isPtrType(), clang::Type::isVoidType(), P, clang::interp::PT_Ptr, and clang::T.

Referenced by clang::interp::InitLink::emit().

◆ VisitDeclRefExpr()

template<class Emitter >
bool Compiler::VisitDeclRefExpr ( const DeclRefExpr E)

Definition at line 5420 of file Compiler.cpp.

References D, and E.

◆ visitDeclStmt()

template<class Emitter >
bool Compiler::visitDeclStmt ( const DeclStmt DS)

Definition at line 4315 of file Compiler.cpp.

References D, clang::DeclStmt::decls(), and clang::isa().

◆ visitDefaultStmt()

template<class Emitter >
bool Compiler::visitDefaultStmt ( const DefaultStmt S)

Definition at line 4665 of file Compiler.cpp.

◆ visitDoStmt()

template<class Emitter >
bool Compiler::visitDoStmt ( const DoStmt S)

Definition at line 4440 of file Compiler.cpp.

◆ VisitEmbedExpr()

template<class Emitter >
bool Compiler::VisitEmbedExpr ( const EmbedExpr E)

Definition at line 1614 of file Compiler.cpp.

References E.

◆ visitExpr()

template<class Emitter >
bool Compiler::visitExpr ( const Expr E)
overrideprotected

◆ VisitExpressionTraitExpr()

template<class Emitter >
bool Compiler::VisitExpressionTraitExpr ( const ExpressionTraitExpr E)

Definition at line 2924 of file Compiler.cpp.

References E.

◆ VisitExprWithCleanups()

template<class Emitter >
bool Compiler::VisitExprWithCleanups ( const ExprWithCleanups E)

Definition at line 2239 of file Compiler.cpp.

References clang::interp::LocalScope< Emitter >::destroyLocals(), and E.

◆ VisitExtVectorElementExpr()

template<class Emitter >
bool Compiler::VisitExtVectorElementExpr ( const ExtVectorElementExpr E)

◆ VisitFloatCompoundAssignOperator()

template<class Emitter >
bool Compiler::VisitFloatCompoundAssignOperator ( const CompoundAssignOperator E)

Definition at line 2007 of file Compiler.cpp.

References E, clang::Expr::getType(), clang::Type::isFloatingType(), and LT.

◆ VisitFloatingLiteral()

template<class Emitter >
bool Compiler::VisitFloatingLiteral ( const FloatingLiteral E)

Definition at line 658 of file Compiler.cpp.

References E.

◆ visitForStmt()

template<class Emitter >
bool Compiler::visitForStmt ( const ForStmt S)

Definition at line 4468 of file Compiler.cpp.

References clang::interp::Inc, and clang::Init.

◆ visitFunc()

template<class Emitter >
bool Compiler::visitFunc ( const FunctionDecl F)
overrideprotected

◆ VisitGenericSelectionExpr()

template<class Emitter >
bool Compiler::VisitGenericSelectionExpr ( const GenericSelectionExpr E)

Definition at line 2752 of file Compiler.cpp.

References E.

◆ VisitGNUNullExpr()

template<class Emitter >
bool Compiler::VisitGNUNullExpr ( const GNUNullExpr E)

Definition at line 4211 of file Compiler.cpp.

References E, clang::Expr::getType(), clang::Type::isIntegerType(), and clang::T.

◆ visitIfStmt()

template<class Emitter >
bool Compiler::visitIfStmt ( const IfStmt IS)

◆ VisitImaginaryLiteral()

template<class Emitter >
bool Compiler::VisitImaginaryLiteral ( const ImaginaryLiteral E)

Definition at line 666 of file Compiler.cpp.

References E, clang::Expr::getType(), and clang::Type::isAnyComplexType().

◆ VisitImplicitValueInitExpr()

template<class Emitter >
bool Compiler::VisitImplicitValueInitExpr ( const ImplicitValueInitExpr E)

◆ visitInitializer()

template<class Emitter >
bool Compiler::visitInitializer ( const Expr E)
protected

Compiles an initializer.

This is like visit() but it will never create a variable and instead rely on a variable already having been created. visitInitializer() then relies on a pointer to this variable being on top of the stack.

Definition at line 3277 of file Compiler.cpp.

References clang::Expr::containsErrors(), E, and clang::Expr::getType().

◆ visitInitList()

template<class Emitter >
bool Compiler::visitInitList ( ArrayRef< const Expr * >  Inits,
const Expr ArrayFiller,
const Expr E 
)
protected

◆ VisitInitListExpr()

template<class Emitter >
bool Compiler::VisitInitListExpr ( const InitListExpr E)

Definition at line 1581 of file Compiler.cpp.

References E.

◆ VisitIntegerLiteral()

template<class Emitter >
bool Compiler::VisitIntegerLiteral ( const IntegerLiteral E)

Definition at line 650 of file Compiler.cpp.

References clang::interp::LE().

◆ VisitLambdaExpr()

template<class Emitter >
bool Compiler::VisitLambdaExpr ( const LambdaExpr E)

Definition at line 2407 of file Compiler.cpp.

References E, clang::interp::Record::fields(), clang::Init, P, and clang::T.

◆ VisitLogicalBinOp()

template<class Emitter >
bool Compiler::VisitLogicalBinOp ( const BinaryOperator E)

Definition at line 921 of file Compiler.cpp.

References E, clang::Expr::getType(), clang::interp::PT_Bool, and clang::T.

◆ VisitMaterializeTemporaryExpr()

template<class Emitter >
bool Compiler::VisitMaterializeTemporaryExpr ( const MaterializeTemporaryExpr E)

◆ VisitMemberExpr()

template<class Emitter >
bool Compiler::VisitMemberExpr ( const MemberExpr E)

◆ VisitObjCBoolLiteralExpr()

template<class Emitter >
bool Compiler::VisitObjCBoolLiteralExpr ( const ObjCBoolLiteralExpr E)

Definition at line 2763 of file Compiler.cpp.

References E.

◆ VisitObjCBoxedExpr()

template<class Emitter >
bool Compiler::VisitObjCBoxedExpr ( const ObjCBoxedExpr E)

Definition at line 3170 of file Compiler.cpp.

References E.

◆ VisitObjCEncodeExpr()

template<class Emitter >
bool Compiler::VisitObjCEncodeExpr ( const ObjCEncodeExpr E)

Definition at line 1965 of file Compiler.cpp.

References clang::StringLiteral::Create(), E, and clang::Expr::getType().

◆ VisitObjCStringLiteral()

template<class Emitter >
bool Compiler::VisitObjCStringLiteral ( const ObjCStringLiteral E)

Definition at line 1960 of file Compiler.cpp.

References E.

◆ VisitOffsetOfExpr()

template<class Emitter >
bool Compiler::VisitOffsetOfExpr ( const OffsetOfExpr E)

◆ VisitOpaqueValueExpr()

template<class Emitter >
bool Compiler::VisitOpaqueValueExpr ( const OpaqueValueExpr E)

Definition at line 1824 of file Compiler.cpp.

References E, and clang::interp::PT_Ptr.

◆ VisitPackIndexingExpr()

template<class Emitter >
bool Compiler::VisitPackIndexingExpr ( const PackIndexingExpr E)

Definition at line 3014 of file Compiler.cpp.

References E.

◆ VisitParenExpr()

template<class Emitter >
bool Compiler::VisitParenExpr ( const ParenExpr E)

Definition at line 688 of file Compiler.cpp.

References E.

◆ VisitPointerArithBinOp()

template<class Emitter >
bool Compiler::VisitPointerArithBinOp ( const BinaryOperator E)

Perform addition/subtraction of a pointer and an integer or subtraction of two pointers.

Definition at line 873 of file Compiler.cpp.

References E, clang::Expr::getType(), clang::Type::isIntegerType(), clang::Type::isPointerType(), and LT.

◆ VisitPointerCompoundAssignOperator()

template<class Emitter >
bool Compiler::VisitPointerCompoundAssignOperator ( const CompoundAssignOperator E)

Definition at line 2081 of file Compiler.cpp.

References E, clang::Expr::getType(), and LT.

◆ VisitPredefinedExpr()

template<class Emitter >
bool Compiler::VisitPredefinedExpr ( const PredefinedExpr E)

Definition at line 2446 of file Compiler.cpp.

References E.

◆ VisitPseudoObjectExpr()

template<class Emitter >
bool Compiler::VisitPseudoObjectExpr ( const PseudoObjectExpr E)

Definition at line 2990 of file Compiler.cpp.

References E.

◆ VisitRecoveryExpr()

template<class Emitter >
bool Compiler::VisitRecoveryExpr ( const RecoveryExpr E)

Definition at line 3019 of file Compiler.cpp.

References E.

◆ VisitRequiresExpr()

template<class Emitter >
bool Compiler::VisitRequiresExpr ( const RequiresExpr E)

Definition at line 2967 of file Compiler.cpp.

References E, clang::Expr::getType(), and clang::interp::PT_Bool.

◆ visitReturnStmt()

template<class Emitter >
bool Compiler::visitReturnStmt ( const ReturnStmt RS)

Definition at line 4332 of file Compiler.cpp.

References clang::ReturnStmt::getRetValue().

◆ VisitShuffleVectorExpr()

template<class Emitter >
bool Compiler::VisitShuffleVectorExpr ( const ShuffleVectorExpr E)

◆ VisitSizeOfPackExpr()

template<class Emitter >
bool Compiler::VisitSizeOfPackExpr ( const SizeOfPackExpr E)

Definition at line 2747 of file Compiler.cpp.

References E.

◆ VisitSourceLocExpr()

template<class Emitter >
bool Compiler::VisitSourceLocExpr ( const SourceLocExpr E)

◆ visitStmt()

template<class Emitter >
bool Compiler::visitStmt ( const Stmt S)
protected

Definition at line 4256 of file Compiler.cpp.

References E.

◆ VisitStmtExpr()

template<class Emitter >
bool Compiler::VisitStmtExpr ( const StmtExpr E)

◆ VisitStringLiteral()

template<class Emitter >
bool Compiler::VisitStringLiteral ( const StringLiteral E)

Definition at line 1903 of file Compiler.cpp.

References E, clang::Expr::getType(), clang::ConstantArrayType::getZExtSize(), and P.

◆ VisitSubstNonTypeTemplateParmExpr()

template<class Emitter >
bool Compiler::VisitSubstNonTypeTemplateParmExpr ( const SubstNonTypeTemplateParmExpr E)

Definition at line 1592 of file Compiler.cpp.

References E.

◆ visitSwitchStmt()

template<class Emitter >
bool Compiler::visitSwitchStmt ( const SwitchStmt S)

Definition at line 4589 of file Compiler.cpp.

References clang::Expr::getType(), and clang::Value::getType().

◆ VisitSYCLUniqueStableNameExpr()

template<class Emitter >
bool Compiler::VisitSYCLUniqueStableNameExpr ( const SYCLUniqueStableNameExpr E)

Definition at line 1976 of file Compiler.cpp.

References clang::StringLiteral::Create(), E, P, and clang::QualType::withConst().

◆ VisitTypeTraitExpr()

template<class Emitter >
bool Compiler::VisitTypeTraitExpr ( const TypeTraitExpr E)

Definition at line 2391 of file Compiler.cpp.

References E, clang::Expr::getType(), and clang::Type::isBooleanType().

◆ VisitUnaryExprOrTypeTraitExpr()

template<class Emitter >
bool Compiler::VisitUnaryExprOrTypeTraitExpr ( const UnaryExprOrTypeTraitExpr E)

◆ VisitUnaryOperator()

template<class Emitter >
bool Compiler::VisitUnaryOperator ( const UnaryOperator E)

◆ visitVarDecl()

template<class Emitter >
VarCreationState Compiler::visitVarDecl ( const VarDecl VD,
bool  Toplevel = false 
)
protected

◆ visitWhileStmt()

template<class Emitter >
bool Compiler::visitWhileStmt ( const WhileStmt S)

Definition at line 4409 of file Compiler.cpp.

Friends And Related Function Documentation

◆ ArrayIndexScope< Emitter >

template<class Emitter >
friend class ArrayIndexScope< Emitter >
friend

Definition at line 301 of file Compiler.h.

◆ DeclScope< Emitter >

template<class Emitter >
friend class DeclScope< Emitter >
friend

Definition at line 301 of file Compiler.h.

◆ DestructorScope< Emitter >

template<class Emitter >
friend class DestructorScope< Emitter >
friend

Definition at line 301 of file Compiler.h.

◆ InitLink

template<class Emitter >
friend struct InitLink
friend

Definition at line 313 of file Compiler.h.

◆ InitLinkScope< Emitter >

template<class Emitter >
friend class InitLinkScope< Emitter >
friend

Definition at line 301 of file Compiler.h.

◆ InitStackScope< Emitter >

template<class Emitter >
friend class InitStackScope< Emitter >
friend

Definition at line 301 of file Compiler.h.

◆ LabelScope< Emitter >

template<class Emitter >
friend class LabelScope< Emitter >
friend

Definition at line 313 of file Compiler.h.

◆ LocalScope< Emitter >

template<class Emitter >
friend class LocalScope< Emitter >
friend

Definition at line 301 of file Compiler.h.

◆ LoopScope< Emitter >

template<class Emitter >
friend class LoopScope< Emitter >
friend

Definition at line 313 of file Compiler.h.

◆ OptionScope< Emitter >

template<class Emitter >
friend class OptionScope< Emitter >
friend

Definition at line 301 of file Compiler.h.

◆ SourceLocScope< Emitter >

template<class Emitter >
friend class SourceLocScope< Emitter >
friend

Definition at line 301 of file Compiler.h.

◆ StmtExprScope< Emitter >

template<class Emitter >
friend class StmtExprScope< Emitter >
friend

Definition at line 313 of file Compiler.h.

◆ SwitchScope< Emitter >

template<class Emitter >
friend class SwitchScope< Emitter >
friend

Definition at line 313 of file Compiler.h.

◆ VariableScope< Emitter >

template<class Emitter >
friend class VariableScope< Emitter >
friend

Definition at line 301 of file Compiler.h.

Member Data Documentation

◆ ArrayIndex

template<class Emitter >
std::optional<uint64_t> clang::interp::Compiler< Emitter >::ArrayIndex
protected

Current argument index. Needed to emit ArrayInitIndexExpr.

Definition at line 378 of file Compiler.h.

Referenced by clang::interp::ArrayIndexScope< Emitter >::ArrayIndexScope().

◆ BreakLabel

template<class Emitter >
OptLabelTy clang::interp::Compiler< Emitter >::BreakLabel
protected

◆ CaseLabels

template<class Emitter >
CaseMap clang::interp::Compiler< Emitter >::CaseLabels
protected

Switch case mapping.

Definition at line 400 of file Compiler.h.

Referenced by clang::interp::SwitchScope< Emitter >::SwitchScope().

◆ ContinueLabel

template<class Emitter >
OptLabelTy clang::interp::Compiler< Emitter >::ContinueLabel
protected

Point to continue to.

Definition at line 405 of file Compiler.h.

Referenced by clang::interp::LoopScope< Emitter >::LoopScope().

◆ Ctx

template<class Emitter >
Context& clang::interp::Compiler< Emitter >::Ctx
protected

Current compilation context.

Definition at line 113 of file Compiler.h.

Referenced by clang::interp::Compiler< Emitter >::classify().

◆ DefaultLabel

template<class Emitter >
OptLabelTy clang::interp::Compiler< Emitter >::DefaultLabel
protected

Default case label.

Definition at line 407 of file Compiler.h.

Referenced by clang::interp::SwitchScope< Emitter >::SwitchScope().

◆ DiscardResult

template<class Emitter >
bool clang::interp::Compiler< Emitter >::DiscardResult = false
protected

Flag indicating if return value is to be discarded.

Definition at line 384 of file Compiler.h.

Referenced by clang::interp::OptionScope< Emitter >::OptionScope().

◆ Initializing

template<class Emitter >
bool clang::interp::Compiler< Emitter >::Initializing = false
protected

Flag inidicating if we're initializing an already created variable.

This is set in visitInitializer().

Definition at line 390 of file Compiler.h.

Referenced by clang::interp::OptionScope< Emitter >::OptionScope().

◆ InitializingDecl

template<class Emitter >
const ValueDecl* clang::interp::Compiler< Emitter >::InitializingDecl = nullptr
protected

Definition at line 391 of file Compiler.h.

◆ InitStack

template<class Emitter >
llvm::SmallVector<InitLink> clang::interp::Compiler< Emitter >::InitStack
protected

Definition at line 393 of file Compiler.h.

Referenced by clang::interp::InitLinkScope< Emitter >::InitLinkScope().

◆ InitStackActive

template<class Emitter >
bool clang::interp::Compiler< Emitter >::InitStackActive = false
protected

◆ InStmtExpr

template<class Emitter >
bool clang::interp::Compiler< Emitter >::InStmtExpr = false
protected

Definition at line 386 of file Compiler.h.

Referenced by clang::interp::StmtExprScope< Emitter >::StmtExprScope().

◆ Locals

template<class Emitter >
llvm::DenseMap<const ValueDecl *, Scope::Local> clang::interp::Compiler< Emitter >::Locals
protected

Variable to storage mapping.

Definition at line 369 of file Compiler.h.

◆ OpaqueExprs

template<class Emitter >
llvm::DenseMap<const OpaqueValueExpr *, unsigned> clang::interp::Compiler< Emitter >::OpaqueExprs
protected

OpaqueValueExpr to location mapping.

Definition at line 372 of file Compiler.h.

◆ P

template<class Emitter >
Program& clang::interp::Compiler< Emitter >::P
protected

Program to link to.

Definition at line 115 of file Compiler.h.

◆ ReturnType

template<class Emitter >
std::optional<PrimType> clang::interp::Compiler< Emitter >::ReturnType
protected

Type of the expression returned by the function.

Definition at line 397 of file Compiler.h.

◆ SourceLocDefaultExpr

template<class Emitter >
const Expr* clang::interp::Compiler< Emitter >::SourceLocDefaultExpr = nullptr
protected

DefaultInit- or DefaultArgExpr, needed for SourceLocExpr.

Definition at line 381 of file Compiler.h.

Referenced by clang::interp::SourceLocScope< Emitter >::SourceLocScope().

◆ VarScope

template<class Emitter >
VariableScope<Emitter>* clang::interp::Compiler< Emitter >::VarScope = nullptr
protected

Current scope.

Definition at line 375 of file Compiler.h.

Referenced by clang::interp::VariableScope< Emitter >::VariableScope().


The documentation for this class was generated from the following files: