42 template<
class... Args>
Error&
error(
Loc loc, std::format_string<Args...> fmt, Args&&... args) {
return error_.
error(loc, fmt, std::forward<Args>(args)...); }
43 template<
class... Args>
Error&
warn (
Loc loc, std::format_string<Args...> fmt, Args&&... args) {
return error_.
warn (loc, fmt, std::forward<Args>(args)...); }
44 template<
class... Args>
Error&
note ( std::format_string<Args...> fmt, Args&&... args) {
return error_.
note ( fmt, std::forward<Args>(args)...); }
45 template<
class... Args>
Error&
note (
Loc loc, std::format_string<Args...> fmt, Args&&... args) {
return error_.
note (loc, fmt, std::forward<Args>(args)...); }
53 std::unique_ptr<Diag>
diag(std::unique_ptr<Diag>
diag) {
54 assert(
diag &&
"a Driver always has a Diag");
55 return std::exchange(diag_, std::move(
diag));
75 if (
auto i = dbg2key_.find(
dbg); i != dbg2key_.end())
return DbgKey(i->second);
76 auto key = uint32_t(dbgs_.size());
77 dbgs_.emplace_back(
dbg);
78 dbg2key_.emplace(
dbg, key);
84 std::unique_ptr<Diag> diag_;
88 DbgMap<uint32_t> dbg2key_ = {
Opaque handle to a Dbg interned in a Driver; see Driver::dbg.
constexpr DbgKey() noexcept=default
The empty Dbg.
How a diagnostic lays out - and how much of it an Error keeps.
Collects diagnostics and hands each to the Diag that lays it out.
Error & warn(Loc loc, std::format_string< Args... > s, Args &&... args)
Error & note(std::format_string< Args... > s, Args &&... args)
A = note: continuation of the diagnostic being built; it has no Loc of its own to point at.
Error & error(Loc loc, std::format_string< Args... > s, Args &&... args)
Interns the text - and the std::filesystem::path - of every file a Loc may point into.
SymPool(const SymPool &)=delete
This is a thin wrapper for absl::InlinedVector<T, N, A> which is a drop-in replacement for std::vecto...
The debug info of an entity: where it came from and what it was called.
constexpr Dbg() noexcept=default
Error & note(Loc loc, std::format_string< Args... > fmt, Args &&... args)
const Error & error() const
Dbg dbg(DbgKey key) const
Error & warn(Loc loc, std::format_string< Args... > fmt, Args &&... args)
Driver(const Driver &)=delete
DbgKey dbg(Dbg dbg)
Interns dbg and yields its DbgKey.
const SrcMap & src() const
Error & error(Loc loc, std::format_string< Args... > fmt, Args &&... args)
Driver(std::unique_ptr< Diag > diag)
Installs diag right away, so Driver::error renders through it from the very first message.
Error & note(std::format_string< Args... > fmt, Args &&... args)
std::unique_ptr< Diag > diag(std::unique_ptr< Diag > diag)
Installs diag - a subclass of your own, typically - and yields the previous one.
Driver & operator=(Driver)=delete
const Diag & diag() const
Location within a Src: the half-open byte range [Loc::begin, Loc::end).