clang 22.0.0git
Interp.cpp File Reference
#include "Interp.h"
#include "Compiler.h"
#include "Function.h"
#include "InterpFrame.h"
#include "InterpShared.h"
#include "InterpStack.h"
#include "Opcode.h"
#include "PrimType.h"
#include "Program.h"
#include "State.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/Basic/DiagnosticSema.h"
#include "clang/Basic/TargetInfo.h"
#include "llvm/ADT/StringExtras.h"
#include "Opcodes.inc"

Go to the source code of this file.

Namespaces

namespace  clang
 The JSON file list parser is used to communicate input to InstallAPI.
namespace  clang::interp

Macros

#define GET_INTERP
#define GET_INTERP

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 bool BCP (InterpState &S, CodePtr &RealPC, int32_t Offset, PrimType PT)
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 CheckTemporary (InterpState &S, CodePtr OpPC, const Block *B, 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)
bool clang::interp::isConstexprUnknown (const Pointer &P)
bool clang::interp::CheckBCPResult (InterpState &S, const Pointer &Ptr)
bool clang::interp::CheckActive (InterpState &S, CodePtr OpPC, const Pointer &Ptr, AccessKinds AK)
bool clang::interp::CheckExtern (InterpState &S, CodePtr OpPC, const Pointer &Ptr)
 Checks if the variable has externally defined storage.
bool clang::interp::CheckArray (InterpState &S, CodePtr OpPC, const Pointer &Ptr)
 Checks if the array is offsetable.
bool clang::interp::CheckLive (InterpState &S, CodePtr OpPC, const Pointer &Ptr, AccessKinds AK)
 Checks if a pointer is live and accessible.
bool 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)
bool clang::interp::CheckNull (InterpState &S, CodePtr OpPC, const Pointer &Ptr, CheckSubobjectKind CSK)
 Checks if a pointer is null.
bool clang::interp::CheckRange (InterpState &S, CodePtr OpPC, const Pointer &Ptr, AccessKinds AK)
 Checks if a pointer is in range.
bool 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.
bool clang::interp::CheckSubobject (InterpState &S, CodePtr OpPC, const Pointer &Ptr, CheckSubobjectKind CSK)
 Checks if Ptr is a one-past-the-end pointer.
bool 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.
bool clang::interp::CheckConst (InterpState &S, CodePtr OpPC, const Pointer &Ptr)
 Checks if a pointer points to const storage.
bool 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)
bool clang::interp::DiagnoseUninitialized (InterpState &S, CodePtr OpPC, const Pointer &Ptr, AccessKinds AK)
bool clang::interp::DiagnoseUninitialized (InterpState &S, CodePtr OpPC, bool Extern, const Descriptor *Desc, AccessKinds AK)
static bool clang::interp::CheckLifetime (InterpState &S, CodePtr OpPC, Lifetime LT, AccessKinds AK)
static bool clang::interp::CheckWeak (InterpState &S, CodePtr OpPC, const Block *B)
bool clang::interp::CheckGlobalLoad (InterpState &S, CodePtr OpPC, const Block *B)
 Checks a direct load of a primitive value from a global or local variable.
bool clang::interp::CheckLocalLoad (InterpState &S, CodePtr OpPC, const Block *B)
bool clang::interp::CheckLoad (InterpState &S, CodePtr OpPC, const Pointer &Ptr, AccessKinds AK=AK_Read)
 Checks if a value can be loaded from a block.
bool clang::interp::CheckFinalLoad (InterpState &S, CodePtr OpPC, const Pointer &Ptr)
 This is not used by any of the opcodes directly.
bool clang::interp::CheckStore (InterpState &S, CodePtr OpPC, const Pointer &Ptr)
 Checks if a value can be stored in a block.
static bool clang::interp::CheckInvoke (InterpState &S, CodePtr OpPC, const Pointer &Ptr)
bool clang::interp::CheckInit (InterpState &S, CodePtr OpPC, const Pointer &Ptr)
 Checks if a value can be initialized.
static bool clang::interp::CheckCallable (InterpState &S, CodePtr OpPC, const Function *F)
static bool clang::interp::CheckCallDepth (InterpState &S, CodePtr OpPC)
bool clang::interp::CheckThis (InterpState &S, CodePtr OpPC, const Pointer &This)
 Checks the 'this' pointer.
bool 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.
bool clang::interp::CheckDynamicMemoryAllocation (InterpState &S, CodePtr OpPC)
 Checks if dynamic memory allocation is available in the current language mode.
bool 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.
bool 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.
bool 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.
bool clang::interp::CheckDummy (InterpState &S, CodePtr OpPC, const Block *B, AccessKinds AK)
 Checks if a pointer is a dummy pointer.
static bool clang::interp::CheckNonNullArgs (InterpState &S, CodePtr OpPC, const Function *F, const CallExpr *CE, unsigned ArgSize)
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)
bool 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)
bool 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)
bool clang::interp::GetPtrField (InterpState &S, CodePtr OpPC, uint32_t Off)
 1) Peeks a Pointer 2) Pushes Pointer.atField(Off) on the stack
bool 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)
bool clang::interp::CheckDestructor (InterpState &S, CodePtr OpPC, const Pointer &Ptr)
static void clang::interp::compileFunction (InterpState &S, const Function *Func)
bool clang::interp::CallVar (InterpState &S, CodePtr OpPC, const Function *Func, uint32_t VarArgSize)
bool clang::interp::Call (InterpState &S, CodePtr OpPC, const Function *Func, uint32_t VarArgSize)
bool clang::interp::CallVirt (InterpState &S, CodePtr OpPC, const Function *Func, uint32_t VarArgSize)
bool clang::interp::CallBI (InterpState &S, CodePtr OpPC, const CallExpr *CE, uint32_t BuiltinID)
bool clang::interp::CallPtr (InterpState &S, CodePtr OpPC, uint32_t ArgSize, const CallExpr *CE)
static void clang::interp::startLifetimeRecurse (const Pointer &Ptr)
bool clang::interp::StartLifetime (InterpState &S, CodePtr OpPC)
static void clang::interp::endLifetimeRecurse (const Pointer &Ptr)
bool clang::interp::EndLifetime (InterpState &S, CodePtr OpPC)
 Ends the lifetime of the peek'd pointer.
bool clang::interp::EndLifetimePop (InterpState &S, CodePtr OpPC)
 Ends the lifetime of the pop'd pointer.
bool 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.
bool clang::interp::InvalidNewDeleteExpr (InterpState &S, CodePtr OpPC, const Expr *E)
bool clang::interp::handleFixedPointOverflow (InterpState &S, CodePtr OpPC, const FixedPoint &FP)
bool clang::interp::InvalidShuffleVectorIndex (InterpState &S, CodePtr OpPC, uint32_t Index)
bool clang::interp::CheckPointerToIntegralCast (InterpState &S, CodePtr OpPC, const Pointer &Ptr, unsigned BitWidth)
bool clang::interp::CastPointerIntegralAP (InterpState &S, CodePtr OpPC, uint32_t BitWidth)
bool clang::interp::CastPointerIntegralAPS (InterpState &S, CodePtr OpPC, uint32_t BitWidth)
bool clang::interp::CheckBitCast (InterpState &S, CodePtr OpPC, bool HasIndeterminateBits, bool TargetIsUCharOrByte)
bool clang::interp::GetTypeid (InterpState &S, CodePtr OpPC, const Type *TypePtr, const Type *TypeInfoType)
 Typeid support.
bool clang::interp::GetTypeidPtr (InterpState &S, CodePtr OpPC, const Type *TypeInfoType)
bool clang::interp::DiagTypeid (InterpState &S, CodePtr OpPC)
bool clang::interp::arePotentiallyOverlappingStringLiterals (const Pointer &LHS, const Pointer &RHS)
static void clang::interp::copyPrimitiveMemory (InterpState &S, const Pointer &Ptr, PrimType T)
template<typename T>
static void clang::interp::copyPrimitiveMemory (InterpState &S, const Pointer &Ptr)
static void clang::interp::finishGlobalRecurse (InterpState &S, const Pointer &Ptr)
bool clang::interp::FinishInitGlobal (InterpState &S, CodePtr OpPC)
bool clang::interp::Interpret (InterpState &S)
 Interpreter entry point.

Macro Definition Documentation

◆ GET_INTERP [1/2]

#define GET_INTERP

◆ GET_INTERP [2/2]

#define GET_INTERP

Function Documentation

◆ BCP()

◆ CheckGlobal()

◆ CheckTemporary()

◆ diagnoseMissingInitializer()

◆ diagnoseNonConstVariable()

◆ diagnoseUnknownDecl()

◆ Jf()

bool Jf ( InterpState & S,
CodePtr & PC,
int32_t Offset )
static

◆ Jmp()

bool Jmp ( InterpState & S,
CodePtr & PC,
int32_t Offset )
static

Definition at line 39 of file Interp.cpp.

◆ Jt()

bool Jt ( InterpState & S,
CodePtr & PC,
int32_t Offset )
static

◆ RetValue()

bool RetValue ( InterpState & S,
CodePtr & Pt )
static

Definition at line 31 of file Interp.cpp.