[DWARFYAML] Refactor emitDebugInfo() to make the length be inferred.
authorXing GUO <higuoxing@gmail.com>
Thu, 23 Jul 2020 15:00:19 +0000 (23:00 +0800)
committerXing GUO <higuoxing@gmail.com>
Thu, 23 Jul 2020 15:00:19 +0000 (23:00 +0800)
commit92874d286695d2233a3fc526b07896c3676ec1d3
tree4ef97451e57699ae33a4c8ce26594e87e803ebd5
parenta997e6edb9619dcc02696ee45131e892626f0e60
[DWARFYAML] Refactor emitDebugInfo() to make the length be inferred.

This patch refactors `emitDebugInfo()` to make the length field be
inferred from its content. Besides, the `Visitor` class is removed in
this patch. The original `Visitor` class helps us determine an
appropriate length and emit the .debug_info section. These two
processes can be merged into one process. Besides, the length field
should be inferred when it's missing rather than when it's zero.

Reviewed By: jhenderson, labath

Differential Revision: https://reviews.llvm.org/D84008
lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp
llvm/include/llvm/ObjectYAML/DWARFEmitter.h
llvm/include/llvm/ObjectYAML/DWARFYAML.h
llvm/lib/ObjectYAML/CMakeLists.txt
llvm/lib/ObjectYAML/DWARFEmitter.cpp
llvm/lib/ObjectYAML/DWARFVisitor.cpp [deleted file]
llvm/lib/ObjectYAML/DWARFVisitor.h [deleted file]
llvm/lib/ObjectYAML/DWARFYAML.cpp
llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp