diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-05-04 04:39:55 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-05-04 04:39:55 +0000 |
commit | 3189e4be4f79f22e0e076e21615b9526de529b43 (patch) | |
tree | 7073b0b581f2c93991c2430e8d46fc97992f0270 /lib | |
parent | 22fe248abdab6ff458d57b7f0afa562d63908d25 (diff) |
PR4143: don't crash generating debug info for incomplete enum types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70825 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index ac1616b933..c11e8ce0ad 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -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, |