Skip to content

Commit fa01d04

Browse files
committed
[clang][Interp][NFC] Change pointer offset to uint64
To accomodate for recent changes in array index calculations.
1 parent 56ca5ec commit fa01d04

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

clang/lib/AST/Interp/Pointer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Pointer::Pointer(Block *Pointee)
2323
: Pointer(Pointee, Pointee->getDescriptor()->getMetadataSize(),
2424
Pointee->getDescriptor()->getMetadataSize()) {}
2525

26-
Pointer::Pointer(Block *Pointee, unsigned BaseAndOffset)
26+
Pointer::Pointer(Block *Pointee, uint64_t BaseAndOffset)
2727
: Pointer(Pointee, BaseAndOffset, BaseAndOffset) {}
2828

2929
Pointer::Pointer(const Pointer &P)
@@ -34,7 +34,7 @@ Pointer::Pointer(const Pointer &P)
3434
PointeeStorage.BS.Pointee->addPointer(this);
3535
}
3636

37-
Pointer::Pointer(Block *Pointee, unsigned Base, unsigned Offset)
37+
Pointer::Pointer(Block *Pointee, unsigned Base, uint64_t Offset)
3838
: Offset(Offset), StorageKind(Storage::Block) {
3939
assert((Base == RootPtrMark || Base % alignof(void *) == 0) && "wrong base");
4040

clang/lib/AST/Interp/Pointer.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ class Pointer {
8989
PointeeStorage.Int.Desc = nullptr;
9090
}
9191
Pointer(Block *B);
92-
Pointer(Block *B, unsigned BaseAndOffset);
92+
Pointer(Block *B, uint64_t BaseAndOffset);
9393
Pointer(const Pointer &P);
9494
Pointer(Pointer &&P);
95-
Pointer(uint64_t Address, const Descriptor *Desc, unsigned Offset = 0)
95+
Pointer(uint64_t Address, const Descriptor *Desc, uint64_t Offset = 0)
9696
: Offset(Offset), StorageKind(Storage::Int) {
9797
PointeeStorage.Int.Value = Address;
9898
PointeeStorage.Int.Desc = Desc;
@@ -134,14 +134,14 @@ class Pointer {
134134
std::optional<APValue> toRValue(const Context &Ctx) const;
135135

136136
/// Offsets a pointer inside an array.
137-
[[nodiscard]] Pointer atIndex(unsigned Idx) const {
137+
[[nodiscard]] Pointer atIndex(uint64_t Idx) const {
138138
if (isIntegralPointer())
139139
return Pointer(asIntPointer().Value, asIntPointer().Desc, Idx);
140140

141141
if (asBlockPointer().Base == RootPtrMark)
142142
return Pointer(asBlockPointer().Pointee, RootPtrMark,
143143
getDeclDesc()->getSize());
144-
unsigned Off = Idx * elemSize();
144+
uint64_t Off = Idx * elemSize();
145145
if (getFieldDesc()->ElemDesc)
146146
Off += sizeof(InlineDescriptor);
147147
else
@@ -630,7 +630,7 @@ class Pointer {
630630
friend class DeadBlock;
631631
friend struct InitMap;
632632

633-
Pointer(Block *Pointee, unsigned Base, unsigned Offset);
633+
Pointer(Block *Pointee, unsigned Base, uint64_t Offset);
634634

635635
/// Returns the embedded descriptor preceding a field.
636636
InlineDescriptor *getInlineDesc() const {
@@ -656,7 +656,7 @@ class Pointer {
656656
}
657657

658658
/// Offset into the storage.
659-
unsigned Offset = 0;
659+
uint64_t Offset = 0;
660660

661661
/// Previous link in the pointer chain.
662662
Pointer *Prev = nullptr;

0 commit comments

Comments
 (0)