File indexing completed on 2026-05-10 08:37:12
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef LLVM_CLANG_TOOLING_REPLACEMENTSYAML_H
0016 #define LLVM_CLANG_TOOLING_REPLACEMENTSYAML_H
0017
0018 #include "clang/Tooling/Refactoring.h"
0019 #include "llvm/Support/YAMLTraits.h"
0020 #include <string>
0021
0022 LLVM_YAML_IS_SEQUENCE_VECTOR(clang::tooling::Replacement)
0023
0024 namespace llvm {
0025 namespace yaml {
0026
0027
0028
0029 template <> struct MappingTraits<clang::tooling::Replacement> {
0030
0031
0032 struct NormalizedReplacement {
0033 NormalizedReplacement(const IO &) : Offset(0), Length(0) {}
0034
0035 NormalizedReplacement(const IO &, const clang::tooling::Replacement &R)
0036 : FilePath(R.getFilePath()), Offset(R.getOffset()),
0037 Length(R.getLength()), ReplacementText(R.getReplacementText()) {}
0038
0039 clang::tooling::Replacement denormalize(const IO &) {
0040 return clang::tooling::Replacement(FilePath, Offset, Length,
0041 ReplacementText);
0042 }
0043
0044 std::string FilePath;
0045 unsigned int Offset;
0046 unsigned int Length;
0047 std::string ReplacementText;
0048 };
0049
0050 static void mapping(IO &Io, clang::tooling::Replacement &R) {
0051 MappingNormalization<NormalizedReplacement, clang::tooling::Replacement>
0052 Keys(Io, R);
0053 Io.mapRequired("FilePath", Keys->FilePath);
0054 Io.mapRequired("Offset", Keys->Offset);
0055 Io.mapRequired("Length", Keys->Length);
0056 Io.mapRequired("ReplacementText", Keys->ReplacementText);
0057 }
0058 };
0059
0060
0061
0062 template <> struct MappingTraits<clang::tooling::TranslationUnitReplacements> {
0063 static void mapping(IO &Io,
0064 clang::tooling::TranslationUnitReplacements &Doc) {
0065 Io.mapRequired("MainSourceFile", Doc.MainSourceFile);
0066 Io.mapRequired("Replacements", Doc.Replacements);
0067 }
0068 };
0069 }
0070 }
0071
0072 #endif