summaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-08-01 20:30:22 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-08-01 20:30:22 +0000
commitc8b93557da150e051c273701652a2db328708708 (patch)
treea7c3cc785ee9c8961e8b7e279cbef22083c74a0b /lib/CodeGen
parent70cf72e0927ca4e648d9d70b3c309bdaa700a386 (diff)
downloadllvm-c8b93557da150e051c273701652a2db328708708.tar.gz
llvm-c8b93557da150e051c273701652a2db328708708.tar.bz2
llvm-c8b93557da150e051c273701652a2db328708708.tar.xz
DebugInfo: Emit definitions for types with no members.
The absence of members was a poor/incorrect proxy for "is definition". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187607 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index e912076a65..df8ca170ac 100644
--- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -980,16 +980,12 @@ void CompileUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
case dwarf::DW_TAG_structure_type:
case dwarf::DW_TAG_union_type:
case dwarf::DW_TAG_class_type: {
- // Add elements to structure type.
- DIArray Elements = CTy.getTypeArray();
-
- // A forward struct declared type may not have elements available.
- unsigned N = Elements.getNumElements();
- if (N == 0)
+ if (CTy.isForwardDecl())
break;
// Add elements to structure type.
- for (unsigned i = 0; i < N; ++i) {
+ DIArray Elements = CTy.getTypeArray();
+ for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) {
DIDescriptor Element = Elements.getElement(i);
DIE *ElemDie = NULL;
if (Element.isSubprogram()) {