Skip to content

Commit 1f5cd3a

Browse files
committed
[clang][Interp][NFC] Fix getType() of pointers pointing to vector elems
1 parent 775d7cc commit 1f5cd3a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

clang/lib/AST/Interp/Pointer.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,12 +314,14 @@ class Pointer {
314314
/// Returns the type of the innermost field.
315315
QualType getType() const {
316316
if (inPrimitiveArray() && Offset != asBlockPointer().Base) {
317-
// Unfortunately, complex types are not array types in clang, but they are
318-
// for us.
317+
// Unfortunately, complex and vector types are not array types in clang,
318+
// but they are for us.
319319
if (const auto *AT = getFieldDesc()->getType()->getAsArrayTypeUnsafe())
320320
return AT->getElementType();
321321
if (const auto *CT = getFieldDesc()->getType()->getAs<ComplexType>())
322322
return CT->getElementType();
323+
if (const auto *CT = getFieldDesc()->getType()->getAs<VectorType>())
324+
return CT->getElementType();
323325
}
324326
return getFieldDesc()->getType();
325327
}

0 commit comments

Comments
 (0)