Loom C API
Public Loom compiler C API
Loading...
Searching...
No Matches
loomc_diagnostic_t Struct Reference

Borrowed diagnostic view owned by a result object. More...

#include <diagnostic.h>

Data Fields

loomc_diagnostic_severity_t severity
 Diagnostic severity.
loomc_string_view_t code
 Stable diagnostic code.
loomc_string_view_t message
 Human-readable rendered message.
loomc_string_view_t formatted_text
 Canonical human-readable rendering of the complete diagnostic.
loomc_source_range_t range
 Primary source range.
const loomc_diagnostic_related_location_t * related_locations
 Related locations in producer order, or NULL when the count is zero.
loomc_host_size_t related_location_count
 Number of entries in related_locations.
loomc_host_size_t related_location_omitted_count
 Number of additional resolved locations omitted by the producer's limit.
const loomc_diagnostic_parameter_t * parameters
 Named rendered parameters in diagnostic-definition order, or NULL when the count is zero.
loomc_host_size_t parameter_count
 Number of entries in parameters.
loomc_string_view_t formatted_json
 Canonical JSON object for the native compiler diagnostic, without a trailing newline.

Detailed Description

Borrowed diagnostic view owned by a result object.

Lifetime
Diagnostic strings, parameters, related locations, and source ranges are owned by the result that returned this view. They remain valid until that result is released.

Field Documentation

◆ formatted_json

loomc_string_view_t loomc_diagnostic_t::formatted_json

Canonical JSON object for the native compiler diagnostic, without a trailing newline.

This preserves producer-specific fields, typed JSON parameters, source provenance, and fix hints that the common fields above do not express. It is rendered during the operation while compiler-owned values are available and remains valid until the result is released. Empty for diagnostics produced without a native compiler record.

◆ formatted_text

loomc_string_view_t loomc_diagnostic_t::formatted_text

Canonical human-readable rendering of the complete diagnostic.

This includes source excerpts, carets, fix hints, and related locations when available, and ends with a newline. It is intended for terminal and log presentation; tools requiring stable data should consume the structured fields instead. The view is empty when no canonical rendering is available.


The documentation for this struct was generated from the following file: