struct Diagnostic

Defined at line 167 of file ../../tools/fidl/fidlc/src/diagnostic_types.h

A Diagnostic is the result of instantiating a DiagnosticDef with arguments.

It stores a formatted std::string where "{}" markers have been replaced by

arguments. It also stores a SourceSpan indicating where the problem occurred.

Public Members

const DiagnosticDef & def
SourceSpan span
basic_string msg

Public Methods

template <typename... Args>
void Diagnostic (const DiagnosticDef & def, SourceSpan span, const Args &... args)

Defined at line 169 of file ../../tools/fidl/fidlc/src/diagnostic_types.h

void Diagnostic (const Diagnostic & )

Defined at line 171 of file ../../tools/fidl/fidlc/src/diagnostic_types.h

std::string Format ()

Formats the error message to a string.

template <ErrorId Id, typename... Args>
std::unique_ptr<Diagnostic> MakeError (const ErrorDef<Id, Args...> & def, SourceSpan span, const cpp20::type_identity_t<Args> &... args)

The factory functions below could be constructors, and std::make_unique

would work fine. However, template error messages are better with static

functions because it doesn't have to try every constructor.

Defined at line 178 of file ../../tools/fidl/fidlc/src/diagnostic_types.h

template <ErrorId Id, typename... Args>
std::unique_ptr<Diagnostic> MakeWarning (const WarningDef<Id, Args...> & def, SourceSpan span, const cpp20::type_identity_t<Args> &... args)

Defined at line 184 of file ../../tools/fidl/fidlc/src/diagnostic_types.h