From 3a5f29a073186c27f3af3823b16806ca30053dbc Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Wed, 30 Nov 2011 02:48:28 +0000 Subject: [PATCH] Add a work around to deal with incorrect forward class definitions in objective C DWARF emitted by clang. llvm-svn: 145471 --- .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index e5a52d659c40..60ef0c8cf184 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -4156,6 +4156,24 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu, tag_decl_kind = clang::TTK_Class; default_accessibility = eAccessPrivate; } + + if (byte_size_valid && byte_size == 0 && type_name_cstr && + die->HasChildren() == false && + sc.comp_unit->GetLanguage() == eLanguageTypeObjC) + { + // Work around an issue with clang at the moment where + // forward declarations for objective C classes are emitted + // as: + // DW_TAG_structure_type [2] + // DW_AT_name( "ForwardObjcClass" ) + // DW_AT_byte_size( 0x00 ) + // DW_AT_decl_file( "..." ) + // DW_AT_decl_line( 1 ) + // + // Note that there is no DW_AT_declaration and there are + // no children, and the byte size is zero. + is_forward_declaration = true; + } bool look_for_complete_objc_type = false; if (class_language == eLanguageTypeObjC)