clang: lib/AST/ByteCode/Interp.cpp File Reference (original) (raw)
#include "[Interp.h](Interp%5F8h%5Fsource.html)"
#include "[Function.h](Function%5F8h%5Fsource.html)"
#include "[InterpFrame.h](InterpFrame%5F8h%5Fsource.html)"
#include "[InterpShared.h](InterpShared%5F8h%5Fsource.html)"
#include "[InterpStack.h](InterpStack%5F8h%5Fsource.html)"
#include "[Opcode.h](Opcode%5F8h%5Fsource.html)"
#include "[PrimType.h](PrimType%5F8h%5Fsource.html)"
#include "[Program.h](Program%5F8h%5Fsource.html)"
#include "[State.h](State%5F8h%5Fsource.html)"
#include "[clang/AST/ASTContext.h](ASTContext%5F8h%5Fsource.html)"
#include "[clang/AST/CXXInheritance.h](CXXInheritance%5F8h%5Fsource.html)"
#include "[clang/AST/DeclObjC.h](DeclObjC%5F8h%5Fsource.html)"
#include "[clang/AST/Expr.h](Expr%5F8h%5Fsource.html)"
#include "[clang/AST/ExprCXX.h](ExprCXX%5F8h%5Fsource.html)"
#include "[clang/Basic/DiagnosticSema.h](DiagnosticSema%5F8h%5Fsource.html)"
#include "[clang/Basic/TargetInfo.h](include%5F2clang%5F2Basic%5F2TargetInfo%5F8h%5Fsource.html)"
#include "llvm/ADT/StringExtras.h"
#include "Opcodes.inc"
Functions
static bool
RetValue (InterpState &S, CodePtr &Pt)
static bool
Jmp (InterpState &S, CodePtr &PC, int32_t Offset)
static bool
Jt (InterpState &S, CodePtr &PC, int32_t Offset)
static bool
Jf (InterpState &S, CodePtr &PC, int32_t Offset)
static void
diagnoseMissingInitializer (InterpState &S, CodePtr OpPC, const ValueDecl *VD)
static void
diagnoseNonConstVariable (InterpState &S, CodePtr OpPC, const ValueDecl *VD)
static bool
diagnoseUnknownDecl (InterpState &S, CodePtr OpPC, const ValueDecl *D)
static bool
CheckActive (InterpState &S, CodePtr OpPC, const Pointer &Ptr, AccessKinds AK)
static bool
CheckTemporary (InterpState &S, CodePtr OpPC, const Pointer &Ptr, AccessKinds AK)
static bool
CheckGlobal (InterpState &S, CodePtr OpPC, const Pointer &Ptr)
static void
clang::interp::popArg (InterpState &S, const Expr *Arg)
void
clang::interp::cleanupAfterFunctionCall (InterpState &S, CodePtr OpPC, const Function *Func)
clang::interp::CheckExtern (InterpState &S, CodePtr OpPC, const Pointer &Ptr)
Checks if the variable has externally defined storage.
clang::interp::CheckArray (InterpState &S, CodePtr OpPC, const Pointer &Ptr)
Checks if the array is offsetable.
clang::interp::CheckLive (InterpState &S, CodePtr OpPC, const Pointer &Ptr, AccessKinds AK)
Checks if a pointer is live and accessible.
clang::interp::CheckConstant (InterpState &S, CodePtr OpPC, const Descriptor *Desc)
Checks if the Descriptor is of a constexpr or const global variable.
static bool
clang::interp::CheckConstant (InterpState &S, CodePtr OpPC, const Pointer &Ptr)
clang::interp::CheckNull (InterpState &S, CodePtr OpPC, const Pointer &Ptr, CheckSubobjectKind CSK)
Checks if a pointer is null.
clang::interp::CheckRange (InterpState &S, CodePtr OpPC, const Pointer &Ptr, AccessKinds AK)
Checks if a pointer is in range.
clang::interp::CheckRange (InterpState &S, CodePtr OpPC, const Pointer &Ptr, CheckSubobjectKind CSK)
Checks if a field from which a pointer is going to be derived is valid.
clang::interp::CheckSubobject (InterpState &S, CodePtr OpPC, const Pointer &Ptr, CheckSubobjectKind CSK)
Checks if Ptr is a one-past-the-end pointer.
clang::interp::CheckDowncast (InterpState &S, CodePtr OpPC, const Pointer &Ptr, uint32_t Offset)
Checks if the dowcast using the given offset is possible with the given pointer.
clang::interp::CheckConst (InterpState &S, CodePtr OpPC, const Pointer &Ptr)
Checks if a pointer points to const storage.
clang::interp::CheckMutable (InterpState &S, CodePtr OpPC, const Pointer &Ptr)
Checks if a pointer points to a mutable field.
static bool
clang::interp::CheckVolatile (InterpState &S, CodePtr OpPC, const Pointer &Ptr, AccessKinds AK)
clang::interp::CheckInitialized (InterpState &S, CodePtr OpPC, const Pointer &Ptr, AccessKinds AK)
clang::interp::CheckGlobalInitialized (InterpState &S, CodePtr OpPC, const Pointer &Ptr)
Check if a global variable is initialized.
static bool
clang::interp::CheckWeak (InterpState &S, CodePtr OpPC, const Pointer &Ptr)
clang::interp::CheckLoad (InterpState &S, CodePtr OpPC, const Pointer &Ptr, AccessKinds AK=AK_Read)
Checks if a value can be loaded from a block.
clang::interp::CheckFinalLoad (InterpState &S, CodePtr OpPC, const Pointer &Ptr)
This is not used by any of the opcodes directly.
clang::interp::CheckStore (InterpState &S, CodePtr OpPC, const Pointer &Ptr)
Checks if a value can be stored in a block.
clang::interp::CheckInvoke (InterpState &S, CodePtr OpPC, const Pointer &Ptr)
Checks if a method can be invoked on an object.
clang::interp::CheckInit (InterpState &S, CodePtr OpPC, const Pointer &Ptr)
Checks if a value can be initialized.
clang::interp::CheckCallable (InterpState &S, CodePtr OpPC, const Function *F)
Checks if a method can be called.
clang::interp::CheckCallDepth (InterpState &S, CodePtr OpPC)
Checks if calling the currently active function would exceed the allowed call depth.
clang::interp::CheckThis (InterpState &S, CodePtr OpPC, const Pointer &This)
Checks the 'this' pointer.
clang::interp::CheckPure (InterpState &S, CodePtr OpPC, const CXXMethodDecl *MD)
Checks if a method is pure virtual.
clang::interp::CheckFloatResult (InterpState &S, CodePtr OpPC, const Floating &Result, APFloat::opStatus Status, FPOptions FPO)
Checks if the result of a floating-point operation is valid in the current context.
clang::interp::CheckDynamicMemoryAllocation (InterpState &S, CodePtr OpPC)
Checks if dynamic memory allocation is available in the current language mode.
clang::interp::CheckNewDeleteForms (InterpState &S, CodePtr OpPC, DynamicAllocator::Form AllocForm, DynamicAllocator::Form DeleteForm, const Descriptor *D, const Expr *NewExpr)
Diagnose mismatched new[]/delete or new/delete[] pairs.
clang::interp::CheckDeleteSource (InterpState &S, CodePtr OpPC, const Expr *Source, const Pointer &Ptr)
Check the source of the pointer passed to delete/delete[] has actually been heap allocated by us.
clang::interp::CheckDeclRef (InterpState &S, CodePtr OpPC, const DeclRefExpr *DR)
We aleady know the given DeclRefExpr is invalid for some reason, now figure out why and print appropriate diagnostics.
clang::interp::CheckDummy (InterpState &S, CodePtr OpPC, const Pointer &Ptr, AccessKinds AK)
Checks if a pointer is a dummy pointer.
clang::interp::CheckNonNullArgs (InterpState &S, CodePtr OpPC, const Function *F, const CallExpr *CE, unsigned ArgSize)
Checks if all the arguments annotated as 'nonnull' are in fact not null.
static bool
clang::interp::runRecordDestructor (InterpState &S, CodePtr OpPC, const Pointer &BasePtr, const Descriptor *Desc)
static bool
clang::interp::RunDestructors (InterpState &S, CodePtr OpPC, const Block *B)
static bool
clang::interp::hasVirtualDestructor (QualType T)
clang::interp::Free (InterpState &S, CodePtr OpPC, bool DeleteIsArrayForm, bool IsGlobalDelete)
void
clang::interp::diagnoseEnumValue (InterpState &S, CodePtr OpPC, const EnumDecl *ED, const APSInt &Value)
clang::interp::CheckLiteralType (InterpState &S, CodePtr OpPC, const Type *T)
static bool
clang::interp::getField (InterpState &S, CodePtr OpPC, const Pointer &Ptr, uint32_t Off)
clang::interp::GetPtrField (InterpState &S, CodePtr OpPC, uint32_t Off)
- Peeks a Pointer 2) Pushes Pointer.atField(Off) on the stack
clang::interp::GetPtrFieldPop (InterpState &S, CodePtr OpPC, uint32_t Off)
static bool
clang::interp::checkConstructor (InterpState &S, CodePtr OpPC, const Function *Func, const Pointer &ThisPtr)
clang::interp::CallVar (InterpState &S, CodePtr OpPC, const Function *Func, uint32_t VarArgSize)
clang::interp::Call (InterpState &S, CodePtr OpPC, const Function *Func, uint32_t VarArgSize)
clang::interp::CallVirt (InterpState &S, CodePtr OpPC, const Function *Func, uint32_t VarArgSize)
clang::interp::CallBI (InterpState &S, CodePtr OpPC, const Function *Func, const CallExpr *CE, uint32_t BuiltinID)
clang::interp::CallPtr (InterpState &S, CodePtr OpPC, uint32_t ArgSize, const CallExpr *CE)
clang::interp::CheckNewTypeMismatch (InterpState &S, CodePtr OpPC, const Expr *E, std::optional< uint64_t > ArraySize=std::nullopt)
Check if the initializer and storage types of a placement-new expression match.
clang::interp::InvalidNewDeleteExpr (InterpState &S, CodePtr OpPC, const Expr *E)
clang::interp::handleFixedPointOverflow (InterpState &S, CodePtr OpPC, const FixedPoint &FP)
clang::interp::InvalidShuffleVectorIndex (InterpState &S, CodePtr OpPC, uint32_t Index)
clang::interp::CheckPointerToIntegralCast (InterpState &S, CodePtr OpPC, const Pointer &Ptr, unsigned BitWidth)
clang::interp::CastPointerIntegralAP (InterpState &S, CodePtr OpPC, uint32_t BitWidth)
clang::interp::CastPointerIntegralAPS (InterpState &S, CodePtr OpPC, uint32_t BitWidth)
clang::interp::CheckBitCast (InterpState &S, CodePtr OpPC, bool HasIndeterminateBits, bool TargetIsUCharOrByte)
clang::interp::GetTypeid (InterpState &S, CodePtr OpPC, const Type *TypePtr, const Type *TypeInfoType)
Typeid support.
clang::interp::GetTypeidPtr (InterpState &S, CodePtr OpPC, const Type *TypeInfoType)
clang::interp::DiagTypeid (InterpState &S, CodePtr OpPC)
clang::interp::Interpret (InterpState &S)
Interpreter entry point.