Lines Matching defs:OpPC
49 bool CheckExtern(InterpState &S, CodePtr OpPC, const Pointer &Ptr);
52 bool CheckArray(InterpState &S, CodePtr OpPC, const Pointer &Ptr);
55 bool CheckLive(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
59 bool CheckDummy(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
63 bool CheckNull(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
67 bool CheckRange(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
71 bool CheckRange(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
75 bool CheckSubobject(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
80 bool CheckDowncast(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
84 bool CheckConst(InterpState &S, CodePtr OpPC, const Pointer &Ptr);
87 bool CheckConstant(InterpState &S, CodePtr OpPC, const Descriptor *Desc);
90 bool CheckMutable(InterpState &S, CodePtr OpPC, const Pointer &Ptr);
93 bool CheckLoad(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
96 bool CheckInitialized(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
99 bool CheckGlobalInitialized(InterpState &S, CodePtr OpPC, const Pointer &Ptr);
102 bool CheckStore(InterpState &S, CodePtr OpPC, const Pointer &Ptr);
105 bool CheckInvoke(InterpState &S, CodePtr OpPC, const Pointer &Ptr);
108 bool CheckInit(InterpState &S, CodePtr OpPC, const Pointer &Ptr);
111 bool CheckCallable(InterpState &S, CodePtr OpPC, const Function *F);
115 bool CheckCallDepth(InterpState &S, CodePtr OpPC);
118 bool CheckThis(InterpState &S, CodePtr OpPC, const Pointer &This);
121 bool CheckPure(InterpState &S, CodePtr OpPC, const CXXMethodDecl *MD);
124 bool CheckNonNullArgs(InterpState &S, CodePtr OpPC, const Function *F,
129 bool CheckDynamicMemoryAllocation(InterpState &S, CodePtr OpPC);
132 bool CheckNewDeleteForms(InterpState &S, CodePtr OpPC, bool NewWasArray,
138 bool CheckDeleteSource(InterpState &S, CodePtr OpPC, const Expr *Source,
143 bool SetThreeWayComparisonField(InterpState &S, CodePtr OpPC,
147 bool DoMemcpy(InterpState &S, CodePtr OpPC, const Pointer &Src, Pointer &Dest);
151 bool CheckShift(InterpState &S, CodePtr OpPC, const LT &LHS, const RT &RHS,
154 const SourceInfo &Loc = S.Current->getSource(OpPC);
163 const Expr *E = S.Current->getExpr(OpPC);
172 const Expr *E = S.Current->getExpr(OpPC);
195 bool CheckDivRem(InterpState &S, CodePtr OpPC, const T &LHS, const T &RHS) {
197 const auto *Op = cast<BinaryOperator>(S.Current->getExpr(OpPC));
213 const SourceInfo &Loc = S.Current->getSource(OpPC);
214 const Expr *E = S.Current->getExpr(OpPC);
222 bool CheckArraySize(InterpState &S, CodePtr OpPC, SizeT *NumElements,
236 const SourceInfo &Loc = S.Current->getSource(OpPC);
247 bool CheckFloatResult(InterpState &S, CodePtr OpPC, const Floating &Result,
251 bool CheckDeclRef(InterpState &S, CodePtr OpPC, const DeclRefExpr *DR);
257 bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const Function *F,
261 bool InterpretOffsetOf(InterpState &S, CodePtr OpPC, const OffsetOfExpr *E,
264 inline bool Invalid(InterpState &S, CodePtr OpPC);
272 void cleanupAfterFunctionCall(InterpState &S, CodePtr OpPC);
332 bool AddSubMulHelper(InterpState &S, CodePtr OpPC, unsigned Bits, const T &LHS,
348 const Expr *E = S.Current->getExpr(OpPC);
371 bool Add(InterpState &S, CodePtr OpPC) {
375 return AddSubMulHelper<T, T::add, std::plus>(S, OpPC, Bits, LHS, RHS);
378 inline bool Addf(InterpState &S, CodePtr OpPC, llvm::RoundingMode RM) {
385 return CheckFloatResult(S, OpPC, Result, Status);
389 bool Sub(InterpState &S, CodePtr OpPC) {
393 return AddSubMulHelper<T, T::sub, std::minus>(S, OpPC, Bits, LHS, RHS);
396 inline bool Subf(InterpState &S, CodePtr OpPC, llvm::RoundingMode RM) {
403 return CheckFloatResult(S, OpPC, Result, Status);
407 bool Mul(InterpState &S, CodePtr OpPC) {
411 return AddSubMulHelper<T, T::mul, std::multiplies>(S, OpPC, Bits, LHS, RHS);
414 inline bool Mulf(InterpState &S, CodePtr OpPC, llvm::RoundingMode RM) {
421 return CheckFloatResult(S, OpPC, Result, Status);
425 inline bool Mulc(InterpState &S, CodePtr OpPC) {
480 inline bool Divc(InterpState &S, CodePtr OpPC) {
512 const SourceInfo &E = S.Current->getSource(OpPC);
555 bool BitAnd(InterpState &S, CodePtr OpPC) {
572 bool BitOr(InterpState &S, CodePtr OpPC) {
589 bool BitXor(InterpState &S, CodePtr OpPC) {
606 bool Rem(InterpState &S, CodePtr OpPC) {
610 if (!CheckDivRem(S, OpPC, LHS, RHS))
626 bool Div(InterpState &S, CodePtr OpPC) {
630 if (!CheckDivRem(S, OpPC, LHS, RHS))
642 inline bool Divf(InterpState &S, CodePtr OpPC, llvm::RoundingMode RM) {
646 if (!CheckDivRem(S, OpPC, LHS, RHS))
652 return CheckFloatResult(S, OpPC, Result, Status);
660 bool Inv(InterpState &S, CodePtr OpPC) {
676 bool Neg(InterpState &S, CodePtr OpPC) {
690 const Expr *E = S.Current->getExpr(OpPC);
718 bool IncDecHelper(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
723 return Invalid(S, OpPC);
754 const Expr *E = S.Current->getExpr(OpPC);
776 bool Inc(InterpState &S, CodePtr OpPC) {
778 if (!CheckLoad(S, OpPC, Ptr, AK_Increment))
781 return IncDecHelper<T, IncDecOp::Inc, PushVal::Yes>(S, OpPC, Ptr);
788 bool IncPop(InterpState &S, CodePtr OpPC) {
790 if (!CheckLoad(S, OpPC, Ptr, AK_Increment))
793 return IncDecHelper<T, IncDecOp::Inc, PushVal::No>(S, OpPC, Ptr);
801 bool Dec(InterpState &S, CodePtr OpPC) {
803 if (!CheckLoad(S, OpPC, Ptr, AK_Decrement))
806 return IncDecHelper<T, IncDecOp::Dec, PushVal::Yes>(S, OpPC, Ptr);
813 bool DecPop(InterpState &S, CodePtr OpPC) {
815 if (!CheckLoad(S, OpPC, Ptr, AK_Decrement))
818 return IncDecHelper<T, IncDecOp::Dec, PushVal::No>(S, OpPC, Ptr);
822 bool IncDecFloatHelper(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
838 return CheckFloatResult(S, OpPC, Result, Status);
841 inline bool Incf(InterpState &S, CodePtr OpPC, llvm::RoundingMode RM) {
843 if (!CheckLoad(S, OpPC, Ptr, AK_Increment))
846 return IncDecFloatHelper<IncDecOp::Inc, PushVal::Yes>(S, OpPC, Ptr, RM);
849 inline bool IncfPop(InterpState &S, CodePtr OpPC, llvm::RoundingMode RM) {
851 if (!CheckLoad(S, OpPC, Ptr, AK_Increment))
854 return IncDecFloatHelper<IncDecOp::Inc, PushVal::No>(S, OpPC, Ptr, RM);
857 inline bool Decf(InterpState &S, CodePtr OpPC, llvm::RoundingMode RM) {
859 if (!CheckLoad(S, OpPC, Ptr, AK_Decrement))
862 return IncDecFloatHelper<IncDecOp::Dec, PushVal::Yes>(S, OpPC, Ptr, RM);
865 inline bool DecfPop(InterpState &S, CodePtr OpPC, llvm::RoundingMode RM) {
867 if (!CheckLoad(S, OpPC, Ptr, AK_Decrement))
870 return IncDecFloatHelper<IncDecOp::Dec, PushVal::No>(S, OpPC, Ptr, RM);
876 bool Comp(InterpState &S, CodePtr OpPC) {
894 bool CmpHelper(InterpState &S, CodePtr OpPC, CompareFn Fn) {
906 bool CmpHelperEQ(InterpState &S, CodePtr OpPC, CompareFn Fn) {
907 return CmpHelper<T>(S, OpPC, Fn);
912 inline bool CmpHelper<FunctionPointer>(InterpState &S, CodePtr OpPC,
917 const SourceInfo &Loc = S.Current->getSource(OpPC);
925 inline bool CmpHelperEQ<FunctionPointer>(InterpState &S, CodePtr OpPC,
933 const SourceInfo &Loc = S.Current->getSource(OpPC);
945 inline bool CmpHelper<Pointer>(InterpState &S, CodePtr OpPC, CompareFn Fn) {
951 const SourceInfo &Loc = S.Current->getSource(OpPC);
965 inline bool CmpHelperEQ<Pointer>(InterpState &S, CodePtr OpPC, CompareFn Fn) {
980 const SourceInfo &Loc = S.Current->getSource(OpPC);
990 const SourceInfo &Loc = S.Current->getSource(OpPC);
996 const SourceInfo &Loc = S.Current->getSource(OpPC);
1023 inline bool CmpHelperEQ<MemberPointer>(InterpState &S, CodePtr OpPC,
1032 const SourceInfo &Loc = S.Current->getSource(OpPC);
1054 const SourceInfo &Loc = S.Current->getSource(OpPC);
1064 bool EQ(InterpState &S, CodePtr OpPC) {
1065 return CmpHelperEQ<T>(S, OpPC, [](ComparisonCategoryResult R) {
1071 bool CMP3(InterpState &S, CodePtr OpPC, const ComparisonCategoryInfo *CmpInfo) {
1079 const SourceInfo &Loc = S.Current->getSource(OpPC);
1091 return SetThreeWayComparisonField(S, OpPC, P, CmpValueInfo->getIntValue());
1095 bool NE(InterpState &S, CodePtr OpPC) {
1096 return CmpHelperEQ<T>(S, OpPC, [](ComparisonCategoryResult R) {
1102 bool LT(InterpState &S, CodePtr OpPC) {
1103 return CmpHelper<T>(S, OpPC, [](ComparisonCategoryResult R) {
1109 bool LE(InterpState &S, CodePtr OpPC) {
1110 return CmpHelper<T>(S, OpPC, [](ComparisonCategoryResult R) {
1117 bool GT(InterpState &S, CodePtr OpPC) {
1118 return CmpHelper<T>(S, OpPC, [](ComparisonCategoryResult R) {
1124 bool GE(InterpState &S, CodePtr OpPC) {
1125 return CmpHelper<T>(S, OpPC, [](ComparisonCategoryResult R) {
1136 bool InRange(InterpState &S, CodePtr OpPC) {
1150 bool Dup(InterpState &S, CodePtr OpPC) {
1156 bool Pop(InterpState &S, CodePtr OpPC) {
1166 bool Const(InterpState &S, CodePtr OpPC, const T &Arg) {
1176 bool GetLocal(InterpState &S, CodePtr OpPC, uint32_t I) {
1178 if (!CheckLoad(S, OpPC, Ptr))
1188 bool SetLocal(InterpState &S, CodePtr OpPC, uint32_t I) {
1194 bool GetParam(InterpState &S, CodePtr OpPC, uint32_t I) {
1203 bool SetParam(InterpState &S, CodePtr OpPC, uint32_t I) {
1211 bool GetField(InterpState &S, CodePtr OpPC, uint32_t I) {
1213 if (!CheckNull(S, OpPC, Obj, CSK_Field))
1215 if (!CheckRange(S, OpPC, Obj, CSK_Field))
1218 if (!CheckLoad(S, OpPC, Field))
1225 bool SetField(InterpState &S, CodePtr OpPC, uint32_t I) {
1228 if (!CheckNull(S, OpPC, Obj, CSK_Field))
1230 if (!CheckRange(S, OpPC, Obj, CSK_Field))
1233 if (!CheckStore(S, OpPC, Field))
1243 bool GetFieldPop(InterpState &S, CodePtr OpPC, uint32_t I) {
1245 if (!CheckNull(S, OpPC, Obj, CSK_Field))
1247 if (!CheckRange(S, OpPC, Obj, CSK_Field))
1250 if (!CheckLoad(S, OpPC, Field))
1257 bool GetThisField(InterpState &S, CodePtr OpPC, uint32_t I) {
1261 if (!CheckThis(S, OpPC, This))
1264 if (!CheckLoad(S, OpPC, Field))
1271 bool SetThisField(InterpState &S, CodePtr OpPC, uint32_t I) {
1276 if (!CheckThis(S, OpPC, This))
1279 if (!CheckStore(S, OpPC, Field))
1286 bool GetGlobal(InterpState &S, CodePtr OpPC, uint32_t I) {
1288 if (!CheckConstant(S, OpPC, Ptr.getFieldDesc()))
1295 if (!CheckGlobalInitialized(S, OpPC, Ptr))
1304 bool GetGlobalUnchecked(InterpState &S, CodePtr OpPC, uint32_t I) {
1313 bool SetGlobal(InterpState &S, CodePtr OpPC, uint32_t I) {
1319 bool InitGlobal(InterpState &S, CodePtr OpPC, uint32_t I) {
1330 bool InitGlobalTemp(InterpState &S, CodePtr OpPC, uint32_t I,
1352 inline bool InitGlobalTempComp(InterpState &S, CodePtr OpPC,
1371 bool InitThisField(InterpState &S, CodePtr OpPC, uint32_t I) {
1375 if (!CheckThis(S, OpPC, This))
1386 bool InitThisBitField(InterpState &S, CodePtr OpPC, const Record::Field *F,
1392 if (!CheckThis(S, OpPC, This))
1402 bool InitThisFieldActive(InterpState &S, CodePtr OpPC, uint32_t I) {
1406 if (!CheckThis(S, OpPC, This))
1419 bool InitField(InterpState &S, CodePtr OpPC, uint32_t I) {
1429 bool InitBitField(InterpState &S, CodePtr OpPC, const Record::Field *F) {
1440 bool InitFieldActive(InterpState &S, CodePtr OpPC, uint32_t I) {
1454 inline bool GetPtrLocal(InterpState &S, CodePtr OpPC, uint32_t I) {
1459 inline bool GetPtrParam(InterpState &S, CodePtr OpPC, uint32_t I) {
1467 inline bool GetPtrGlobal(InterpState &S, CodePtr OpPC, uint32_t I) {
1474 inline bool GetPtrField(InterpState &S, CodePtr OpPC, uint32_t Off) {
1478 !CheckNull(S, OpPC, Ptr, CSK_Field))
1481 if (!CheckExtern(S, OpPC, Ptr))
1483 if (!CheckRange(S, OpPC, Ptr, CSK_Field))
1485 if (!CheckArray(S, OpPC, Ptr))
1487 if (!CheckSubobject(S, OpPC, Ptr, CSK_Field))
1496 inline bool GetPtrFieldPop(InterpState &S, CodePtr OpPC, uint32_t Off) {
1500 !CheckNull(S, OpPC, Ptr, CSK_Field))
1503 if (!CheckExtern(S, OpPC, Ptr))
1505 if (!CheckRange(S, OpPC, Ptr, CSK_Field))
1507 if (!CheckArray(S, OpPC, Ptr))
1509 if (!CheckSubobject(S, OpPC, Ptr, CSK_Field))
1519 inline bool GetPtrThisField(InterpState &S, CodePtr OpPC, uint32_t Off) {
1523 if (!CheckThis(S, OpPC, This))
1529 inline bool GetPtrActiveField(InterpState &S, CodePtr OpPC, uint32_t Off) {
1531 if (!CheckNull(S, OpPC, Ptr, CSK_Field))
1533 if (!CheckRange(S, OpPC, Ptr, CSK_Field))
1542 inline bool GetPtrActiveThisField(InterpState &S, CodePtr OpPC, uint32_t Off) {
1546 if (!CheckThis(S, OpPC, This))
1555 inline bool GetPtrDerivedPop(InterpState &S, CodePtr OpPC, uint32_t Off) {
1557 if (!CheckNull(S, OpPC, Ptr, CSK_Derived))
1559 if (!CheckSubobject(S, OpPC, Ptr, CSK_Derived))
1561 if (!CheckDowncast(S, OpPC, Ptr, Off))
1568 inline bool GetPtrBase(InterpState &S, CodePtr OpPC, uint32_t Off) {
1570 if (!CheckNull(S, OpPC, Ptr, CSK_Base))
1572 if (!CheckSubobject(S, OpPC, Ptr, CSK_Base))
1578 inline bool GetPtrBasePop(InterpState &S, CodePtr OpPC, uint32_t Off) {
1580 if (!CheckNull(S, OpPC, Ptr, CSK_Base))
1582 if (!CheckSubobject(S, OpPC, Ptr, CSK_Base))
1588 inline bool GetMemberPtrBasePop(InterpState &S, CodePtr OpPC, int32_t Off) {
1594 inline bool GetPtrThisBase(InterpState &S, CodePtr OpPC, uint32_t Off) {
1598 if (!CheckThis(S, OpPC, This))
1604 inline bool FinishInitPop(InterpState &S, CodePtr OpPC) {
1613 inline bool FinishInit(InterpState &S, CodePtr OpPC) {
1622 inline bool Dump(InterpState &S, CodePtr OpPC) {
1627 inline bool VirtBaseHelper(InterpState &S, CodePtr OpPC, const RecordDecl *Decl,
1638 inline bool GetPtrVirtBasePop(InterpState &S, CodePtr OpPC,
1642 if (!CheckNull(S, OpPC, Ptr, CSK_Base))
1644 return VirtBaseHelper(S, OpPC, D, Ptr);
1647 inline bool GetPtrThisVirtBase(InterpState &S, CodePtr OpPC,
1653 if (!CheckThis(S, OpPC, This))
1655 return VirtBaseHelper(S, OpPC, D, S.Current->getThis());
1663 bool Load(InterpState &S, CodePtr OpPC) {
1665 if (!CheckLoad(S, OpPC, Ptr))
1674 bool LoadPop(InterpState &S, CodePtr OpPC) {
1676 if (!CheckLoad(S, OpPC, Ptr))
1685 bool Store(InterpState &S, CodePtr OpPC) {
1688 if (!CheckStore(S, OpPC, Ptr))
1697 bool StorePop(InterpState &S, CodePtr OpPC) {
1700 if (!CheckStore(S, OpPC, Ptr))
1709 bool StoreBitField(InterpState &S, CodePtr OpPC) {
1712 if (!CheckStore(S, OpPC, Ptr))
1724 bool StoreBitFieldPop(InterpState &S, CodePtr OpPC) {
1727 if (!CheckStore(S, OpPC, Ptr))
1739 bool Init(InterpState &S, CodePtr OpPC) {
1742 if (!CheckInit(S, OpPC, Ptr)) {
1752 bool InitPop(InterpState &S, CodePtr OpPC) {
1755 if (!CheckInit(S, OpPC, Ptr))
1766 bool InitElem(InterpState &S, CodePtr OpPC, uint32_t Idx) {
1771 if (!CheckInit(S, OpPC, Ptr))
1780 bool InitElemPop(InterpState &S, CodePtr OpPC, uint32_t Idx) {
1785 if (!CheckInit(S, OpPC, Ptr))
1792 inline bool Memcpy(InterpState &S, CodePtr OpPC) {
1796 if (!CheckLoad(S, OpPC, Src))
1799 return DoMemcpy(S, OpPC, Src, Dest);
1802 inline bool ToMemberPtr(InterpState &S, CodePtr OpPC) {
1810 inline bool CastMemberPtrPtr(InterpState &S, CodePtr OpPC) {
1825 bool OffsetHelper(InterpState &S, CodePtr OpPC, const T &Offset,
1833 if (!CheckNull(S, OpPC, Ptr, CSK_ArrayIndex)) {
1841 if (!CheckArray(S, OpPC, Ptr))
1860 S.CCEDiag(S.Current->getSource(OpPC), diag::note_constexpr_array_index)
1914 bool AddOffset(InterpState &S, CodePtr OpPC) {
1917 return OffsetHelper<T, ArithOp::Add>(S, OpPC, Offset, Ptr);
1921 bool SubOffset(InterpState &S, CodePtr OpPC) {
1924 return OffsetHelper<T, ArithOp::Sub>(S, OpPC, Offset, Ptr);
1928 static inline bool IncDecPtrHelper(InterpState &S, CodePtr OpPC,
1936 if (!CheckNull(S, OpPC, P, CSK_ArrayIndex))
1944 if (!OffsetHelper<OneT, Op>(S, OpPC, One, P))
1952 static inline bool IncPtr(InterpState &S, CodePtr OpPC) {
1955 if (!CheckInitialized(S, OpPC, Ptr, AK_Increment))
1958 return IncDecPtrHelper<ArithOp::Add>(S, OpPC, Ptr);
1961 static inline bool DecPtr(InterpState &S, CodePtr OpPC) {
1964 if (!CheckInitialized(S, OpPC, Ptr, AK_Decrement))
1967 return IncDecPtrHelper<ArithOp::Sub>(S, OpPC, Ptr);
1974 inline bool SubPtr(InterpState &S, CodePtr OpPC) {
1997 return AddSubMulHelper<T, T::sub, std::minus>(S, OpPC, A.bitWidth(), A, B);
2004 inline bool Destroy(InterpState &S, CodePtr OpPC, uint32_t I) {
2013 template <PrimType TIn, PrimType TOut> bool Cast(InterpState &S, CodePtr OpPC) {
2022 inline bool CastFP(InterpState &S, CodePtr OpPC, const llvm::fltSemantics *Sem,
2033 bool CastAP(InterpState &S, CodePtr OpPC, uint32_t BitWidth) {
2040 bool CastAPS(InterpState &S, CodePtr OpPC, uint32_t BitWidth) {
2047 bool CastIntegralFloating(InterpState &S, CodePtr OpPC,
2057 return CheckFloatResult(S, OpPC, Result, Status);
2061 bool CastFloatingIntegral(InterpState &S, CodePtr OpPC) {
2074 const Expr *E = S.Current->getExpr(OpPC);
2086 return CheckFloatResult(S, OpPC, F, Status);
2090 static inline bool CastFloatingIntegralAP(InterpState &S, CodePtr OpPC,
2099 const Expr *E = S.Current->getExpr(OpPC);
2107 return CheckFloatResult(S, OpPC, F, Status);
2110 static inline bool CastFloatingIntegralAPS(InterpState &S, CodePtr OpPC,
2119 const Expr *E = S.Current->getExpr(OpPC);
2127 return CheckFloatResult(S, OpPC, F, Status);
2131 bool CastPointerIntegral(InterpState &S, CodePtr OpPC) {
2137 const SourceInfo &E = S.Current->getSource(OpPC);
2139 << 2 << S.getLangOpts().CPlusPlus << S.Current->getRange(OpPC);
2145 static inline bool CastPointerIntegralAP(InterpState &S, CodePtr OpPC,
2152 const SourceInfo &E = S.Current->getSource(OpPC);
2154 << 2 << S.getLangOpts().CPlusPlus << S.Current->getRange(OpPC);
2161 static inline bool CastPointerIntegralAPS(InterpState &S, CodePtr OpPC,
2168 const SourceInfo &E = S.Current->getSource(OpPC);
2170 << 2 << S.getLangOpts().CPlusPlus << S.Current->getRange(OpPC);
2177 static inline bool PtrPtrCast(InterpState &S, CodePtr OpPC, bool SrcIsVoidPtr) {
2186 const SourceInfo &E = S.Current->getSource(OpPC);
2188 << 3 << "'void *'" << S.Current->getRange(OpPC);
2191 const SourceInfo &E = S.Current->getSource(OpPC);
2193 << 2 << S.getLangOpts().CPlusPlus << S.Current->getRange(OpPC);
2204 bool Zero(InterpState &S, CodePtr OpPC) {
2209 static inline bool ZeroIntAP(InterpState &S, CodePtr OpPC, uint32_t BitWidth) {
2214 static inline bool ZeroIntAPS(InterpState &S, CodePtr OpPC, uint32_t BitWidth) {
2220 inline bool Null(InterpState &S, CodePtr OpPC, const Descriptor *Desc) {
2230 inline bool This(InterpState &S, CodePtr OpPC) {
2237 if (!CheckThis(S, OpPC, This))
2253 inline bool RVOPtr(InterpState &S, CodePtr OpPC) {
2267 inline bool DoShift(InterpState &S, CodePtr OpPC, LT &LHS, RT &RHS) {
2278 const SourceInfo &Loc = S.Current->getSource(OpPC);
2285 : ShiftDir::Left > (S, OpPC, LHS, RHS);
2294 const SourceInfo &Loc = S.Current->getSource(OpPC);
2301 if (!CheckShift(S, OpPC, LHS, RHS, Bits))
2329 inline bool Shr(InterpState &S, CodePtr OpPC) {
2335 return DoShift<LT, RT, ShiftDir::Right>(S, OpPC, LHS, RHS);
2339 inline bool Shl(InterpState &S, CodePtr OpPC) {
2345 return DoShift<LT, RT, ShiftDir::Left>(S, OpPC, LHS, RHS);
2352 inline bool NoRet(InterpState &S, CodePtr OpPC) {
2362 inline bool NarrowPtr(InterpState &S, CodePtr OpPC) {
2368 inline bool ExpandPtr(InterpState &S, CodePtr OpPC) {
2383 inline bool ArrayElemPtr(InterpState &S, CodePtr OpPC) {
2388 if (!CheckArray(S, OpPC, Ptr))
2392 if (!OffsetHelper<T, ArithOp::Add>(S, OpPC, Offset, Ptr))
2395 return NarrowPtr(S, OpPC);
2399 inline bool ArrayElemPtrPop(InterpState &S, CodePtr OpPC) {
2404 if (!CheckArray(S, OpPC, Ptr))
2408 if (!OffsetHelper<T, ArithOp::Add>(S, OpPC, Offset, Ptr))
2411 return NarrowPtr(S, OpPC);
2415 inline bool ArrayElem(InterpState &S, CodePtr OpPC, uint32_t Index) {
2418 if (!CheckLoad(S, OpPC, Ptr))
2426 inline bool ArrayElemPop(InterpState &S, CodePtr OpPC, uint32_t Index) {
2429 if (!CheckLoad(S, OpPC, Ptr))
2437 inline bool CopyArray(InterpState &S, CodePtr OpPC, uint32_t SrcIndex, uint32_t DestIndex, uint32_t Size) {
2444 if (!CheckLoad(S, OpPC, SP))
2456 inline bool ArrayDecay(InterpState &S, CodePtr OpPC) {
2464 if (!CheckRange(S, OpPC, Ptr, CSK_ArrayToPointer))
2472 const SourceInfo &E = S.Current->getSource(OpPC);
2478 inline bool CallVar(InterpState &S, CodePtr OpPC, const Function *Func,
2492 if (!CheckInvoke(S, OpPC, ThisPtr))
2500 if (!CheckCallable(S, OpPC, Func))
2503 if (!CheckCallDepth(S, OpPC))
2506 auto NewFrame = std::make_unique<InterpFrame>(S, Func, OpPC, VarArgSize);
2528 inline bool Call(InterpState &S, CodePtr OpPC, const Function *Func,
2543 if (!CheckInvoke(S, OpPC, ThisPtr))
2548 if (!CheckCallable(S, OpPC, Func))
2554 if (!CheckCallDepth(S, OpPC))
2557 auto NewFrame = std::make_unique<InterpFrame>(S, Func, OpPC, VarArgSize);
2577 inline bool CallVirt(InterpState &S, CodePtr OpPC, const Function *Func,
2601 const Expr *E = S.Current->getExpr(OpPC);
2617 return Call(S, OpPC, Func, VarArgSize);
2635 inline bool CallPtr(InterpState &S, CodePtr OpPC, uint32_t ArgSize,
2641 const Expr *E = S.Current->getExpr(OpPC);
2660 if (!CheckNonNullArgs(S, OpPC, F, CE, ArgSize))
2673 return CallVirt(S, OpPC, F, VarArgSize);
2675 return Call(S, OpPC, F, VarArgSize);
2678 inline bool GetFnPtr(InterpState &S, CodePtr OpPC, const Function *Func) {
2685 inline bool GetIntPtr(InterpState &S, CodePtr OpPC, const Descriptor *Desc) {
2692 inline bool GetMemberPtr(InterpState &S, CodePtr OpPC, const Decl *D) {
2697 inline bool GetMemberPtrBase(InterpState &S, CodePtr OpPC) {
2704 inline bool GetMemberPtrDecl(InterpState &S, CodePtr OpPC) {
2716 inline bool Invalid(InterpState &S, CodePtr OpPC) {
2717 const SourceLocation &Loc = S.Current->getLocation(OpPC);
2719 << S.Current->getRange(OpPC);
2723 inline bool Unsupported(InterpState &S, CodePtr OpPC) {
2724 const SourceLocation &Loc = S.Current->getLocation(OpPC);
2726 << S.Current->getRange(OpPC);
2731 inline bool Error(InterpState &S, CodePtr OpPC) { return false; }
2734 inline bool InvalidCast(InterpState &S, CodePtr OpPC, CastKind Kind) {
2735 const SourceLocation &Loc = S.Current->getLocation(OpPC);
2740 << static_cast<unsigned>(Kind) << S.Current->getRange(OpPC);
2744 inline bool InvalidDeclRef(InterpState &S, CodePtr OpPC,
2747 return CheckDeclRef(S, OpPC, DR);
2750 inline bool SizelessVectorElementSize(InterpState &S, CodePtr OpPC) {
2752 const SourceRange &ArgRange = S.Current->getRange(OpPC);
2753 const Expr *E = S.Current->getExpr(OpPC);
2759 inline bool Assume(InterpState &S, CodePtr OpPC) {
2766 const SourceLocation &Loc = S.Current->getLocation(OpPC);
2772 inline bool OffsetOf(InterpState &S, CodePtr OpPC, const OffsetOfExpr *E) {
2778 if (!InterpretOffsetOf(S, OpPC, E, ArrayIndices, Result))
2787 inline bool CheckNonNullArg(InterpState &S, CodePtr OpPC) {
2792 const SourceLocation &Loc = S.Current->getLocation(OpPC);
2798 void diagnoseEnumValue(InterpState &S, CodePtr OpPC, const EnumDecl *ED,
2802 inline bool CheckEnumValue(InterpState &S, CodePtr OpPC, const EnumDecl *ED) {
2808 diagnoseEnumValue(S, OpPC, ED, Val);
2814 inline bool DecayPtr(InterpState &S, CodePtr OpPC) {
2824 inline bool CheckDecl(InterpState &S, CodePtr OpPC, const VarDecl *VD) {
2843 inline bool Alloc(InterpState &S, CodePtr OpPC, const Descriptor *Desc) {
2846 if (!CheckDynamicMemoryAllocation(S, OpPC))
2859 inline bool AllocN(InterpState &S, CodePtr OpPC, PrimType T, const Expr *Source,
2861 if (!CheckDynamicMemoryAllocation(S, OpPC))
2865 if (!CheckArraySize(S, OpPC, &NumElements, primSize(T), IsNoThrow)) {
2884 inline bool AllocCN(InterpState &S, CodePtr OpPC, const Descriptor *ElementDesc,
2886 if (!CheckDynamicMemoryAllocation(S, OpPC))
2890 if (!CheckArraySize(S, OpPC, &NumElements, ElementDesc->getSize(),
2910 bool RunDestructors(InterpState &S, CodePtr OpPC, const Block *B);
2911 static inline bool Free(InterpState &S, CodePtr OpPC, bool DeleteIsArrayForm) {
2912 if (!CheckDynamicMemoryAllocation(S, OpPC))
2927 const SourceInfo &Loc = S.Current->getSource(OpPC);
2936 if (!CheckDeleteSource(S, OpPC, Source, Ptr))
2943 if (!RunDestructors(S, OpPC, BlockToDelete))
2952 const SourceInfo &Loc = S.Current->getSource(OpPC);
2956 return CheckNewDeleteForms(S, OpPC, WasArrayAlloc, DeleteIsArrayForm,
2964 template <typename T> inline T ReadArg(InterpState &S, CodePtr &OpPC) {
2966 uint32_t ID = OpPC.read<uint32_t>();
2969 return OpPC.read<T>();
2973 template <> inline Floating ReadArg<Floating>(InterpState &S, CodePtr &OpPC) {
2974 Floating F = Floating::deserialize(*OpPC);
2975 OpPC += align(F.bytesToSerialize());
2981 CodePtr &OpPC) {
2982 IntegralAP<false> I = IntegralAP<false>::deserialize(*OpPC);
2983 OpPC += align(I.bytesToSerialize());
2989 CodePtr &OpPC) {
2990 IntegralAP<true> I = IntegralAP<true>::deserialize(*OpPC);
2991 OpPC += align(I.bytesToSerialize());