Skip to content

Commit 549b776

Browse files
kazutakahiratasivan-shani
authored andcommitted
[lldb] Use std::tie to implement operator< (NFC) (llvm#141416)
1 parent 3a8e66f commit 549b776

File tree

3 files changed

+6
-18
lines changed

3 files changed

+6
-18
lines changed

lldb/include/lldb/Symbol/CompilerDeclContext.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ class CompilerDeclContext {
4848
explicit operator bool() const { return IsValid(); }
4949

5050
bool operator<(const CompilerDeclContext &rhs) const {
51-
if (m_type_system == rhs.m_type_system)
52-
return m_opaque_decl_ctx < rhs.m_opaque_decl_ctx;
53-
return m_type_system < rhs.m_type_system;
51+
return std::tie(m_type_system, m_opaque_decl_ctx) <
52+
std::tie(rhs.m_type_system, rhs.m_opaque_decl_ctx);
5453
}
5554

5655
bool IsValid() const {

lldb/include/lldb/Target/CoreFileMemoryRanges.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,8 @@ struct CoreFileMemoryRange {
3030
}
3131

3232
bool operator<(const CoreFileMemoryRange &rhs) const {
33-
if (range < rhs.range)
34-
return true;
35-
if (range == rhs.range)
36-
return lldb_permissions < rhs.lldb_permissions;
37-
return false;
33+
return std::tie(range, lldb_permissions) <
34+
std::tie(rhs.range, rhs.lldb_permissions);
3835
}
3936

4037
std::string Dump() const {

lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -386,16 +386,8 @@ class ObjCLanguageRuntime : public LanguageRuntime {
386386
}
387387

388388
bool operator<(const ClassAndSel &rhs) const {
389-
if (class_addr < rhs.class_addr)
390-
return true;
391-
else if (class_addr > rhs.class_addr)
392-
return false;
393-
else {
394-
if (sel_addr < rhs.sel_addr)
395-
return true;
396-
else
397-
return false;
398-
}
389+
return std::tie(class_addr, sel_addr) <
390+
std::tie(rhs.class_addr, rhs.sel_addr);
399391
}
400392

401393
lldb::addr_t class_addr = LLDB_INVALID_ADDRESS;

0 commit comments

Comments
 (0)