[Lldb-commits] [lldb] bb945fc - Reland "[lldb][ObjC][NFC] Fix c++20 gcc compile errors"
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Fri Jan 26 06:07:56 PST 2024
Author: David Spickett
Date: 2024-01-26T14:06:49Z
New Revision: bb945fcd4a54c2c8f898e2bdc0d65fae841a1909
URL: https://github.com/llvm/llvm-project/commit/bb945fcd4a54c2c8f898e2bdc0d65fae841a1909
DIFF: https://github.com/llvm/llvm-project/commit/bb945fcd4a54c2c8f898e2bdc0d65fae841a1909.diff
LOG: 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).
Added:
Modified:
lldb/source/Plugins/Language/ObjC/NSArray.cpp
lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
lldb/source/Plugins/Language/ObjC/NSSet.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/Language/ObjC/NSArray.cpp b/lldb/source/Plugins/Language/ObjC/NSArray.cpp
index bd356a61161a537..7d0004c572ed6bb 100644
--- a/lldb/source/Plugins/Language/ObjC/NSArray.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSArray.cpp
@@ -548,9 +548,8 @@ lldb_private::formatters::NSArrayMSyntheticFrontEndBase::GetIndexOfChildWithName
}
template <typename D32, typename D64>
-lldb_private::formatters::
- GenericNSArrayMSyntheticFrontEnd<D32, D64>::
- ~GenericNSArrayMSyntheticFrontEnd<D32, D64>() {
+lldb_private::formatters::GenericNSArrayMSyntheticFrontEnd<D32, D64>::
+ GenericNSArrayMSyntheticFrontEnd::~GenericNSArrayMSyntheticFrontEnd() {
delete m_data_32;
m_data_32 = nullptr;
delete m_data_64;
@@ -616,7 +615,7 @@ lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<D32, D64, Inline>::
template <typename D32, typename D64, bool Inline>
lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<D32, D64, Inline>::
- ~GenericNSArrayISyntheticFrontEnd<D32, D64, Inline>() {
+ GenericNSArrayISyntheticFrontEnd::~GenericNSArrayISyntheticFrontEnd() {
delete m_data_32;
m_data_32 = nullptr;
delete m_data_64;
diff --git a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
index 5ae0751cb065f32..d377ee74ccc05d1 100644
--- a/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
@@ -1059,8 +1059,9 @@ lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<D32, D64>::
m_data_32(nullptr), m_data_64(nullptr), m_pair_type() {}
template <typename D32, typename D64>
-lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<D32,D64>::
- ~GenericNSDictionaryMSyntheticFrontEnd<D32,D64>() {
+lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<
+ D32, D64>::GenericNSDictionaryMSyntheticFrontEnd::
+ ~GenericNSDictionaryMSyntheticFrontEnd() {
delete m_data_32;
m_data_32 = nullptr;
delete m_data_64;
diff --git a/lldb/source/Plugins/Language/ObjC/NSSet.cpp b/lldb/source/Plugins/Language/ObjC/NSSet.cpp
index 44097ee0c42b855..ed1751cc128ca27 100644
--- a/lldb/source/Plugins/Language/ObjC/NSSet.cpp
+++ b/lldb/source/Plugins/Language/ObjC/NSSet.cpp
@@ -671,8 +671,8 @@ lldb_private::formatters::GenericNSSetMSyntheticFrontEnd<
}
template <typename D32, typename D64>
-lldb_private::formatters::
- GenericNSSetMSyntheticFrontEnd<D32, D64>::~GenericNSSetMSyntheticFrontEnd<D32, D64>() {
+lldb_private::formatters::GenericNSSetMSyntheticFrontEnd<D32, D64>::
+ GenericNSSetMSyntheticFrontEnd::~GenericNSSetMSyntheticFrontEnd() {
delete m_data_32;
m_data_32 = nullptr;
delete m_data_64;
More information about the lldb-commits
mailing list