17 static constexpr uint32_t
Invalid = uint32_t(-1);
19 constexpr Pos() noexcept = default;
20 constexpr explicit
Pos(uint32_t
off) noexcept
23 constexpr explicit operator bool() const noexcept {
return off !=
Invalid; }
51 constexpr Loc() noexcept = default;
61 :
Loc(
nullptr, pos, pos) {}
65 constexpr uint32_t
size() const noexcept {
78 auto b = std::max(
begin, loc.begin);
79 auto e = std::min(
end, loc.end);
80 if (
src != loc.src || b >= e)
return {};
84 constexpr explicit operator bool() const noexcept {
return (
bool)
begin; }
87 return begin == other.begin &&
end == other.end &&
src == other.src;
102static_assert(
sizeof(
void*) != 8 ||
sizeof(
Loc) == 16,
"Loc should stay two machine words");
The content of one source file together with the offsets its rows start at.
Location within a Src: the half-open byte range [Loc::begin, Loc::end).
constexpr bool operator==(Loc other) const noexcept
constexpr Loc anew_end() const noexcept
constexpr Loc(const Src *src, Pos pos) noexcept
The empty Location at pos.
constexpr Loc() noexcept=default
Creates an invalid Location.
constexpr Loc operator&(Loc loc) const noexcept
The overlap of both Locations - invalid if they are disjoint or sit in different files.
friend std::ostream & operator<<(std::ostream &os, Loc loc)
Streams as path:row:col-row:col, resolved through Loc::src - or as raw offsets if it has none.
constexpr Loc operator+(Loc loc) const noexcept
The hull of both Locations.
constexpr Loc operator+(Pos pos) const noexcept
Style
How much of a Loc a diagnostic spells out; see Diag::loc_style.
constexpr Loc anew_begin() const noexcept
constexpr Loc(Pos pos) noexcept
Pos end
It's called end because - just like an STL iterator - it refers to the byte one past the last one wit...
constexpr Loc(Pos begin, Pos end) noexcept
constexpr uint32_t size() const noexcept
Byte offset into a Src; pass around as value.
static constexpr uint32_t Invalid
constexpr Pos operator+(uint32_t n) const noexcept
friend std::ostream & operator<<(std::ostream &os, Pos pos)
constexpr auto operator<=>(const Pos &) const noexcept=default
constexpr Pos() noexcept=default
Creates an invalid Position.