[Lldb-commits] [lldb] 794cd81 - [lldb][DWARFASTParserClang][ObjC] Remove workaround for old ObjC DWARF (#120218)

via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 17 04:35:32 PST 2024


Author: Michael Buch
Date: 2024-12-17T12:35:28Z
New Revision: 794cd814ee0260c094b98e453c89faf5a1a1df01

URL: https://github.com/llvm/llvm-project/commit/794cd814ee0260c094b98e453c89faf5a1a1df01
DIFF: https://github.com/llvm/llvm-project/commit/794cd814ee0260c094b98e453c89faf5a1a1df01.diff

LOG: [lldb][DWARFASTParserClang][ObjC] Remove workaround for old ObjC DWARF (#120218)

With all the recent versions of Clang that I tested, ObjC forward
declarations like
```
@class ForwardObjcClass;
```
don't emit the kind of DWARF that this workaround was put in place for.

Also, zero-sized structures are valid in C (and thus Objective-C), so
this workaround makes things confusing to reason about when mixing the
two languages.

This workaround has been in place for at least a decade, and given that
recent compilers don't produce this anymore, we think it's a good time
to remove it.

Added: 
    

Modified: 
    lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 58f7b805abe2fd..3f49ad25710a9f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1657,20 +1657,6 @@ DWARFASTParserClang::ParseStructureLikeDIE(const SymbolContext &sc,
   ConstString unique_typename(attrs.name);
   Declaration unique_decl(attrs.decl);
   uint64_t byte_size = attrs.byte_size.value_or(0);
-  if (attrs.byte_size && *attrs.byte_size == 0 && attrs.name &&
-      !die.HasChildren() && cu_language == 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.
-    attrs.is_forward_declaration = true;
-  }
 
   if (attrs.name) {
     GetUniqueTypeNameAndDeclaration(die, cu_language, unique_typename,


        


More information about the lldb-commits mailing list