mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 15:06:09 +00:00
[clang][Interp] Fix Descriptor::getElemQualType() for complex/vectors
We handle them like arrays but still need to differentiate between array/vector/complex types when dealing with QualTypes.
This commit is contained in:
parent
0255c48188
commit
ae41232191
@ -359,8 +359,14 @@ QualType Descriptor::getType() const {
|
||||
|
||||
QualType Descriptor::getElemQualType() const {
|
||||
assert(isArray());
|
||||
const auto *AT = cast<ArrayType>(getType());
|
||||
return AT->getElementType();
|
||||
QualType T = getType();
|
||||
if (const auto *AT = T->getAsArrayTypeUnsafe())
|
||||
return AT->getElementType();
|
||||
if (const auto *CT = T->getAs<ComplexType>())
|
||||
return CT->getElementType();
|
||||
if (const auto *CT = T->getAs<VectorType>())
|
||||
return CT->getElementType();
|
||||
llvm_unreachable("Array that's not an array/complex/vector type?");
|
||||
}
|
||||
|
||||
SourceLocation Descriptor::getLocation() const {
|
||||
|
@ -81,3 +81,13 @@ namespace VectorElementExpr {
|
||||
static_assert(twoElts.x == 22, ""); // ref-error {{not an integral constant expression}}
|
||||
static_assert(twoElts.y == 33, ""); // ref-error {{not an integral constant expression}}
|
||||
}
|
||||
|
||||
namespace Temporaries {
|
||||
typedef __attribute__((vector_size(16))) int vi4a;
|
||||
typedef __attribute__((ext_vector_type(4))) int vi4b;
|
||||
struct S {
|
||||
vi4a v;
|
||||
vi4b w;
|
||||
};
|
||||
int &&s = S().w[1];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user