19 static constexpr uint32_t
Invalid = uint32_t(-1);
21 constexpr Pos() =
default;
25 constexpr explicit operator bool()
const {
return off !=
Invalid; }
55 constexpr Loc() =
default;
65 :
Loc(nullptr, pos, pos) {}
69 constexpr uint32_t
size()
const {
83 auto e = std::min(
end, loc.
end);
84 if (
src != loc.
src || b >= e)
return {};
88 constexpr explicit operator bool()
const {
return (
bool)
begin; }
106static_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 Loc operator+(Loc loc) const
The hull of both Locations.
constexpr Loc operator&(Loc loc) const
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(const Src *src, Pos begin, Pos end)
constexpr bool operator==(Loc other) const
constexpr Loc anew_end() const
Style
How much of a Loc a diagnostic spells out; see Diag::loc_style.
constexpr uint32_t size() const
constexpr Loc operator+(Pos pos) const
constexpr Loc()=default
Creates an invalid Location.
constexpr Loc(const Src *src, Pos pos)
The empty Location at pos.
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)
constexpr Loc anew_begin() const
Byte offset into a Src; pass around as value.
static constexpr uint32_t Invalid
friend std::ostream & operator<<(std::ostream &os, Pos pos)
fe/loc.h only declares the stream output and dump helpers.
constexpr Pos operator+(uint32_t n) const
constexpr auto operator<=>(const Pos &) const =default
constexpr Pos(uint32_t off)
constexpr Pos()=default
Creates an invalid Position.