forked from OSchip/llvm-project
PR4143: don't crash generating debug info for incomplete enum types.
llvm-svn: 70825
This commit is contained in:
parent
1bff64e309
commit
2ad7e17096
|
@ -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,
|
||||
|
|
|
@ -28,3 +28,10 @@ struct foo {
|
|||
void *ptrs[];
|
||||
};
|
||||
struct foo bar;
|
||||
|
||||
// PR4143
|
||||
struct foo2 {
|
||||
enum bar *bar;
|
||||
};
|
||||
|
||||
struct foo2 foo2;
|
||||
|
|
Loading…
Reference in New Issue