[all-commits] [llvm/llvm-project] b9e2b5: [yaml2obj][ELF] - Simplify the code that performs ...

Georgii Rymar via All-commits all-commits at lists.llvm.org
Tue Oct 20 01:28:56 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b9e2b59680ad1bbfd2b9110b3ebf3d2b22cad51b
      https://github.com/llvm/llvm-project/commit/b9e2b59680ad1bbfd2b9110b3ebf3d2b22cad51b
  Author: Georgii Rymar <grimar at accesssoftek.com>
  Date:   2020-10-20 (Tue, 20 Oct 2020)

  Changed paths:
    M lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
    M llvm/include/llvm/ObjectYAML/DWARFYAML.h
    M llvm/include/llvm/ObjectYAML/ELFYAML.h
    M llvm/include/llvm/ObjectYAML/MachOYAML.h
    M llvm/include/llvm/ObjectYAML/MinidumpYAML.h
    M llvm/include/llvm/Support/YAMLTraits.h
    M llvm/lib/ObjectYAML/DWARFYAML.cpp
    M llvm/lib/ObjectYAML/ELFYAML.cpp
    M llvm/lib/ObjectYAML/MachOYAML.cpp
    M llvm/lib/ObjectYAML/MinidumpYAML.cpp
    M llvm/test/tools/yaml2obj/ELF/gnu-hash-section.yaml
    M llvm/unittests/Support/YAMLIOTest.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list