@@ -144,13 +144,18 @@ APValue Pointer::toAPValue() const {
144
144
145
145
// TODO: compute the offset into the object.
146
146
CharUnits Offset = CharUnits::Zero ();
147
- bool IsOnePastEnd = isOnePastEnd ();
148
147
149
148
// Build the path into the object.
150
149
Pointer Ptr = *this ;
151
150
while (Ptr.isField () || Ptr.isArrayElement ()) {
152
- if (Ptr.isArrayElement ()) {
153
- Path.push_back (APValue::LValuePathEntry::ArrayIndex (Ptr.getIndex ()));
151
+ if (Ptr.isArrayRoot ()) {
152
+ Path.push_back (APValue::LValuePathEntry::ArrayIndex (0 ));
153
+ Ptr = Ptr.getBase ();
154
+ } else if (Ptr.isArrayElement ()) {
155
+ if (Ptr.isOnePastEnd ())
156
+ Path.push_back (APValue::LValuePathEntry::ArrayIndex (Ptr.getArray ().getNumElems ()));
157
+ else
158
+ Path.push_back (APValue::LValuePathEntry::ArrayIndex (Ptr.getIndex ()));
154
159
Ptr = Ptr.getArray ();
155
160
} else {
156
161
// TODO: figure out if base is virtual
@@ -173,7 +178,7 @@ APValue Pointer::toAPValue() const {
173
178
// Just invert the order of the elements.
174
179
std::reverse (Path.begin (), Path.end ());
175
180
176
- return APValue (Base, Offset, Path, IsOnePastEnd, /* IsNullPtr=*/ false );
181
+ return APValue (Base, Offset, Path, /* IsOnePastEnd= */ false , /* IsNullPtr=*/ false );
177
182
}
178
183
179
184
void Pointer::print (llvm::raw_ostream &OS) const {
0 commit comments