[Lldb-commits] [lldb] [lldb][DWARFASTParserClang][ObjC] Remove workaround for old ObjC DWARF (PR #120218)
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Tue Dec 17 03:58:33 PST 2024
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/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 to produce this anymore, we think it's a good time to remove it.
>From 52eb2ca84152bae759a643d43cd2e24959d32d18 Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuch12 at gmail.com>
Date: Tue, 17 Dec 2024 11:43:54 +0000
Subject: [PATCH] [lldb][DWARFASTParserClang][ObjC] Remove workaround for old
ObjC DWARF
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 to produce this anymore, we think it's a good
time to remove it.
---
.../SymbolFile/DWARF/DWARFASTParserClang.cpp | 14 --------------
1 file changed, 14 deletions(-)
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