Skip to content

Commit bb945fc

Browse files
committed
Reland "[lldb][ObjC][NFC] Fix c++20 gcc compile errors"
clang's -Wdtor name is correct, but the standard may have not intended that meaning, according to https://bugs.llvm.org/show_bug.cgi?id=46979#c1. Some of the wording may have changed in 20/23, but we of course need to support c++17 as well as that's our default. One workaround would be to explicitly open the namespaces, then declare the destructor inside that. Another as shown in the bug report is to repeat the class name, without the template arguments, before the ::~. For example `Bar::Foo<T>::Foo::~Foo`. (this extra Foo is the injected class name https://en.cppreference.com/w/cpp/language/injected-class-name) I chose to do this because it's the smallest change. It works with gcc-13 and clang in c++17 and 20 modes (https://godbolt.org/z/fqs4fGE7T).
1 parent 1b7b40b commit bb945fc

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

lldb/source/Plugins/Language/ObjC/NSArray.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -548,9 +548,8 @@ lldb_private::formatters::NSArrayMSyntheticFrontEndBase::GetIndexOfChildWithName
548548
}
549549

550550
template <typename D32, typename D64>
551-
lldb_private::formatters::
552-
GenericNSArrayMSyntheticFrontEnd<D32, D64>::
553-
~GenericNSArrayMSyntheticFrontEnd<D32, D64>() {
551+
lldb_private::formatters::GenericNSArrayMSyntheticFrontEnd<D32, D64>::
552+
GenericNSArrayMSyntheticFrontEnd::~GenericNSArrayMSyntheticFrontEnd() {
554553
delete m_data_32;
555554
m_data_32 = nullptr;
556555
delete m_data_64;
@@ -616,7 +615,7 @@ lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<D32, D64, Inline>::
616615

617616
template <typename D32, typename D64, bool Inline>
618617
lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<D32, D64, Inline>::
619-
~GenericNSArrayISyntheticFrontEnd<D32, D64, Inline>() {
618+
GenericNSArrayISyntheticFrontEnd::~GenericNSArrayISyntheticFrontEnd() {
620619
delete m_data_32;
621620
m_data_32 = nullptr;
622621
delete m_data_64;

lldb/source/Plugins/Language/ObjC/NSDictionary.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,8 +1059,9 @@ lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<D32, D64>::
10591059
m_data_32(nullptr), m_data_64(nullptr), m_pair_type() {}
10601060

10611061
template <typename D32, typename D64>
1062-
lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<D32,D64>::
1063-
~GenericNSDictionaryMSyntheticFrontEnd<D32,D64>() {
1062+
lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<
1063+
D32, D64>::GenericNSDictionaryMSyntheticFrontEnd::
1064+
~GenericNSDictionaryMSyntheticFrontEnd() {
10641065
delete m_data_32;
10651066
m_data_32 = nullptr;
10661067
delete m_data_64;

lldb/source/Plugins/Language/ObjC/NSSet.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,8 +671,8 @@ lldb_private::formatters::GenericNSSetMSyntheticFrontEnd<
671671
}
672672

673673
template <typename D32, typename D64>
674-
lldb_private::formatters::
675-
GenericNSSetMSyntheticFrontEnd<D32, D64>::~GenericNSSetMSyntheticFrontEnd<D32, D64>() {
674+
lldb_private::formatters::GenericNSSetMSyntheticFrontEnd<D32, D64>::
675+
GenericNSSetMSyntheticFrontEnd::~GenericNSSetMSyntheticFrontEnd() {
676676
delete m_data_32;
677677
m_data_32 = nullptr;
678678
delete m_data_64;

0 commit comments

Comments
 (0)