slang::Diagnostic class

Wraps up a reported diagnostic along with location in source and any arguments.

Constructors, destructors, conversion operators

Diagnostic() noexcept
Default constructs a new Diagnostic entry.
Diagnostic(DiagCode code, SourceLocation location) noexcept
Constructs a new Diagnostic entry with the given code and location.
Diagnostic(const ast::Symbol& source, DiagCode code, SourceLocation location) noexcept
Constructs a new Diagnostic entry with the given symbol, code and location.

Public functions

auto isError() const -> bool
Returns true if this diagnostic's code is intrinsically considered an error, regardless of what severity mapping rules might be in place.
auto addNote(DiagCode code, SourceLocation location) -> Diagnostic&
Adds a new note to the diagnostic at the given source location.
auto operator<<(const std::string& arg) -> Diagnostic&
Adds an argument to the diagnostic.

Public variables

DiagCode code
The specific kind of diagnostic that was issued.
SourceLocation location
The location in source of the cause of the diagnostic.
const ast::Symbol* symbol
The symbol in which the diagnostic occurred, or null if not applicable.