llvm-project/llvm/tools/llvm-dwp
Greg Clayton 82f12b149f Clean up DWARFFormValue by reducing duplicated code and removing DWARFFormValue::getFixedFormSizes()
In preparation for a follow on patch that improves DWARF parsing speed, clean up DWARFFormValue so that we have can get the fixed byte size of a form value given a DWARFUnit or given the version, address byte size and dwarf32/64.

This patch cleans up code so that everyone is using one of the new DWARFFormValue functions:

static Optional<uint8_t> DWARFFormValue::getFixedByteSize(dwarf::Form Form, const DWARFUnit *U = nullptr);
static Optional<uint8_t> DWARFFormValue::getFixedByteSize(dwarf::Form Form, uint16_t Version, uint8_t AddrSize, bool Dwarf32);

This patch changes DWARFFormValue::skipValue() to rely on the output of DWARFFormValue::getFixedByteSize(...) instead of duplicating the code in each function. This will reduce the number of changes we need to make to DWARF to fewer places in DWARFFormValue when we add support for new form.

This patch also starts to support DWARF64 so that we can get correct byte sizes for forms that vary according the DWARF 32/64.

To reduce the code duplication a new FormSizeHelper pure virtual class was created that can be created as a FormSizeHelperDWARFUnit when you have a DWARFUnit, or FormSizeHelperManual where you manually specify the DWARF version, address byte size and DWARF32/DWARF64. There is now a single implementation of a function that gets the fixed byte size (instead of two where one took a DWARFUnit and one took the DWARF version, address byte size and DWARFFormat enum) and one function to skip the form values.

https://reviews.llvm.org/D26526

llvm-svn: 286597
2016-11-11 16:21:37 +00:00
..
CMakeLists.txt llvm-dwp: Use llvm::Error to improve diagnostic quality/error handling in llvm-dwp 2016-05-12 19:59:54 +00:00
DWPError.cpp llvm-dwp: Use llvm::Error to improve diagnostic quality/error handling in llvm-dwp 2016-05-12 19:59:54 +00:00
DWPError.h llvm-dwp: Add an abstraction for the DWP string pool 2016-05-23 16:32:11 +00:00
DWPStringPool.h llvm-dwp: Fix the build by moving DWPStringPool into the llvm namespace 2016-05-23 16:45:00 +00:00
LLVMBuild.txt
llvm-dwp.cpp Clean up DWARFFormValue by reducing duplicated code and removing DWARFFormValue::getFixedFormSizes() 2016-11-11 16:21:37 +00:00