PR4143: don't crash generating debug info for incomplete enum types.
llvm-svn: 70825
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index ac1616b..c11e8ce 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -520,8 +520,12 @@
// 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,