Skip to content

Commit 19141c4

Browse files
authored
[lldb] Mark operator== const to avoid ambiguity in C++20. (#68224)
C++20 will automatically generate an operator== with reversed operand order, which is ambiguous with the written operator== when one argument is marked const and the other isn't. These operators currently trigger -Wambiguous-reversed-operator at usage sites lldb/source/Symbol/SymbolFileOnDemand.cpp:68 and lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp:1286.
1 parent 1964118 commit 19141c4

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

lldb/include/lldb/Utility/XcodeSDK.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class XcodeSDK {
6969

7070
XcodeSDK &operator=(const XcodeSDK &other);
7171
XcodeSDK(const XcodeSDK&) = default;
72-
bool operator==(const XcodeSDK &other);
72+
bool operator==(const XcodeSDK &other) const;
7373

7474
/// Return parsed SDK type and version number.
7575
Info Parse() const;

lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,8 +606,8 @@ void DynamicLoaderDarwinKernel::KextImageInfo::SetProcessStopId(
606606
m_load_process_stop_id = stop_id;
607607
}
608608

609-
bool DynamicLoaderDarwinKernel::KextImageInfo::
610-
operator==(const KextImageInfo &rhs) {
609+
bool DynamicLoaderDarwinKernel::KextImageInfo::operator==(
610+
const KextImageInfo &rhs) const {
611611
if (m_uuid.IsValid() || rhs.GetUUID().IsValid()) {
612612
return m_uuid == rhs.GetUUID();
613613
}

lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ class DynamicLoaderDarwinKernel : public lldb_private::DynamicLoader {
176176

177177
void SetProcessStopId(uint32_t stop_id);
178178

179-
bool operator==(const KextImageInfo &rhs);
179+
bool operator==(const KextImageInfo &rhs) const;
180180

181181
uint32_t GetAddressByteSize(); // as determined by Mach-O header
182182

lldb/source/Utility/XcodeSDK.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ XcodeSDK::XcodeSDK(XcodeSDK::Info info) : m_name(GetName(info.type).str()) {
5656

5757
XcodeSDK &XcodeSDK::operator=(const XcodeSDK &other) = default;
5858

59-
bool XcodeSDK::operator==(const XcodeSDK &other) {
59+
bool XcodeSDK::operator==(const XcodeSDK &other) const {
6060
return m_name == other.m_name;
6161
}
6262

0 commit comments

Comments
 (0)