Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
clang 20.0.0git
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 >:

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 VisitFixedPointLiteral (const FixedPointLiteral *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 VisitVectorBinOp (const BinaryOperator *E)
 
bool VisitFixedPointBinOp (const BinaryOperator *E)
 
bool VisitFixedPointUnaryOperator (const UnaryOperator *E)
 
bool VisitCXXDefaultArgExpr (const CXXDefaultArgExpr *E)
 
bool VisitCallExpr (const CallExpr *E)
 
bool VisitBuiltinCallExpr (const CallExpr *E, unsigned BuiltinID)
 
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 VisitVectorUnaryOperator (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 VisitCXXTypeidExpr (const CXXTypeidExpr *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, bool DestroyToplevelScope) 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, QualType Ty=QualType(), 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.
 
VariableScope< Emitter > * BreakVarScope = nullptr
 Scope to cleanup until when we see a break statement.
 
OptLabelTy BreakLabel
 Point to break to.
 
VariableScope< Emitter > * ContinueVarScope = nullptr
 Scope to cleanup until when we see a continue statement.
 
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 107 of file Compiler.h.

Member Typedef Documentation

◆ AddrTy

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

Definition at line 112 of file Compiler.h.

◆ CaseMap

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

Definition at line 114 of file Compiler.h.

◆ LabelTy

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

Definition at line 111 of file Compiler.h.

◆ OptLabelTy

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

Definition at line 113 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 124 of file Compiler.h.

Member Function Documentation

◆ allocateLocal()

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

◆ 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 4106 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 268 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 261 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 3811 of file Compiler.cpp.

References 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 3805 of file Compiler.cpp.

References E.

◆ emitCleanup()

template<class Emitter >
void Compiler::emitCleanup
protected

Emits scope cleanup instructions.

Definition at line 6279 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 4212 of file Compiler.cpp.

◆ getRecord() [1/2]

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

Definition at line 4207 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 4200 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 4194 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 3818 of file Compiler.cpp.

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

◆ VisitAbstractConditionalOperator()

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

Definition at line 2290 of file Compiler.cpp.

References clang::Condition, and E.

◆ VisitAddrLabelExpr()

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

◆ visitAPValue()

◆ visitAPValueInitializer()

◆ 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 1968 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 2215 of file Compiler.cpp.

References E.

◆ VisitArrayInitLoopExpr()

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

◆ VisitArraySubscriptExpr()

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

Definition at line 1693 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 2839 of file Compiler.cpp.

References E.

◆ visitAttributedStmt()

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

◆ VisitBinaryOperator()

◆ VisitBlockExpr()

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

Definition at line 3435 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 3854 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 5278 of file Compiler.cpp.

References clang::C.

◆ VisitBuiltinCallExpr()

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

◆ VisitCallExpr()

◆ visitCaseStmt()

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

Definition at line 5372 of file Compiler.cpp.

◆ VisitCastExpr()

◆ VisitCharacterLiteral()

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

Definition at line 2432 of file Compiler.cpp.

References E.

◆ VisitChooseExpr()

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

Definition at line 3243 of file Compiler.cpp.

References E.

◆ VisitComplexBinOp()

◆ VisitComplexUnaryOperator()

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

◆ VisitCompoundAssignOperator()

◆ VisitCompoundLiteralExpr()

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

◆ visitCompoundStmt()

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

Definition at line 4968 of file Compiler.cpp.

◆ VisitConceptSpecializationExpr()

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

Definition at line 3529 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 2007 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 5289 of file Compiler.cpp.

References clang::C.

◆ VisitConvertVectorExpr()

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

◆ VisitCXXBindTemporaryExpr()

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

Definition at line 2759 of file Compiler.cpp.

References E.

◆ VisitCXXBoolLiteralExpr()

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

Definition at line 4824 of file Compiler.cpp.

References E.

◆ VisitCXXConstructExpr()

◆ VisitCXXDefaultArgExpr()

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

Definition at line 4817 of file Compiler.cpp.

References E.

◆ VisitCXXDefaultInitExpr()

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

Definition at line 4810 of file Compiler.cpp.

References E.

◆ VisitCXXDeleteExpr()

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

Definition at line 3419 of file Compiler.cpp.

References E.

◆ visitCXXForRangeStmt()

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

Definition at line 5222 of file Compiler.cpp.

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

◆ VisitCXXInheritedCtorInitExpr()

◆ VisitCXXNewExpr()

◆ VisitCXXNoexceptExpr()

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

Definition at line 2953 of file Compiler.cpp.

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

◆ VisitCXXNullPtrLiteralExpr()

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

◆ VisitCXXParenListInitExpr()

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

Definition at line 1995 of file Compiler.cpp.

References E.

◆ VisitCXXReinterpretCastExpr()

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

◆ VisitCXXRewrittenBinaryOperator()

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

Definition at line 3538 of file Compiler.cpp.

References E.

◆ VisitCXXScalarValueInitExpr()

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

◆ VisitCXXStdInitializerListExpr()

◆ VisitCXXThisExpr()

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

◆ VisitCXXThrowExpr()

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

Definition at line 2898 of file Compiler.cpp.

References E.

◆ visitCXXTryStmt()

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

Definition at line 5415 of file Compiler.cpp.

◆ VisitCXXTypeidExpr()

template<class Emitter >
bool Compiler::VisitCXXTypeidExpr ( const CXXTypeidExpr E)

◆ VisitCXXUuidofExpr()

◆ visitDecl()

◆ 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 6124 of file Compiler.cpp.

References D, E, clang::ASTContext::getLangOpts(), clang::Expr::getType(), clang::Init, clang::Type::isReferenceType(), P, clang::interp::PT_Ptr, clang::T, and V.

◆ VisitDeclRefExpr()

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

Definition at line 6274 of file Compiler.cpp.

References D, and E.

◆ visitDeclStmt()

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

Definition at line 4977 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 5378 of file Compiler.cpp.

◆ visitDoStmt()

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

◆ VisitEmbedExpr()

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

Definition at line 2023 of file Compiler.cpp.

References E.

◆ visitExpr()

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

◆ VisitExpressionTraitExpr()

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

Definition at line 3481 of file Compiler.cpp.

References E, and clang::ASTContext::getLangOpts().

◆ VisitExprWithCleanups()

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

Definition at line 2672 of file Compiler.cpp.

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

◆ VisitExtVectorElementExpr()

◆ VisitFixedPointBinOp()

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

◆ VisitFixedPointLiteral()

template<class Emitter >
bool Compiler::VisitFixedPointLiteral ( const FixedPointLiteral E)

◆ VisitFixedPointUnaryOperator()

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

Definition at line 1610 of file Compiler.cpp.

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

◆ VisitFloatCompoundAssignOperator()

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

Definition at line 2439 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 748 of file Compiler.cpp.

References E.

◆ visitForStmt()

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

◆ visitFunc()

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

◆ VisitGenericSelectionExpr()

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

Definition at line 3237 of file Compiler.cpp.

References E.

◆ VisitGNUNullExpr()

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

Definition at line 4842 of file Compiler.cpp.

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

◆ visitIfStmt()

◆ VisitImaginaryLiteral()

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

◆ VisitImplicitValueInitExpr()

◆ 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 3846 of file Compiler.cpp.

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

◆ visitInitList()

◆ VisitInitListExpr()

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

Definition at line 1990 of file Compiler.cpp.

References E.

◆ VisitIntegerLiteral()

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

Definition at line 740 of file Compiler.cpp.

References clang::interp::LE().

◆ VisitLambdaExpr()

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

Definition at line 2846 of file Compiler.cpp.

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

◆ VisitLogicalBinOp()

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

Definition at line 1057 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()

◆ VisitObjCBoolLiteralExpr()

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

Definition at line 3248 of file Compiler.cpp.

References E.

◆ VisitObjCBoxedExpr()

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

Definition at line 3731 of file Compiler.cpp.

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

◆ VisitObjCEncodeExpr()

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

◆ VisitObjCStringLiteral()

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

Definition at line 2390 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 2254 of file Compiler.cpp.

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

◆ VisitPackIndexingExpr()

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

Definition at line 3568 of file Compiler.cpp.

References E.

◆ VisitParenExpr()

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

Definition at line 791 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 980 of file Compiler.cpp.

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

◆ VisitPointerCompoundAssignOperator()

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

Definition at line 2512 of file Compiler.cpp.

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

◆ VisitPredefinedExpr()

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

Definition at line 2885 of file Compiler.cpp.

References E, clang::Initializing, and P.

◆ VisitPseudoObjectExpr()

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

Definition at line 3544 of file Compiler.cpp.

References E.

◆ VisitRecoveryExpr()

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

Definition at line 3573 of file Compiler.cpp.

References E.

◆ VisitRequiresExpr()

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

Definition at line 3521 of file Compiler.cpp.

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

◆ visitReturnStmt()

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

◆ VisitShuffleVectorExpr()

◆ VisitSizeOfPackExpr()

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

Definition at line 3232 of file Compiler.cpp.

References E.

◆ VisitSourceLocExpr()

◆ visitStmt()

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

Definition at line 4918 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)

◆ VisitSubstNonTypeTemplateParmExpr()

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

Definition at line 2001 of file Compiler.cpp.

References E.

◆ visitSwitchStmt()

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

◆ VisitSYCLUniqueStableNameExpr()

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

◆ VisitTypeTraitExpr()

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

Definition at line 2830 of file Compiler.cpp.

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

◆ VisitUnaryExprOrTypeTraitExpr()

◆ VisitUnaryOperator()

◆ visitVarDecl()

◆ VisitVectorBinOp()

◆ VisitVectorUnaryOperator()

◆ visitWhileStmt()

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

Friends And Related Function Documentation

◆ ArrayIndexScope< Emitter >

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

Definition at line 312 of file Compiler.h.

◆ DeclScope< Emitter >

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

Definition at line 312 of file Compiler.h.

◆ DestructorScope< Emitter >

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

Definition at line 312 of file Compiler.h.

◆ InitLink

template<class Emitter >
friend struct InitLink
friend

Definition at line 324 of file Compiler.h.

◆ InitLinkScope< Emitter >

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

Definition at line 312 of file Compiler.h.

◆ InitStackScope< Emitter >

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

Definition at line 312 of file Compiler.h.

◆ LabelScope< Emitter >

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

Definition at line 324 of file Compiler.h.

◆ LocalScope< Emitter >

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

Definition at line 312 of file Compiler.h.

◆ LoopScope< Emitter >

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

Definition at line 324 of file Compiler.h.

◆ OptionScope< Emitter >

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

Definition at line 312 of file Compiler.h.

◆ SourceLocScope< Emitter >

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

Definition at line 312 of file Compiler.h.

◆ StmtExprScope< Emitter >

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

Definition at line 324 of file Compiler.h.

◆ SwitchScope< Emitter >

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

Definition at line 324 of file Compiler.h.

◆ VariableScope< Emitter >

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

Definition at line 312 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 400 of file Compiler.h.

◆ BreakLabel

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

◆ BreakVarScope

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

Scope to cleanup until when we see a break statement.

Definition at line 425 of file Compiler.h.

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

◆ CaseLabels

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

Switch case mapping.

Definition at line 422 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 431 of file Compiler.h.

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

◆ ContinueVarScope

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

Scope to cleanup until when we see a continue statement.

Definition at line 429 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 117 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 433 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 406 of file Compiler.h.

◆ 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 412 of file Compiler.h.

◆ InitializingDecl

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

Definition at line 413 of file Compiler.h.

◆ InitStack

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

Definition at line 415 of file Compiler.h.

◆ InitStackActive

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

Definition at line 416 of file Compiler.h.

◆ InStmtExpr

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

Definition at line 408 of file Compiler.h.

◆ Locals

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

Variable to storage mapping.

Definition at line 391 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 394 of file Compiler.h.

◆ P

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

Program to link to.

Definition at line 119 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 419 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 403 of file Compiler.h.

◆ VarScope

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

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