mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-09 10:31:14 +00:00
Check for empty structs, and for consistency, zero-element arrays.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123383 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
704d1347c5
commit
f0908aeade
@ -1084,12 +1084,12 @@ static bool isHomogeneousAggregate(const Type *T, unsigned &NumElts,
|
||||
const Type *&EltTy) {
|
||||
if (const ArrayType *AT = dyn_cast<ArrayType>(T)) {
|
||||
NumElts = AT->getNumElements();
|
||||
EltTy = AT->getElementType();
|
||||
EltTy = (NumElts == 0 ? 0 : AT->getElementType());
|
||||
return true;
|
||||
}
|
||||
if (const StructType *ST = dyn_cast<StructType>(T)) {
|
||||
NumElts = ST->getNumContainedTypes();
|
||||
EltTy = ST->getContainedType(0);
|
||||
EltTy = (NumElts == 0 ? 0 : ST->getContainedType(0));
|
||||
for (unsigned n = 1; n < NumElts; ++n) {
|
||||
if (ST->getContainedType(n) != EltTy)
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user