PR4143: don't crash generating debug info for incomplete enum types.

llvm-svn: 70825
This commit is contained in:
Eli Friedman 2009-05-04 04:39:55 +00:00
parent 1bff64e309
commit 2ad7e17096
2 changed files with 13 additions and 2 deletions

View File

@ -520,8 +520,12 @@ llvm::DIType CGDebugInfo::CreateType(const EnumType *Ty,
// Size and align of the type.
uint64_t Size = M->getContext().getTypeSize(Ty);
unsigned Align = M->getContext().getTypeAlign(Ty);
uint64_t Size = 0;
unsigned Align = 0;
if (!Ty->isIncompleteType()) {
Size = M->getContext().getTypeSize(Ty);
Align = M->getContext().getTypeAlign(Ty);
}
return DebugFactory.CreateCompositeType(llvm::dwarf::DW_TAG_enumeration_type,
Unit, EnumName, DefUnit, Line,

View File

@ -28,3 +28,10 @@ struct foo {
void *ptrs[];
};
struct foo bar;
// PR4143
struct foo2 {
enum bar *bar;
};
struct foo2 foo2;