How a diagnostic lays out - and how much of it an Error keeps.
More...
#include <fe/diag.h>
|
| | Diag ()=default |
| | Diag (const Diag &)=delete |
| virtual | ~Diag () |
| virtual std::string | render (const std::function< std::string()> &fmt) const |
| | Postprocesses the text of one Error::Msg; the identity here, see CodeDiag.
|
Each of these streams one piece of a diagnostic; override to lay that piece out differently.
|
| virtual void | loc (std::ostream &, Loc) const |
| | Just the position.
|
| virtual void | header (std::ostream &, Loc, Tag, std::string_view) const |
| | The loc: tag: msg line.
|
| virtual void | snippet (std::ostream &, Loc, Tag) const |
| | The underlined source excerpt.
|
| virtual void | note (std::ostream &, Loc, std::string_view) const |
| | One note below the message it belongs to.
|
| virtual void | summary (std::ostream &, size_t num_errors, size_t num_warnings, bool truncated) const |
|
| uint32_t | gutter = 5 |
| | Width of the line-number column.
|
| uint32_t | max_rows = 8 |
| | Rows a snippet streams before eliding its middle; 0 elides nothing.
|
| uint32_t | max_errors = 0 |
| | Errors recorded before the rest is dropped; 0 keeps everything.
|
| bool | no_snippet = false |
| | If true, a diagnostic is only its header line.
|
| bool | werror = false |
| | If true, a warning is recorded as an error.
|
| Loc::Style | loc_style = Loc::Style::Full |
| | How Diag::loc spells out a position.
|
How a diagnostic lays out - and how much of it an Error keeps.
The knobs below cover the common adjustments; derive and Driver::diag your subclass for the rest.
- Warning
- A subclass that refers back to its Driver does not survive a move; keep the Driver pinned.
Definition at line 19 of file diag.h.
◆ Tag
| Enumerator |
|---|
| Error | |
| Warn | |
| Note | |
Definition at line 21 of file diag.h.
◆ Diag() [1/2]
◆ Diag() [2/2]
| fe::Diag::Diag |
( |
const Diag & | | ) |
|
|
delete |
◆ ~Diag()
| virtual fe::Diag::~Diag |
( |
| ) |
|
|
virtual |
◆ header()
| virtual void fe::Diag::header |
( |
std::ostream & | , |
|
|
Loc | , |
|
|
Tag | , |
|
|
std::string_view | ) const |
|
virtual |
◆ loc()
| virtual void fe::Diag::loc |
( |
std::ostream & | , |
|
|
Loc | ) const |
|
virtual |
◆ note()
| virtual void fe::Diag::note |
( |
std::ostream & | , |
|
|
Loc | , |
|
|
std::string_view | ) const |
|
virtual |
One note below the message it belongs to.
◆ render()
| virtual std::string fe::Diag::render |
( |
const std::function< std::string()> & | fmt | ) |
const |
|
inlinevirtual |
Postprocesses the text of one Error::Msg; the identity here, see CodeDiag.
- Warning
fmt captures its arguments by reference and is only valid for that one call.
Reimplemented in fe::CodeDiag.
Definition at line 50 of file diag.h.
◆ snippet()
| virtual void fe::Diag::snippet |
( |
std::ostream & | , |
|
|
Loc | , |
|
|
Tag | ) const |
|
virtual |
The underlined source excerpt.
◆ summary()
| virtual void fe::Diag::summary |
( |
std::ostream & | , |
|
|
size_t | num_errors, |
|
|
size_t | num_warnings, |
|
|
bool | truncated ) const |
|
virtual |
◆ tag2color()
◆ gutter
| uint32_t fe::Diag::gutter = 5 |
Width of the line-number column.
Definition at line 31 of file diag.h.
◆ loc_style
◆ max_errors
| uint32_t fe::Diag::max_errors = 0 |
Errors recorded before the rest is dropped; 0 keeps everything.
Definition at line 33 of file diag.h.
◆ max_rows
| uint32_t fe::Diag::max_rows = 8 |
Rows a snippet streams before eliding its middle; 0 elides nothing.
Definition at line 32 of file diag.h.
◆ no_snippet
| bool fe::Diag::no_snippet = false |
If true, a diagnostic is only its header line.
Definition at line 34 of file diag.h.
◆ werror
| bool fe::Diag::werror = false |
If true, a warning is recorded as an error.
Definition at line 35 of file diag.h.
The documentation for this class was generated from the following file: