Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
rui314 committed Sep 27, 2024
1 parent feb9b3e commit 9e95391
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/gdb-index.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -539,7 +533,7 @@ static i64 read_pubnames_cu(Context<E> &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;
Expand Down

0 comments on commit 9e95391

Please sign in to comment.