Lines Matching refs:S
34 static bool Ret(InterpState &S, CodePtr &PC, APValue &Result) { in Ret() argument
35 S.CallStackDepth--; in Ret()
36 const T &Ret = S.Stk.pop<T>(); in Ret()
38 assert(S.Current->getFrameOffset() == S.Stk.size() && "Invalid frame"); in Ret()
39 if (!S.checkingPotentialConstantExpression()) in Ret()
40 S.Current->popArgs(); in Ret()
42 if (InterpFrame *Caller = S.Current->Caller) { in Ret()
43 PC = S.Current->getRetPC(); in Ret()
44 delete S.Current; in Ret()
45 S.Current = Caller; in Ret()
46 S.Stk.push<T>(Ret); in Ret()
48 delete S.Current; in Ret()
49 S.Current = nullptr; in Ret()
56 static bool RetVoid(InterpState &S, CodePtr &PC, APValue &Result) { in RetVoid() argument
57 S.CallStackDepth--; in RetVoid()
59 assert(S.Current->getFrameOffset() == S.Stk.size() && "Invalid frame"); in RetVoid()
60 if (!S.checkingPotentialConstantExpression()) in RetVoid()
61 S.Current->popArgs(); in RetVoid()
63 if (InterpFrame *Caller = S.Current->Caller) { in RetVoid()
64 PC = S.Current->getRetPC(); in RetVoid()
65 delete S.Current; in RetVoid()
66 S.Current = Caller; in RetVoid()
68 delete S.Current; in RetVoid()
69 S.Current = nullptr; in RetVoid()
74 static bool RetValue(InterpState &S, CodePtr &Pt, APValue &Result) { in RetValue() argument
82 static bool Jmp(InterpState &S, CodePtr &PC, int32_t Offset) { in Jmp() argument
87 static bool Jt(InterpState &S, CodePtr &PC, int32_t Offset) { in Jt() argument
88 if (S.Stk.pop<bool>()) { in Jt()
94 static bool Jf(InterpState &S, CodePtr &PC, int32_t Offset) { in Jf() argument
95 if (!S.Stk.pop<bool>()) { in Jf()
101 static bool CheckInitialized(InterpState &S, CodePtr OpPC, const Pointer &Ptr, in CheckInitialized() argument
105 if (!S.checkingPotentialConstantExpression()) { in CheckInitialized()
106 const SourceInfo &Loc = S.Current->getSource(OpPC); in CheckInitialized()
107 S.FFDiag(Loc, diag::note_constexpr_access_uninit) << AK << false; in CheckInitialized()
112 static bool CheckActive(InterpState &S, CodePtr OpPC, const Pointer &Ptr, in CheckActive() argument
138 const SourceInfo &Loc = S.Current->getSource(OpPC); in CheckActive()
139 S.FFDiag(Loc, diag::note_constexpr_access_inactive_union_member) in CheckActive()
144 static bool CheckTemporary(InterpState &S, CodePtr OpPC, const Pointer &Ptr, in CheckTemporary() argument
153 if (S.P.getCurrentDecl() == ID) in CheckTemporary()
156 const SourceInfo &E = S.Current->getSource(OpPC); in CheckTemporary()
157 S.FFDiag(E, diag::note_constexpr_access_static_temporary, 1) << AK; in CheckTemporary()
158 S.Note(Ptr.getDeclLoc(), diag::note_constexpr_temporary_here); in CheckTemporary()
164 static bool CheckGlobal(InterpState &S, CodePtr OpPC, const Pointer &Ptr) { in CheckGlobal() argument
169 if (S.P.getCurrentDecl() == ID) in CheckGlobal()
172 S.FFDiag(S.Current->getLocation(OpPC), diag::note_constexpr_modify_global); in CheckGlobal()
181 bool CheckExtern(InterpState &S, CodePtr OpPC, const Pointer &Ptr) { in CheckExtern() argument
185 if (!S.checkingPotentialConstantExpression()) { in CheckExtern()
187 const SourceInfo &Loc = S.Current->getSource(OpPC); in CheckExtern()
188 S.FFDiag(Loc, diag::note_constexpr_ltor_non_constexpr, 1) << VD; in CheckExtern()
189 S.Note(VD->getLocation(), diag::note_declared_at); in CheckExtern()
194 bool CheckArray(InterpState &S, CodePtr OpPC, const Pointer &Ptr) { in CheckArray() argument
197 const SourceInfo &E = S.Current->getSource(OpPC); in CheckArray()
198 S.FFDiag(E, diag::note_constexpr_unsized_array_indexed); in CheckArray()
202 bool CheckLive(InterpState &S, CodePtr OpPC, const Pointer &Ptr, in CheckLive() argument
204 const auto &Src = S.Current->getSource(OpPC); in CheckLive()
208 S.FFDiag(Src, diag::note_constexpr_null_subobject) << CSK_Field; in CheckLive()
210 S.FFDiag(Src, diag::note_constexpr_access_null) << AK; in CheckLive()
218 S.FFDiag(Src, diag::note_constexpr_lifetime_ended, 1) << AK << !IsTemp; in CheckLive()
221 S.Note(Ptr.getDeclLoc(), diag::note_constexpr_temporary_here); in CheckLive()
223 S.Note(Ptr.getDeclLoc(), diag::note_declared_at); in CheckLive()
231 bool CheckNull(InterpState &S, CodePtr OpPC, const Pointer &Ptr, in CheckNull() argument
235 const SourceInfo &Loc = S.Current->getSource(OpPC); in CheckNull()
236 S.FFDiag(Loc, diag::note_constexpr_null_subobject) << CSK; in CheckNull()
240 bool CheckRange(InterpState &S, CodePtr OpPC, const Pointer &Ptr, in CheckRange() argument
244 const SourceInfo &Loc = S.Current->getSource(OpPC); in CheckRange()
245 S.FFDiag(Loc, diag::note_constexpr_access_past_end) << AK; in CheckRange()
249 bool CheckRange(InterpState &S, CodePtr OpPC, const Pointer &Ptr, in CheckRange() argument
253 const SourceInfo &Loc = S.Current->getSource(OpPC); in CheckRange()
254 S.FFDiag(Loc, diag::note_constexpr_past_end_subobject) << CSK; in CheckRange()
258 bool CheckConst(InterpState &S, CodePtr OpPC, const Pointer &Ptr) { in CheckConst() argument
265 const SourceInfo &Loc = S.Current->getSource(OpPC); in CheckConst()
266 S.FFDiag(Loc, diag::note_constexpr_modify_const_type) << Ty; in CheckConst()
270 bool CheckMutable(InterpState &S, CodePtr OpPC, const Pointer &Ptr) { in CheckMutable() argument
276 const SourceInfo &Loc = S.Current->getSource(OpPC); in CheckMutable()
278 S.FFDiag(Loc, diag::note_constexpr_access_mutable, 1) << AK_Read << Field; in CheckMutable()
279 S.Note(Field->getLocation(), diag::note_declared_at); in CheckMutable()
283 bool CheckLoad(InterpState &S, CodePtr OpPC, const Pointer &Ptr) { in CheckLoad() argument
284 if (!CheckLive(S, OpPC, Ptr, AK_Read)) in CheckLoad()
286 if (!CheckExtern(S, OpPC, Ptr)) in CheckLoad()
288 if (!CheckRange(S, OpPC, Ptr, AK_Read)) in CheckLoad()
290 if (!CheckInitialized(S, OpPC, Ptr, AK_Read)) in CheckLoad()
292 if (!CheckActive(S, OpPC, Ptr, AK_Read)) in CheckLoad()
294 if (!CheckTemporary(S, OpPC, Ptr, AK_Read)) in CheckLoad()
296 if (!CheckMutable(S, OpPC, Ptr)) in CheckLoad()
301 bool CheckStore(InterpState &S, CodePtr OpPC, const Pointer &Ptr) { in CheckStore() argument
302 if (!CheckLive(S, OpPC, Ptr, AK_Assign)) in CheckStore()
304 if (!CheckExtern(S, OpPC, Ptr)) in CheckStore()
306 if (!CheckRange(S, OpPC, Ptr, AK_Assign)) in CheckStore()
308 if (!CheckGlobal(S, OpPC, Ptr)) in CheckStore()
310 if (!CheckConst(S, OpPC, Ptr)) in CheckStore()
315 bool CheckInvoke(InterpState &S, CodePtr OpPC, const Pointer &Ptr) { in CheckInvoke() argument
316 if (!CheckLive(S, OpPC, Ptr, AK_MemberCall)) in CheckInvoke()
318 if (!CheckExtern(S, OpPC, Ptr)) in CheckInvoke()
320 if (!CheckRange(S, OpPC, Ptr, AK_MemberCall)) in CheckInvoke()
325 bool CheckInit(InterpState &S, CodePtr OpPC, const Pointer &Ptr) { in CheckInit() argument
326 if (!CheckLive(S, OpPC, Ptr, AK_Assign)) in CheckInit()
328 if (!CheckRange(S, OpPC, Ptr, AK_Assign)) in CheckInit()
333 bool CheckCallable(InterpState &S, CodePtr OpPC, Function *F) { in CheckCallable() argument
334 const SourceLocation &Loc = S.Current->getLocation(OpPC); in CheckCallable()
337 if (!S.getLangOpts().CPlusPlus20) { in CheckCallable()
338 S.CCEDiag(Loc, diag::note_constexpr_virtual_call); in CheckCallable()
344 if (S.getLangOpts().CPlusPlus11) { in CheckCallable()
360 S.FFDiag(Loc, diag::note_constexpr_invalid_inhctor, 1) in CheckCallable()
363 S.FFDiag(Loc, diag::note_constexpr_invalid_function, 1) in CheckCallable()
365 S.Note(DiagDecl->getLocation(), diag::note_declared_at); in CheckCallable()
367 S.FFDiag(Loc, diag::note_invalid_subexpr_in_const_expr); in CheckCallable()
375 bool CheckThis(InterpState &S, CodePtr OpPC, const Pointer &This) { in CheckThis() argument
379 const SourceInfo &Loc = S.Current->getSource(OpPC); in CheckThis()
385 if (S.getLangOpts().CPlusPlus11) in CheckThis()
386 S.FFDiag(Loc, diag::note_constexpr_this) << IsImplicit; in CheckThis()
388 S.FFDiag(Loc); in CheckThis()
393 bool CheckPure(InterpState &S, CodePtr OpPC, const CXXMethodDecl *MD) { in CheckPure() argument
396 const SourceInfo &E = S.Current->getSource(OpPC); in CheckPure()
397 S.FFDiag(E, diag::note_constexpr_pure_virtual_call, 1) << MD; in CheckPure()
398 S.Note(MD->getLocation(), diag::note_declared_at); in CheckPure()
401 bool Interpret(InterpState &S, APValue &Result) { in Interpret() argument
402 CodePtr PC = S.Current->getPC(); in Interpret()