|
10 | 10 | #include "ClangTidyModuleRegistry.h"
|
11 | 11 | #include "clang/Basic/LLVM.h"
|
12 | 12 | #include "llvm/ADT/SmallString.h"
|
| 13 | +#include "llvm/ADT/StringExtras.h" |
13 | 14 | #include "llvm/Support/Debug.h"
|
14 |
| -#include "llvm/Support/Errc.h" |
15 | 15 | #include "llvm/Support/ErrorOr.h"
|
16 |
| -#include "llvm/Support/FileSystem.h" |
17 | 16 | #include "llvm/Support/MemoryBufferRef.h"
|
18 | 17 | #include "llvm/Support/Path.h"
|
19 | 18 | #include "llvm/Support/YAMLTraits.h"
|
@@ -126,6 +125,34 @@ void yamlize(IO &IO, ClangTidyOptions::OptionMap &Val, bool,
|
126 | 125 | }
|
127 | 126 | }
|
128 | 127 |
|
| 128 | +namespace { |
| 129 | +struct MultiLineString { |
| 130 | + std::string &S; |
| 131 | +}; |
| 132 | +} // namespace |
| 133 | + |
| 134 | +template <> struct BlockScalarTraits<MultiLineString> { |
| 135 | + static void output(const MultiLineString &S, void *Ctxt, raw_ostream &OS) { |
| 136 | + OS << S.S; |
| 137 | + } |
| 138 | + |
| 139 | + static StringRef input(StringRef Str, void *Ctxt, MultiLineString &S) { |
| 140 | + S.S = Str; |
| 141 | + return ""; |
| 142 | + } |
| 143 | +}; |
| 144 | + |
| 145 | +template <> struct SequenceElementTraits<ClangTidyOptions::CustomCheckValue> { |
| 146 | + static const bool flow = false; |
| 147 | +}; |
| 148 | +template <> struct MappingTraits<ClangTidyOptions::CustomCheckValue> { |
| 149 | + static void mapping(IO &IO, ClangTidyOptions::CustomCheckValue &V) { |
| 150 | + IO.mapRequired("Name", V.Name); |
| 151 | + MultiLineString MLS{V.Query}; |
| 152 | + IO.mapRequired("Query", MLS); |
| 153 | + } |
| 154 | +}; |
| 155 | + |
129 | 156 | struct ChecksVariant {
|
130 | 157 | std::optional<std::string> AsString;
|
131 | 158 | std::optional<std::vector<std::string>> AsVector;
|
@@ -181,6 +208,7 @@ template <> struct MappingTraits<ClangTidyOptions> {
|
181 | 208 | IO.mapOptional("InheritParentConfig", Options.InheritParentConfig);
|
182 | 209 | IO.mapOptional("UseColor", Options.UseColor);
|
183 | 210 | IO.mapOptional("SystemHeaders", Options.SystemHeaders);
|
| 211 | + IO.mapOptional("CustomeChecks", Options.CustomChecks); |
184 | 212 | }
|
185 | 213 | };
|
186 | 214 |
|
@@ -249,6 +277,8 @@ ClangTidyOptions &ClangTidyOptions::mergeWith(const ClangTidyOptions &Other,
|
249 | 277 | ClangTidyValue(KeyValue.getValue().Value,
|
250 | 278 | KeyValue.getValue().Priority + Order));
|
251 | 279 | }
|
| 280 | + mergeVectors(CustomChecks, Other.CustomChecks); |
| 281 | + |
252 | 282 | return *this;
|
253 | 283 | }
|
254 | 284 |
|
|
0 commit comments