[llvm] [NFC] Split portions of DWARFDataExtractor into new class (PR #140096)
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 5 10:05:22 PDT 2025
================
@@ -14,55 +14,42 @@
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/Support/DataExtractor.h"
+#include "llvm/Support/Errc.h"
+#include "llvm/Support/MathExtras.h"
namespace llvm {
-/// A DataExtractor suitable use for parsing dwarf from memory with minimal
-/// dwarf context--no sections and no objects. getRelocated* functions
-/// return raw values.
+/// A DataExtractor suitable use for parsing dwarf from memory. Clients use
+/// Relocator::getRelocatedValueImpl to relocate values as appropriate.
-class DWARFDataExtractorSimple : public DataExtractor {
+template <class Relocator> class DWARFDataExtractorBase : public DataExtractor {
public:
- DWARFDataExtractorSimple(StringRef Data, bool IsLittleEndian,
- uint8_t AddressSize)
+ DWARFDataExtractorBase(StringRef Data, bool IsLittleEndian,
+ uint8_t AddressSize)
: DataExtractor(Data, IsLittleEndian, AddressSize) {}
- DWARFDataExtractorSimple(ArrayRef<uint8_t> Data, bool IsLittleEndian,
- uint8_t AddressSize)
+ DWARFDataExtractorBase(ArrayRef<uint8_t> Data, bool IsLittleEndian,
+ uint8_t AddressSize)
: DataExtractor(
StringRef(reinterpret_cast<const char *>(Data.data()), Data.size()),
IsLittleEndian, AddressSize) {}
/// Truncating constructor
- DWARFDataExtractorSimple(const DWARFDataExtractorSimple &Other, size_t Length)
+ DWARFDataExtractorBase(const DWARFDataExtractorBase &Other, size_t Length)
: DataExtractor(Other.getData().substr(0, Length), Other.isLittleEndian(),
Other.getAddressSize()) {}
- virtual ~DWARFDataExtractorSimple() = default;
+ ~DWARFDataExtractorBase() {}
----------------
dwblaikie wrote:
Remove this since it's the default, probably?
https://github.com/llvm/llvm-project/pull/140096
More information about the llvm-commits
mailing list