From 433cd221ecc1a949d7224c549cb497f912305c1c Mon Sep 17 00:00:00 2001 From: Sean Callanan Date: Fri, 19 Oct 2012 01:37:25 +0000 Subject: [PATCH] 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.) llvm-svn: 166256 --- .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index bb96eae26847..0f3ad3ed05ba 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -5611,6 +5611,27 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, // 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 (); + + 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) {