88
99#include " ClangTidyOptions.h"
1010#include " ClangTidyModuleRegistry.h"
11+ #include " clang/Basic/DiagnosticIDs.h"
1112#include " clang/Basic/LLVM.h"
1213#include " llvm/ADT/SmallString.h"
1314#include " llvm/ADT/StringExtras.h"
@@ -71,7 +72,8 @@ struct NOptionMap {
7172 NOptionMap (IO &, const ClangTidyOptions::OptionMap &OptionMap) {
7273 Options.reserve (OptionMap.size ());
7374 for (const auto &KeyValue : OptionMap)
74- Options.emplace_back (std::string (KeyValue.getKey ()), KeyValue.getValue ().Value );
75+ Options.emplace_back (std::string (KeyValue.getKey ()),
76+ KeyValue.getValue ().Value );
7577 }
7678 ClangTidyOptions::OptionMap denormalize (IO &) {
7779 ClangTidyOptions::OptionMap Map;
@@ -135,13 +137,30 @@ template <> struct BlockScalarTraits<MultiLineString> {
135137 static void output (const MultiLineString &S, void *Ctxt, raw_ostream &OS) {
136138 OS << S.S ;
137139 }
138-
139140 static StringRef input (StringRef Str, void *Ctxt, MultiLineString &S) {
140141 S.S = Str;
141142 return " " ;
142143 }
143144};
144145
146+ template <> struct ScalarEnumerationTraits <clang::DiagnosticIDs::Level> {
147+ static void enumeration (IO &IO, clang::DiagnosticIDs::Level &Level) {
148+ IO.enumCase (Level, " Error" , clang::DiagnosticIDs::Level::Error);
149+ IO.enumCase (Level, " Warning" , clang::DiagnosticIDs::Level::Warning);
150+ IO.enumCase (Level, " Note" , clang::DiagnosticIDs::Level::Note);
151+ }
152+ };
153+ template <> struct SequenceElementTraits <ClangTidyOptions::CustomCheckDiag> {
154+ static const bool flow = false ;
155+ };
156+ template <> struct MappingTraits <ClangTidyOptions::CustomCheckDiag> {
157+ static void mapping (IO &IO, ClangTidyOptions::CustomCheckDiag &D) {
158+ IO.mapRequired (" BindName" , D.BindName );
159+ MultiLineString MLS{D.Message };
160+ IO.mapRequired (" Message" , MLS);
161+ IO.mapOptional (" Level" , D.Level );
162+ }
163+ };
145164template <> struct SequenceElementTraits <ClangTidyOptions::CustomCheckValue> {
146165 static const bool flow = false ;
147166};
@@ -150,6 +169,7 @@ template <> struct MappingTraits<ClangTidyOptions::CustomCheckValue> {
150169 IO.mapRequired (" Name" , V.Name );
151170 MultiLineString MLS{V.Query };
152171 IO.mapRequired (" Query" , MLS);
172+ IO.mapRequired (" Diagnostic" , V.Diags );
153173 }
154174};
155175
0 commit comments