7# include <absl/container/flat_hash_map.h>
8# include <absl/container/flat_hash_set.h>
10# include <unordered_map>
11# include <unordered_set>
26 constexpr Dbg() noexcept = default;
27 constexpr
Dbg(const
Dbg&) noexcept = default;
43 explicit operator bool()
const {
return sym().operator bool(); }
55 bool operator==(
const Dbg& other)
const noexcept {
return loc_ == other.loc_ && sym_ == other.sym_; }
59 auto h =
hash_begin(std::bit_cast<uintptr_t>(dbg.loc_.src));
72 friend H AbslHashValue(H h,
Dbg dbg)
noexcept {
73 return H::combine(std::move(h), dbg.loc_.src, dbg.loc_.begin.off, dbg.loc_.end.off, dbg.sym_);
82 friend std::ostream&
operator<<(std::ostream& os,
const Dbg& dbg) {
return os << dbg.
sym(); }
89using DbgMap = absl::flat_hash_map<Dbg, V, Dbg::Hash, Dbg::Eq>;
90using DbgSet = absl::flat_hash_set<Dbg, Dbg::Hash, Dbg::Eq>;
93using DbgMap = std::unordered_map<Dbg, V, Dbg::Hash, Dbg::Eq>;
94using DbgSet = std::unordered_set<Dbg, Dbg::Hash, Dbg::Eq>;
106 constexpr explicit operator
bool() const noexcept {
return key_ != 0; }
110 constexpr explicit DbgKey(uint32_t key) noexcept
constexpr bool operator==(const DbgKey &) const noexcept=default
constexpr DbgKey() noexcept=default
The empty Dbg.
A Symbol just wraps a pointer to Sym::String, so pass Sym itself around as value.
constexpr size_t hash_begin() noexcept
Seeds a hash chain with the FNV-1 offset basis.
std::unordered_set< Dbg, Dbg::Hash, Dbg::Eq > DbgSet
basic_ostream_formatter< char > ostream_formatter
constexpr size_t hash_combine(size_t seed, T v) noexcept
Mixes v into seed word-wise, reusing the FNV-1 prime as multiplier.
std::unordered_map< Dbg, V, Dbg::Hash, Dbg::Eq > DbgMap
bool operator()(Dbg d1, Dbg d2) const noexcept
size_t operator()(Dbg dbg) const noexcept
The debug info of an entity: where it came from and what it was called.
bool is_anon() const
Assumes _ as the anonymous name.
Dbg & operator=(const Dbg &) noexcept=default
constexpr Dbg(Loc loc) noexcept
friend std::ostream & operator<<(std::ostream &os, const Dbg &dbg)
constexpr Dbg() noexcept=default
bool operator==(const Dbg &other) const noexcept
constexpr Dbg(Sym sym) noexcept
Location within a Src: the half-open byte range [Loc::begin, Loc::end).