Fixed a bug where empty C structs were given size
1 by the expression parser. We now correctly
report that they are of size 0. (C++ structs
are mandated to have nonzero size, and Clang marks
them as being 1 byte in size.)
<rdar://problem/12380800>
llvm-svn: 166256
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index bb96eae..0f3ad3e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -5611,6 +5611,27 @@
// No children for this struct/union/class, lets finish it
ast.StartTagDeclarationDefinition (clang_type);
ast.CompleteTagDeclarationDefinition (clang_type);
+
+ if (tag == DW_TAG_structure_type) // this only applies in C
+ {
+ clang::QualType qual_type = clang::QualType::getFromOpaquePtr (clang_type);
+ const clang::RecordType *record_type = qual_type->getAs<clang::RecordType> ();
+
+ if (record_type)
+ {
+ clang::RecordDecl *record_decl = record_type->getDecl();
+
+ if (record_decl)
+ {
+ LayoutInfo layout_info;
+
+ layout_info.alignment = 0;
+ layout_info.bit_size = 0;
+
+ m_record_decl_to_layout_map.insert(std::make_pair(record_decl, layout_info));
+ }
+ }
+ }
}
else if (clang_type_was_created)
{