Add error messages for structs containing nested undefined structs

This commit is contained in:
jbrodman
2014-05-27 15:50:53 -07:00
parent 68f62b1fc3
commit d3144da5eb
3 changed files with 46 additions and 11 deletions

View File

@@ -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;