Skip to content

Commit d9e7286

Browse files
authored
[NFC][clang][bytecode] Rename clang::interp::State::getCtx to clang::interp::State::getASTContext (#106071)
The new constant interpreter's `clang::interp::InterpState` contains both `clang::interp::Context` and `clang::ASTContext`. So using `S.Ctx` and `S.getCtx()` was a bit confusing. This PR rename `getCtx()` to `getASTContext` to make things more clearer. Signed-off-by: yronglin <[email protected]>
1 parent 399d7cc commit d9e7286

File tree

9 files changed

+75
-69
lines changed

9 files changed

+75
-69
lines changed

clang/lib/AST/ByteCode/EvalEmitter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ bool EvalEmitter::emitRetValue(const SourceInfo &Info) {
219219
return false;
220220

221221
if (std::optional<APValue> APV =
222-
Ptr.toRValue(S.getCtx(), EvalResult.getSourceType())) {
222+
Ptr.toRValue(S.getASTContext(), EvalResult.getSourceType())) {
223223
EvalResult.setValue(*APV);
224224
return true;
225225
}

clang/lib/AST/ByteCode/Interp.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ bool CheckConstant(InterpState &S, CodePtr OpPC, const Descriptor *Desc) {
326326
auto IsConstType = [&S](const VarDecl *VD) -> bool {
327327
QualType T = VD->getType();
328328

329-
if (T.isConstant(S.getCtx()))
329+
if (T.isConstant(S.getASTContext()))
330330
return true;
331331

332332
if (S.getLangOpts().CPlusPlus && !S.getLangOpts().CPlusPlus11)
@@ -523,9 +523,9 @@ bool CheckGlobalInitialized(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
523523
assert(S.getLangOpts().CPlusPlus);
524524
const auto *VD = cast<VarDecl>(Ptr.getDeclDesc()->asValueDecl());
525525
if ((!VD->hasConstantInitialization() &&
526-
VD->mightBeUsableInConstantExpressions(S.getCtx())) ||
526+
VD->mightBeUsableInConstantExpressions(S.getASTContext())) ||
527527
(S.getLangOpts().OpenCL && !S.getLangOpts().CPlusPlus11 &&
528-
!VD->hasICEInitializer(S.getCtx()))) {
528+
!VD->hasICEInitializer(S.getASTContext()))) {
529529
const SourceInfo &Loc = S.Current->getSource(OpPC);
530530
S.FFDiag(Loc, diag::note_constexpr_var_init_non_constant, 1) << VD;
531531
S.Note(VD->getLocation(), diag::note_declared_at);
@@ -797,7 +797,7 @@ bool CheckNewDeleteForms(InterpState &S, CodePtr OpPC, bool NewWasArray,
797797
// but we want to get the array size right.
798798
if (D->isArray()) {
799799
QualType ElemQT = D->getType()->getPointeeType();
800-
TypeToDiagnose = S.getCtx().getConstantArrayType(
800+
TypeToDiagnose = S.getASTContext().getConstantArrayType(
801801
ElemQT, APInt(64, static_cast<uint64_t>(D->getNumElems()), false),
802802
nullptr, ArraySizeModifier::Normal, 0);
803803
} else
@@ -819,7 +819,7 @@ bool CheckDeleteSource(InterpState &S, CodePtr OpPC, const Expr *Source,
819819
// Whatever this is, we didn't heap allocate it.
820820
const SourceInfo &Loc = S.Current->getSource(OpPC);
821821
S.FFDiag(Loc, diag::note_constexpr_delete_not_heap_alloc)
822-
<< Ptr.toDiagnosticString(S.getCtx());
822+
<< Ptr.toDiagnosticString(S.getASTContext());
823823

824824
if (Ptr.isTemporary())
825825
S.Note(Ptr.getDeclLoc(), diag::note_constexpr_temporary_here);

clang/lib/AST/ByteCode/Interp.h

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ using APSInt = llvm::APSInt;
4141
/// Convert a value to an APValue.
4242
template <typename T>
4343
bool 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

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static T getParam(const InterpFrame *Frame, unsigned Index) {
3838
}
3939

4040
PrimType getIntPrimType(const InterpState &S) {
41-
const TargetInfo &TI = S.getCtx().getTargetInfo();
41+
const TargetInfo &TI = S.getASTContext().getTargetInfo();
4242
unsigned IntWidth = TI.getIntWidth();
4343

4444
if (IntWidth == 32)
@@ -49,7 +49,7 @@ PrimType getIntPrimType(const InterpState &S) {
4949
}
5050

5151
PrimType getLongPrimType(const InterpState &S) {
52-
const TargetInfo &TI = S.getCtx().getTargetInfo();
52+
const TargetInfo &TI = S.getASTContext().getTargetInfo();
5353
unsigned LongWidth = TI.getLongWidth();
5454

5555
if (LongWidth == 64)
@@ -272,10 +272,10 @@ static bool interp__builtin_nan(InterpState &S, CodePtr OpPC,
272272
return false;
273273

274274
const llvm::fltSemantics &TargetSemantics =
275-
S.getCtx().getFloatTypeSemantics(F->getDecl()->getReturnType());
275+
S.getASTContext().getFloatTypeSemantics(F->getDecl()->getReturnType());
276276

277277
Floating Result;
278-
if (S.getCtx().getTargetInfo().isNan2008()) {
278+
if (S.getASTContext().getTargetInfo().isNan2008()) {
279279
if (Signaling)
280280
Result = Floating(
281281
llvm::APFloat::getSNaN(TargetSemantics, /*Negative=*/false, &Fill));
@@ -303,7 +303,7 @@ static bool interp__builtin_nan(InterpState &S, CodePtr OpPC,
303303
static bool interp__builtin_inf(InterpState &S, CodePtr OpPC,
304304
const InterpFrame *Frame, const Function *F) {
305305
const llvm::fltSemantics &TargetSemantics =
306-
S.getCtx().getFloatTypeSemantics(F->getDecl()->getReturnType());
306+
S.getASTContext().getFloatTypeSemantics(F->getDecl()->getReturnType());
307307

308308
S.Stk.push<Floating>(Floating::getInf(TargetSemantics));
309309
return true;
@@ -689,8 +689,8 @@ static bool interp__builtin_eh_return_data_regno(InterpState &S, CodePtr OpPC,
689689
PrimType ArgT = *S.getContext().classify(Call->getArg(0)->getType());
690690
APSInt Arg = peekToAPSInt(S.Stk, ArgT);
691691

692-
int Result =
693-
S.getCtx().getTargetInfo().getEHDataRegisterNumber(Arg.getZExtValue());
692+
int Result = S.getASTContext().getTargetInfo().getEHDataRegisterNumber(
693+
Arg.getZExtValue());
694694
pushInteger(S, Result, Call->getType());
695695
return true;
696696
}
@@ -734,7 +734,7 @@ static bool interp__builtin_overflowop(InterpState &S, CodePtr OpPC,
734734
ResultType->isSignedIntegerOrEnumerationType();
735735
uint64_t LHSSize = LHS.getBitWidth();
736736
uint64_t RHSSize = RHS.getBitWidth();
737-
uint64_t ResultSize = S.getCtx().getTypeSize(ResultType);
737+
uint64_t ResultSize = S.getASTContext().getTypeSize(ResultType);
738738
uint64_t MaxBits = std::max(std::max(LHSSize, RHSSize), ResultSize);
739739

740740
// Add an additional bit if the signedness isn't uniformly agreed to. We
@@ -794,7 +794,7 @@ static bool interp__builtin_overflowop(InterpState &S, CodePtr OpPC,
794794
// since it will give us the behavior of a TruncOrSelf in the case where
795795
// its parameter <= its size. We previously set Result to be at least the
796796
// type-size of the result, so getTypeSize(ResultType) <= Resu
797-
APSInt Temp = Result.extOrTrunc(S.getCtx().getTypeSize(ResultType));
797+
APSInt Temp = Result.extOrTrunc(S.getASTContext().getTypeSize(ResultType));
798798
Temp.setIsSigned(ResultType->isSignedIntegerOrEnumerationType());
799799

800800
if (!APSInt::isSameValue(Temp, Result))
@@ -974,8 +974,8 @@ static bool interp__builtin_atomic_lock_free(InterpState &S, CodePtr OpPC,
974974
if (Size.isPowerOfTwo()) {
975975
// Check against inlining width.
976976
unsigned InlineWidthBits =
977-
S.getCtx().getTargetInfo().getMaxAtomicInlineWidth();
978-
if (Size <= S.getCtx().toCharUnitsFromBits(InlineWidthBits)) {
977+
S.getASTContext().getTargetInfo().getMaxAtomicInlineWidth();
978+
if (Size <= S.getASTContext().toCharUnitsFromBits(InlineWidthBits)) {
979979

980980
// OK, we will inline appropriately-aligned operations of this size,
981981
// and _Atomic(T) is appropriately-aligned.
@@ -1007,7 +1007,7 @@ static bool interp__builtin_atomic_lock_free(InterpState &S, CodePtr OpPC,
10071007
if (auto PtrTy = PtrArg->getType()->getAs<PointerType>()) {
10081008
QualType PointeeType = PtrTy->getPointeeType();
10091009
if (!PointeeType->isIncompleteType() &&
1010-
S.getCtx().getTypeAlignInChars(PointeeType) >= Size) {
1010+
S.getASTContext().getTypeAlignInChars(PointeeType) >= Size) {
10111011
// OK, we will inline operations on this object.
10121012
return returnBool(true);
10131013
}
@@ -1059,7 +1059,7 @@ static bool interp__builtin_is_aligned_up_down(InterpState &S, CodePtr OpPC,
10591059
S.FFDiag(Call, diag::note_constexpr_invalid_alignment) << Alignment;
10601060
return false;
10611061
}
1062-
unsigned SrcWidth = S.getCtx().getIntWidth(Call->getArg(0)->getType());
1062+
unsigned SrcWidth = S.getASTContext().getIntWidth(Call->getArg(0)->getType());
10631063
APSInt MaxValue(APInt::getOneBitSet(SrcWidth, SrcWidth - 1));
10641064
if (APSInt::compareValues(Alignment, MaxValue) > 0) {
10651065
S.FFDiag(Call, diag::note_constexpr_alignment_too_big)
@@ -1094,7 +1094,7 @@ static bool interp__builtin_is_aligned_up_down(InterpState &S, CodePtr OpPC,
10941094
unsigned PtrOffset = Ptr.getByteOffset();
10951095
PtrOffset = Ptr.getIndex();
10961096
CharUnits BaseAlignment =
1097-
S.getCtx().getDeclAlign(Ptr.getDeclDesc()->asValueDecl());
1097+
S.getASTContext().getDeclAlign(Ptr.getDeclDesc()->asValueDecl());
10981098
CharUnits PtrAlign =
10991099
BaseAlignment.alignmentAtOffset(CharUnits::fromQuantity(PtrOffset));
11001100

@@ -1157,7 +1157,7 @@ static bool interp__builtin_os_log_format_buffer_size(InterpState &S,
11571157
const Function *Func,
11581158
const CallExpr *Call) {
11591159
analyze_os_log::OSLogBufferLayout Layout;
1160-
analyze_os_log::computeOSLogBufferLayout(S.getCtx(), Call, Layout);
1160+
analyze_os_log::computeOSLogBufferLayout(S.getASTContext(), Call, Layout);
11611161
pushInteger(S, Layout.size().getQuantity(), Call->getType());
11621162
return true;
11631163
}
@@ -1624,22 +1624,23 @@ bool InterpretOffsetOf(InterpState &S, CodePtr OpPC, const OffsetOfExpr *E,
16241624
const RecordDecl *RD = RT->getDecl();
16251625
if (RD->isInvalidDecl())
16261626
return false;
1627-
const ASTRecordLayout &RL = S.getCtx().getASTRecordLayout(RD);
1627+
const ASTRecordLayout &RL = S.getASTContext().getASTRecordLayout(RD);
16281628
unsigned FieldIndex = MemberDecl->getFieldIndex();
16291629
assert(FieldIndex < RL.getFieldCount() && "offsetof field in wrong type");
1630-
Result += S.getCtx().toCharUnitsFromBits(RL.getFieldOffset(FieldIndex));
1630+
Result +=
1631+
S.getASTContext().toCharUnitsFromBits(RL.getFieldOffset(FieldIndex));
16311632
CurrentType = MemberDecl->getType().getNonReferenceType();
16321633
break;
16331634
}
16341635
case OffsetOfNode::Array: {
16351636
// When generating bytecode, we put all the index expressions as Sint64 on
16361637
// the stack.
16371638
int64_t Index = ArrayIndices[ArrayIndex];
1638-
const ArrayType *AT = S.getCtx().getAsArrayType(CurrentType);
1639+
const ArrayType *AT = S.getASTContext().getAsArrayType(CurrentType);
16391640
if (!AT)
16401641
return false;
16411642
CurrentType = AT->getElementType();
1642-
CharUnits ElementSize = S.getCtx().getTypeSizeInChars(CurrentType);
1643+
CharUnits ElementSize = S.getASTContext().getTypeSizeInChars(CurrentType);
16431644
Result += Index * ElementSize;
16441645
++ArrayIndex;
16451646
break;
@@ -1656,7 +1657,7 @@ bool InterpretOffsetOf(InterpState &S, CodePtr OpPC, const OffsetOfExpr *E,
16561657
const RecordDecl *RD = RT->getDecl();
16571658
if (RD->isInvalidDecl())
16581659
return false;
1659-
const ASTRecordLayout &RL = S.getCtx().getASTRecordLayout(RD);
1660+
const ASTRecordLayout &RL = S.getASTContext().getASTRecordLayout(RD);
16601661

16611662
// Find the base class itself.
16621663
CurrentType = BaseSpec->getType();

0 commit comments

Comments
 (0)