From 9e9539144e2f7cba0da6094fccf043f757b807b6 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Fri, 27 Sep 2024 16:16:43 +0900 Subject: [PATCH] Refactor --- src/gdb-index.cc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/gdb-index.cc b/src/gdb-index.cc index a87b769180..6061163fc3 100644 --- a/src/gdb-index.cc +++ b/src/gdb-index.cc @@ -127,16 +127,10 @@ struct SectionHeader { }; struct NameType { - bool operator==(const NameType &) const = default; - - bool operator<(const NameType &other) const { - return std::tuple(hash, type, name) < - std::tuple(other.hash, other.type, other.name); - } - - std::string_view name; + auto operator<=>(const NameType &) const = default; u64 hash; u8 type; + std::string_view name; }; struct MapValue { @@ -539,7 +533,7 @@ static i64 read_pubnames_cu(Context &ctx, const PubnamesHdr &hdr, u8 type = *p++; std::string_view name = (char *)p; p += name.size() + 1; - cu->nametypes.push_back({name, hash_string(name), type}); + cu->nametypes.push_back({hash_string(name), type, name}); } return size;