DiagCode class
#include <slang/diagnostics/Diagnostics.h>
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
- DiagSubsystem getSubsystem() const constexpr
- Gets the subsystem with which this DiagCode is associated.
-
uint16_
t getCode() const constexpr - Gets the raw numeric code of this DiagCode, unique within its subsystem.
- bool showNoteWithNoLocation() const
- Returns true if this code is a note that is allowed to be shown with no location.
- bool coalesceWithDifferingArgs() const
- Returns true if diagnostics with this code can be coalesced even if they have different arguments.
- bool valid() const constexpr
- Checks whether the DiagCode is valid.
Friends
- auto operator<=>(DiagCode left, DiagCode right) defaulted constexpr
- Three way comparison.
Function documentation
bool slang:: DiagCode:: showNoteWithNoLocation() const
Returns true if this code is a note that is allowed to be shown with no location.
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.