15#ifndef LLVM_CLANG_TOOLING_DIAGNOSTICSYAML_H
16#define LLVM_CLANG_TOOLING_DIAGNOSTICSYAML_H
20#include "llvm/Support/YAMLTraits.h"
30template <>
struct MappingTraits<
clang::tooling::FileByteRange> {
32 Io.mapRequired(
"FilePath", R.
FilePath);
34 Io.mapRequired(
"Length", R.
Length);
38template <>
struct MappingTraits<
clang::tooling::DiagnosticMessage> {
40 Io.mapRequired(
"Message", M.
Message);
41 Io.mapOptional(
"FilePath", M.
FilePath);
43 std::vector<clang::tooling::Replacement> Fixes;
44 for (
auto &Replacements : M.
Fix) {
45 llvm::append_range(Fixes, Replacements.second);
47 Io.mapRequired(
"Replacements", Fixes);
48 for (
auto &Fix : Fixes) {
49 llvm::Error Err = M.
Fix[Fix.getFilePath()].add(Fix);
52 llvm::errs() <<
"Fix conflicts with existing fix: "
53 << llvm::toString(std::move(Err)) <<
"\n";
56 Io.mapOptional(
"Ranges", M.
Ranges);
60template <>
struct MappingTraits<
clang::tooling::Diagnostic> {
63 class NormalizedDiagnostic {
66 : DiagLevel(
clang::tooling::Diagnostic::Level::Warning) {}
69 : DiagnosticName(
D.DiagnosticName), Message(
D.Message), Notes(
D.Notes),
70 DiagLevel(
D.DiagLevel), BuildDirectory(
D.BuildDirectory) {}
74 DiagLevel, BuildDirectory);
85 MappingNormalization<NormalizedDiagnostic, clang::tooling::Diagnostic> Keys(
87 Io.mapRequired(
"DiagnosticName", Keys->DiagnosticName);
88 Io.mapRequired(
"DiagnosticMessage", Keys->Message);
89 Io.mapOptional(
"Notes", Keys->Notes);
90 Io.mapOptional(
"Level", Keys->DiagLevel);
91 Io.mapOptional(
"BuildDirectory", Keys->BuildDirectory);
97template <>
struct MappingTraits<
clang::tooling::TranslationUnitDiagnostics> {
104template <>
struct ScalarEnumerationTraits<
clang::tooling::Diagnostic::Level> {
This file defines the structure of a YAML document for serializing replacements.
The JSON file list parser is used to communicate input to InstallAPI.
Diagnostic wrappers for TextAPI types for error reporting.