32 lines
832 B
C++
32 lines
832 B
C++
#ifndef FESA_CORE_DIAGNOSTIC_H_
|
|
#define FESA_CORE_DIAGNOSTIC_H_
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "fesa/core/source_identity.h"
|
|
|
|
namespace fesa {
|
|
|
|
/// @brief Distinguishes recoverable warnings from operation-stopping errors.
|
|
enum class Severity { kWarning, kError };
|
|
|
|
/// @brief Carries a structured, backend-independent diagnostic record.
|
|
struct Diagnostic {
|
|
Severity severity;
|
|
std::string code;
|
|
SourceLocation location;
|
|
std::string keyword;
|
|
std::string entity_identity;
|
|
std::string message;
|
|
};
|
|
|
|
/// @brief Orders diagnostics by their externally visible source tuple.
|
|
/// @param diagnostics Records to reorder in place.
|
|
/// @note Records with identical keys retain their discovery order.
|
|
void SortDiagnostics(std::vector<Diagnostic>& diagnostics);
|
|
|
|
} // namespace fesa
|
|
|
|
#endif // FESA_CORE_DIAGNOSTIC_H_
|