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
This commit is contained in:
Sean Callanan 2012-10-19 01:37:25 +00:00
parent ced93f3a05
commit 433cd221ec
1 changed files with 21 additions and 0 deletions

View File

@ -5611,6 +5611,27 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
// No children for this struct/union/class, lets finish it // No children for this struct/union/class, lets finish it
ast.StartTagDeclarationDefinition (clang_type); ast.StartTagDeclarationDefinition (clang_type);
ast.CompleteTagDeclarationDefinition (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) else if (clang_type_was_created)
{ {