@@ -41,7 +41,7 @@ using APSInt = llvm::APSInt;
4141// / Convert a value to an APValue.
4242template <typename T>
4343bool ReturnValue (const InterpState &S, const T &V, APValue &R) {
44- R = V.toAPValue (S.getCtx ());
44+ R = V.toAPValue (S.getASTContext ());
4545 return true ;
4646}
4747
@@ -231,12 +231,12 @@ bool CheckArraySize(InterpState &S, CodePtr OpPC, SizeT *NumElements,
231231 // constructing the array, we catch this here.
232232 SizeT MaxElements = SizeT::from (Descriptor::MaxArrayElemBytes / ElemSize);
233233 if (NumElements->toAPSInt ().getActiveBits () >
234- ConstantArrayType::getMaxSizeBits (S.getCtx ()) ||
234+ ConstantArrayType::getMaxSizeBits (S.getASTContext ()) ||
235235 *NumElements > MaxElements) {
236236 if (!IsNoThrow) {
237237 const SourceInfo &Loc = S.Current ->getSource (OpPC);
238238 S.FFDiag (Loc, diag::note_constexpr_new_too_large)
239- << NumElements->toDiagnosticString (S.getCtx ());
239+ << NumElements->toDiagnosticString (S.getASTContext ());
240240 }
241241 return false ;
242242 }
@@ -911,8 +911,8 @@ inline bool CmpHelper<FunctionPointer>(InterpState &S, CodePtr OpPC,
911911
912912 const SourceInfo &Loc = S.Current ->getSource (OpPC);
913913 S.FFDiag (Loc, diag::note_constexpr_pointer_comparison_unspecified)
914- << LHS.toDiagnosticString (S.getCtx ())
915- << RHS.toDiagnosticString (S.getCtx ());
914+ << LHS.toDiagnosticString (S.getASTContext ())
915+ << RHS.toDiagnosticString (S.getASTContext ());
916916 return false ;
917917}
918918
@@ -927,7 +927,7 @@ inline bool CmpHelperEQ<FunctionPointer>(InterpState &S, CodePtr OpPC,
927927 if (FP.isWeak ()) {
928928 const SourceInfo &Loc = S.Current ->getSource (OpPC);
929929 S.FFDiag (Loc, diag::note_constexpr_pointer_weak_comparison)
930- << FP.toDiagnosticString (S.getCtx ());
930+ << FP.toDiagnosticString (S.getASTContext ());
931931 return false ;
932932 }
933933 }
@@ -945,8 +945,8 @@ inline bool CmpHelper<Pointer>(InterpState &S, CodePtr OpPC, CompareFn Fn) {
945945 if (!Pointer::hasSameBase (LHS, RHS)) {
946946 const SourceInfo &Loc = S.Current ->getSource (OpPC);
947947 S.FFDiag (Loc, diag::note_constexpr_pointer_comparison_unspecified)
948- << LHS.toDiagnosticString (S.getCtx ())
949- << RHS.toDiagnosticString (S.getCtx ());
948+ << LHS.toDiagnosticString (S.getASTContext ())
949+ << RHS.toDiagnosticString (S.getASTContext ());
950950 return false ;
951951 } else {
952952 unsigned VL = LHS.getByteOffset ();
@@ -974,7 +974,7 @@ inline bool CmpHelperEQ<Pointer>(InterpState &S, CodePtr OpPC, CompareFn Fn) {
974974 if (P.isWeak ()) {
975975 const SourceInfo &Loc = S.Current ->getSource (OpPC);
976976 S.FFDiag (Loc, diag::note_constexpr_pointer_weak_comparison)
977- << P.toDiagnosticString (S.getCtx ());
977+ << P.toDiagnosticString (S.getASTContext ());
978978 return false ;
979979 }
980980 }
@@ -984,13 +984,13 @@ inline bool CmpHelperEQ<Pointer>(InterpState &S, CodePtr OpPC, CompareFn Fn) {
984984 RHS.getOffset () == 0 ) {
985985 const SourceInfo &Loc = S.Current ->getSource (OpPC);
986986 S.FFDiag (Loc, diag::note_constexpr_pointer_comparison_past_end)
987- << LHS.toDiagnosticString (S.getCtx ());
987+ << LHS.toDiagnosticString (S.getASTContext ());
988988 return false ;
989989 } else if (RHS.isOnePastEnd () && !LHS.isOnePastEnd () && !LHS.isZero () &&
990990 LHS.getOffset () == 0 ) {
991991 const SourceInfo &Loc = S.Current ->getSource (OpPC);
992992 S.FFDiag (Loc, diag::note_constexpr_pointer_comparison_past_end)
993- << RHS.toDiagnosticString (S.getCtx ());
993+ << RHS.toDiagnosticString (S.getASTContext ());
994994 return false ;
995995 }
996996
@@ -1073,8 +1073,8 @@ bool CMP3(InterpState &S, CodePtr OpPC, const ComparisonCategoryInfo *CmpInfo) {
10731073 // This should only happen with pointers.
10741074 const SourceInfo &Loc = S.Current ->getSource (OpPC);
10751075 S.FFDiag (Loc, diag::note_constexpr_pointer_comparison_unspecified)
1076- << LHS.toDiagnosticString (S.getCtx ())
1077- << RHS.toDiagnosticString (S.getCtx ());
1076+ << LHS.toDiagnosticString (S.getASTContext ())
1077+ << RHS.toDiagnosticString (S.getASTContext ());
10781078 return false ;
10791079 }
10801080
@@ -1342,7 +1342,7 @@ bool InitGlobalTemp(InterpState &S, CodePtr OpPC, uint32_t I,
13421342 const Pointer &Ptr = S.P .getGlobal (I);
13431343
13441344 const T Value = S.Stk .peek <T>();
1345- APValue APV = Value.toAPValue (S.getCtx ());
1345+ APValue APV = Value.toAPValue (S.getASTContext ());
13461346 APValue *Cached = Temp->getOrCreateValue (true );
13471347 *Cached = APV;
13481348
@@ -1369,7 +1369,7 @@ inline bool InitGlobalTempComp(InterpState &S, CodePtr OpPC,
13691369 std::make_pair (P.getDeclDesc ()->asExpr (), Temp));
13701370
13711371 if (std::optional<APValue> APV =
1372- P.toRValue (S.getCtx (), Temp->getTemporaryExpr ()->getType ())) {
1372+ P.toRValue (S.getASTContext (), Temp->getTemporaryExpr ()->getType ())) {
13731373 *Cached = *APV;
13741374 return true ;
13751375 }
@@ -1404,7 +1404,8 @@ bool InitThisBitField(InterpState &S, CodePtr OpPC, const Record::Field *F,
14041404 return false ;
14051405 const Pointer &Field = This.atField (FieldOffset);
14061406 const auto &Value = S.Stk .pop <T>();
1407- Field.deref <T>() = Value.truncate (F->Decl ->getBitWidthValue (S.getCtx ()));
1407+ Field.deref <T>() =
1408+ Value.truncate (F->Decl ->getBitWidthValue (S.getASTContext ()));
14081409 Field.initialize ();
14091410 return true ;
14101411}
@@ -1427,7 +1428,8 @@ bool InitBitField(InterpState &S, CodePtr OpPC, const Record::Field *F) {
14271428 assert (F->isBitField ());
14281429 const T &Value = S.Stk .pop <T>();
14291430 const Pointer &Field = S.Stk .peek <Pointer>().atField (F->Offset );
1430- Field.deref <T>() = Value.truncate (F->Decl ->getBitWidthValue (S.getCtx ()));
1431+ Field.deref <T>() =
1432+ Value.truncate (F->Decl ->getBitWidthValue (S.getASTContext ()));
14311433 Field.activate ();
14321434 Field.initialize ();
14331435 return true ;
@@ -1477,7 +1479,7 @@ inline bool GetPtrField(InterpState &S, CodePtr OpPC, uint32_t Off) {
14771479 return false ;
14781480
14791481 if (Ptr.isIntegralPointer ()) {
1480- S.Stk .push <Pointer>(Ptr.asIntPointer ().atOffset (S.getCtx (), Off));
1482+ S.Stk .push <Pointer>(Ptr.asIntPointer ().atOffset (S.getASTContext (), Off));
14811483 return true ;
14821484 }
14831485
@@ -1505,7 +1507,7 @@ inline bool GetPtrFieldPop(InterpState &S, CodePtr OpPC, uint32_t Off) {
15051507 return false ;
15061508
15071509 if (Ptr.isIntegralPointer ()) {
1508- S.Stk .push <Pointer>(Ptr.asIntPointer ().atOffset (S.getCtx (), Off));
1510+ S.Stk .push <Pointer>(Ptr.asIntPointer ().atOffset (S.getASTContext (), Off));
15091511 return true ;
15101512 }
15111513
@@ -1721,7 +1723,7 @@ bool StoreBitField(InterpState &S, CodePtr OpPC) {
17211723 if (Ptr.canBeInitialized ())
17221724 Ptr.initialize ();
17231725 if (const auto *FD = Ptr.getField ())
1724- Ptr.deref <T>() = Value.truncate (FD->getBitWidthValue (S.getCtx ()));
1726+ Ptr.deref <T>() = Value.truncate (FD->getBitWidthValue (S.getASTContext ()));
17251727 else
17261728 Ptr.deref <T>() = Value;
17271729 return true ;
@@ -1736,7 +1738,7 @@ bool StoreBitFieldPop(InterpState &S, CodePtr OpPC) {
17361738 if (Ptr.canBeInitialized ())
17371739 Ptr.initialize ();
17381740 if (const auto *FD = Ptr.getField ())
1739- Ptr.deref <T>() = Value.truncate (FD->getBitWidthValue (S.getCtx ()));
1741+ Ptr.deref <T>() = Value.truncate (FD->getBitWidthValue (S.getASTContext ()));
17401742 else
17411743 Ptr.deref <T>() = Value;
17421744 return true ;
@@ -2014,7 +2016,7 @@ inline bool SubPtr(InterpState &S, CodePtr OpPC) {
20142016 while (auto *AT = dyn_cast<ArrayType>(PtrT))
20152017 PtrT = AT->getElementType ();
20162018
2017- QualType ArrayTy = S.getCtx ().getConstantArrayType (
2019+ QualType ArrayTy = S.getASTContext ().getConstantArrayType (
20182020 PtrT, APInt::getZero (1 ), nullptr , ArraySizeModifier::Normal, 0 );
20192021 S.FFDiag (S.Current ->getSource (OpPC),
20202022 diag::note_constexpr_pointer_subtraction_zero_size)
@@ -2953,7 +2955,7 @@ inline bool CheckDecl(InterpState &S, CodePtr OpPC, const VarDecl *VD) {
29532955 if (VD == S.EvaluatingDecl )
29542956 return true ;
29552957
2956- if (!VD->isUsableInConstantExpressions (S.getCtx ())) {
2958+ if (!VD->isUsableInConstantExpressions (S.getASTContext ())) {
29572959 S.CCEDiag (VD->getLocation (), diag::note_constexpr_static_local)
29582960 << (VD->getTSCSpec () == TSCS_unspecified ? 0 : 1 ) << VD;
29592961 return false ;
@@ -3047,7 +3049,7 @@ static inline bool Free(InterpState &S, CodePtr OpPC, bool DeleteIsArrayForm) {
30473049 if (!Ptr.isRoot () || Ptr.isOnePastEnd () || Ptr.isArrayElement ()) {
30483050 const SourceInfo &Loc = S.Current ->getSource (OpPC);
30493051 S.FFDiag (Loc, diag::note_constexpr_delete_subobject)
3050- << Ptr.toDiagnosticString (S.getCtx ()) << Ptr.isOnePastEnd ();
3052+ << Ptr.toDiagnosticString (S.getASTContext ()) << Ptr.isOnePastEnd ();
30513053 return false ;
30523054 }
30533055
0 commit comments