diff options
author | Georgii Rymar <grimar@accesssoftek.com> | 2020-10-15 12:44:42 +0300 |
---|---|---|
committer | Georgii Rymar <grimar@accesssoftek.com> | 2020-10-20 11:28:23 +0300 |
commit | b9e2b59680ad1bbfd2b9110b3ebf3d2b22cad51b (patch) | |
tree | 5375e80d76603054b1fa07fa72f318fce1e2b2b3 /lld/lib | |
parent | 6aabbeadae2024f468990e256706148a2c05f644 (diff) | |
download | llvm-project-b9e2b59680ad1bbfd2b9110b3ebf3d2b22cad51b.tar.gz |
[yaml2obj][ELF] - Simplify the code that performs sections validation.
This:
1) Changes the return type of `MappingTraits<T>>::validate` to `std::string`
instead of `StringRef`. It allows to create more complex error messages.
2) It introduces std::vector<std::pair<StringRef, bool>> getEntries():
a new virtual method of Section, which is the base class for all sections.
It returns names of special section specific keys (e.g. "Entries") and flags that
says if them exist in a YAML. The code in validate() uses this list of entries
descriptions to generalize validation.
This approach was discussed in the D89039 thread.
Differential revision: https://reviews.llvm.org/D89463
Diffstat (limited to 'lld/lib')
-rw-r--r-- | lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp index 7f53faaeaea3..3826e97d62b9 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp @@ -740,9 +740,7 @@ struct MappingTraits<NormalizedFile> { io.mapOptional("exports", file.exportInfo); io.mapOptional("dataInCode", file.dataInCode); } - static StringRef validate(IO &io, NormalizedFile &file) { - return StringRef(); - } + static std::string validate(IO &io, NormalizedFile &file) { return {}; } }; } // namespace llvm |