Add error messages for structs containing nested undefined structs
This commit is contained in:
19
type.cpp
19
type.cpp
@@ -1956,6 +1956,25 @@ StructType::IsConstType() const {
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
StructType::IsDefined() const {
|
||||
for (int i = 0; i < GetElementCount(); i++) {
|
||||
const Type *t = GetElementType(i);
|
||||
const UndefinedStructType *ust = CastType<UndefinedStructType>(t);
|
||||
if (ust != NULL) {
|
||||
return false;
|
||||
}
|
||||
const StructType *st = CastType<StructType>(t);
|
||||
if (st != NULL) {
|
||||
if (!st->IsDefined()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
const Type *
|
||||
StructType::GetBaseType() const {
|
||||
return this;
|
||||
|
||||
Reference in New Issue
Block a user