slang::DiagCode class

A compact code that represents a diagnostic.

Diagnostics are messages issued to users in the form of notes, warnings, or errors. DiagCodes are partitioned into subystems to help keep unrelated diagnostics separated from each other.

Public static variables

static const std::span<const DiagCode> KnownCodes
A list of all "known" DiagCodes.

Constructors, destructors, conversion operators

DiagCode() constexpr
Default constructor, object will return false for valid.
DiagCode(DiagSubsystem subsystem, uint16_t code) constexpr
Constructs a new DiagCode with the given subsystem and code number.
operator bool() const explicit constexpr
Explicit boolean conversion operator that defers to valid.

Public functions

auto getSubsystem() const -> DiagSubsystem constexpr
Gets the subsystem with which this DiagCode is associated.
auto getCode() const -> uint16_t constexpr
Gets the raw numeric code of this DiagCode, unique within its subsystem.
auto valid() const -> bool constexpr
Checks whether the DiagCode is valid.

Friends

auto operator<=>(DiagCode left, DiagCode right) -> auto defaulted constexpr
Three way comparison.

Function documentation

bool slang::DiagCode::valid() const constexpr

Checks whether the DiagCode is valid.

Any DiagCode with a subsystem of DiagSubsystem::Invalid will return false, (which is true for a default constructed DiagCode object).

Variable documentation

static const std::span<const DiagCode> slang::DiagCode::KnownCodes

A list of all "known" DiagCodes.

Known codes are ones baked into the library by the diagnostic_gen.py tool.