@@ -41,7 +41,7 @@ using APSInt = llvm::APSInt;
41
41
// / Convert a value to an APValue.
42
42
template <typename T>
43
43
bool ReturnValue (const InterpState &S, const T &V, APValue &R) {
44
- R = V.toAPValue (S.getCtx ());
44
+ R = V.toAPValue (S.getASTContext ());
45
45
return true ;
46
46
}
47
47
@@ -231,12 +231,12 @@ bool CheckArraySize(InterpState &S, CodePtr OpPC, SizeT *NumElements,
231
231
// constructing the array, we catch this here.
232
232
SizeT MaxElements = SizeT::from (Descriptor::MaxArrayElemBytes / ElemSize);
233
233
if (NumElements->toAPSInt ().getActiveBits () >
234
- ConstantArrayType::getMaxSizeBits (S.getCtx ()) ||
234
+ ConstantArrayType::getMaxSizeBits (S.getASTContext ()) ||
235
235
*NumElements > MaxElements) {
236
236
if (!IsNoThrow) {
237
237
const SourceInfo &Loc = S.Current ->getSource (OpPC);
238
238
S.FFDiag (Loc, diag::note_constexpr_new_too_large)
239
- << NumElements->toDiagnosticString (S.getCtx ());
239
+ << NumElements->toDiagnosticString (S.getASTContext ());
240
240
}
241
241
return false ;
242
242
}
@@ -911,8 +911,8 @@ inline bool CmpHelper<FunctionPointer>(InterpState &S, CodePtr OpPC,
911
911
912
912
const SourceInfo &Loc = S.Current ->getSource (OpPC);
913
913
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 ());
916
916
return false ;
917
917
}
918
918
@@ -927,7 +927,7 @@ inline bool CmpHelperEQ<FunctionPointer>(InterpState &S, CodePtr OpPC,
927
927
if (FP.isWeak ()) {
928
928
const SourceInfo &Loc = S.Current ->getSource (OpPC);
929
929
S.FFDiag (Loc, diag::note_constexpr_pointer_weak_comparison)
930
- << FP.toDiagnosticString (S.getCtx ());
930
+ << FP.toDiagnosticString (S.getASTContext ());
931
931
return false ;
932
932
}
933
933
}
@@ -945,8 +945,8 @@ inline bool CmpHelper<Pointer>(InterpState &S, CodePtr OpPC, CompareFn Fn) {
945
945
if (!Pointer::hasSameBase (LHS, RHS)) {
946
946
const SourceInfo &Loc = S.Current ->getSource (OpPC);
947
947
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 ());
950
950
return false ;
951
951
} else {
952
952
unsigned VL = LHS.getByteOffset ();
@@ -974,7 +974,7 @@ inline bool CmpHelperEQ<Pointer>(InterpState &S, CodePtr OpPC, CompareFn Fn) {
974
974
if (P.isWeak ()) {
975
975
const SourceInfo &Loc = S.Current ->getSource (OpPC);
976
976
S.FFDiag (Loc, diag::note_constexpr_pointer_weak_comparison)
977
- << P.toDiagnosticString (S.getCtx ());
977
+ << P.toDiagnosticString (S.getASTContext ());
978
978
return false ;
979
979
}
980
980
}
@@ -984,13 +984,13 @@ inline bool CmpHelperEQ<Pointer>(InterpState &S, CodePtr OpPC, CompareFn Fn) {
984
984
RHS.getOffset () == 0 ) {
985
985
const SourceInfo &Loc = S.Current ->getSource (OpPC);
986
986
S.FFDiag (Loc, diag::note_constexpr_pointer_comparison_past_end)
987
- << LHS.toDiagnosticString (S.getCtx ());
987
+ << LHS.toDiagnosticString (S.getASTContext ());
988
988
return false ;
989
989
} else if (RHS.isOnePastEnd () && !LHS.isOnePastEnd () && !LHS.isZero () &&
990
990
LHS.getOffset () == 0 ) {
991
991
const SourceInfo &Loc = S.Current ->getSource (OpPC);
992
992
S.FFDiag (Loc, diag::note_constexpr_pointer_comparison_past_end)
993
- << RHS.toDiagnosticString (S.getCtx ());
993
+ << RHS.toDiagnosticString (S.getASTContext ());
994
994
return false ;
995
995
}
996
996
@@ -1073,8 +1073,8 @@ bool CMP3(InterpState &S, CodePtr OpPC, const ComparisonCategoryInfo *CmpInfo) {
1073
1073
// This should only happen with pointers.
1074
1074
const SourceInfo &Loc = S.Current ->getSource (OpPC);
1075
1075
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 ());
1078
1078
return false ;
1079
1079
}
1080
1080
@@ -1342,7 +1342,7 @@ bool InitGlobalTemp(InterpState &S, CodePtr OpPC, uint32_t I,
1342
1342
const Pointer &Ptr = S.P .getGlobal (I);
1343
1343
1344
1344
const T Value = S.Stk .peek <T>();
1345
- APValue APV = Value.toAPValue (S.getCtx ());
1345
+ APValue APV = Value.toAPValue (S.getASTContext ());
1346
1346
APValue *Cached = Temp->getOrCreateValue (true );
1347
1347
*Cached = APV;
1348
1348
@@ -1369,7 +1369,7 @@ inline bool InitGlobalTempComp(InterpState &S, CodePtr OpPC,
1369
1369
std::make_pair (P.getDeclDesc ()->asExpr (), Temp));
1370
1370
1371
1371
if (std::optional<APValue> APV =
1372
- P.toRValue (S.getCtx (), Temp->getTemporaryExpr ()->getType ())) {
1372
+ P.toRValue (S.getASTContext (), Temp->getTemporaryExpr ()->getType ())) {
1373
1373
*Cached = *APV;
1374
1374
return true ;
1375
1375
}
@@ -1404,7 +1404,8 @@ bool InitThisBitField(InterpState &S, CodePtr OpPC, const Record::Field *F,
1404
1404
return false ;
1405
1405
const Pointer &Field = This.atField (FieldOffset);
1406
1406
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 ()));
1408
1409
Field.initialize ();
1409
1410
return true ;
1410
1411
}
@@ -1427,7 +1428,8 @@ bool InitBitField(InterpState &S, CodePtr OpPC, const Record::Field *F) {
1427
1428
assert (F->isBitField ());
1428
1429
const T &Value = S.Stk .pop <T>();
1429
1430
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 ()));
1431
1433
Field.activate ();
1432
1434
Field.initialize ();
1433
1435
return true ;
@@ -1477,7 +1479,7 @@ inline bool GetPtrField(InterpState &S, CodePtr OpPC, uint32_t Off) {
1477
1479
return false ;
1478
1480
1479
1481
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));
1481
1483
return true ;
1482
1484
}
1483
1485
@@ -1505,7 +1507,7 @@ inline bool GetPtrFieldPop(InterpState &S, CodePtr OpPC, uint32_t Off) {
1505
1507
return false ;
1506
1508
1507
1509
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));
1509
1511
return true ;
1510
1512
}
1511
1513
@@ -1721,7 +1723,7 @@ bool StoreBitField(InterpState &S, CodePtr OpPC) {
1721
1723
if (Ptr .canBeInitialized ())
1722
1724
Ptr .initialize ();
1723
1725
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 ()));
1725
1727
else
1726
1728
Ptr .deref <T>() = Value;
1727
1729
return true ;
@@ -1736,7 +1738,7 @@ bool StoreBitFieldPop(InterpState &S, CodePtr OpPC) {
1736
1738
if (Ptr .canBeInitialized ())
1737
1739
Ptr .initialize ();
1738
1740
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 ()));
1740
1742
else
1741
1743
Ptr .deref <T>() = Value;
1742
1744
return true ;
@@ -2014,7 +2016,7 @@ inline bool SubPtr(InterpState &S, CodePtr OpPC) {
2014
2016
while (auto *AT = dyn_cast<ArrayType>(PtrT))
2015
2017
PtrT = AT->getElementType ();
2016
2018
2017
- QualType ArrayTy = S.getCtx ().getConstantArrayType (
2019
+ QualType ArrayTy = S.getASTContext ().getConstantArrayType (
2018
2020
PtrT, APInt::getZero (1 ), nullptr , ArraySizeModifier::Normal, 0 );
2019
2021
S.FFDiag (S.Current ->getSource (OpPC),
2020
2022
diag::note_constexpr_pointer_subtraction_zero_size)
@@ -2953,7 +2955,7 @@ inline bool CheckDecl(InterpState &S, CodePtr OpPC, const VarDecl *VD) {
2953
2955
if (VD == S.EvaluatingDecl )
2954
2956
return true ;
2955
2957
2956
- if (!VD->isUsableInConstantExpressions (S.getCtx ())) {
2958
+ if (!VD->isUsableInConstantExpressions (S.getASTContext ())) {
2957
2959
S.CCEDiag (VD->getLocation (), diag::note_constexpr_static_local)
2958
2960
<< (VD->getTSCSpec () == TSCS_unspecified ? 0 : 1 ) << VD;
2959
2961
return false ;
@@ -3047,7 +3049,7 @@ static inline bool Free(InterpState &S, CodePtr OpPC, bool DeleteIsArrayForm) {
3047
3049
if (!Ptr .isRoot () || Ptr .isOnePastEnd () || Ptr .isArrayElement ()) {
3048
3050
const SourceInfo &Loc = S.Current ->getSource (OpPC);
3049
3051
S.FFDiag (Loc, diag::note_constexpr_delete_subobject)
3050
- << Ptr .toDiagnosticString (S.getCtx ()) << Ptr .isOnePastEnd ();
3052
+ << Ptr .toDiagnosticString (S.getASTContext ()) << Ptr .isOnePastEnd ();
3051
3053
return false ;
3052
3054
}
3053
3055
0 commit comments