[Lldb-commits] [lldb] [lldb] Remove unused argument of DataExtractor constructor (NFC) (PR #191876)
Sergei Barannikov via lldb-commits
lldb-commits at lists.llvm.org
Mon Apr 13 12:04:18 PDT 2026
https://github.com/s-barannikov created https://github.com/llvm/llvm-project/pull/191876
`AddressSize` parameter is not used by `DataExtractor` and will be removed in the future. See #190519 for more context.
This also removes two of the four related methods:
```
DataExtractor::GetAsLLVM()
DataExtractor::GetAsLLVMDWARF() - removed as unused
DWARFDataExtractor::GetAsLLVM() - removed as redundant, it hid the equivalent method of DataExtractor
DWARFDataExtractor::GetAsLLVMDWARF()
```
That is, now we have:
```
DataExtractor::GetAsLLVM()
DWARFDataExtractor::GetAsLLVMDWARF()
```
>From 9608b934033766dc95b8e18bed7d84193899b96d Mon Sep 17 00:00:00 2001
From: Sergei Barannikov <barannikov88 at gmail.com>
Date: Mon, 13 Apr 2026 21:48:15 +0300
Subject: [PATCH] [lldb] Remove unused argument of DataExtractor constructor
(NFC)
`AddressSize` parameter is not used by `DataExtractor` and will be
removed in the future. See #190519 for more context.
This also removes two of the four related methods:
```
DataExtractor::GetAsLLVM()
DataExtractor::GetAsLLVMDWARF() - removed (1)
DWARFDataExtractor::GetAsLLVM() - removed (2)
DWARFDataExtractor::GetAsLLVMDWARF()
```
(1) was unused, (2) hid the equivalent method of `DataExtractor`.
---
lldb/include/lldb/Utility/DataExtractor.h | 9 +--------
lldb/source/DataFormatters/FormatterBytecode.cpp | 4 ++--
.../Plugins/SymbolFile/DWARF/DWARFDataExtractor.cpp | 6 +-----
.../source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h | 1 -
lldb/source/Symbol/UnwindPlan.cpp | 3 +--
lldb/unittests/Symbol/PostfixExpressionTest.cpp | 3 +--
.../NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp | 2 +-
7 files changed, 7 insertions(+), 21 deletions(-)
diff --git a/lldb/include/lldb/Utility/DataExtractor.h b/lldb/include/lldb/Utility/DataExtractor.h
index deacdf072ecc7..c1f1a424874a4 100644
--- a/lldb/include/lldb/Utility/DataExtractor.h
+++ b/lldb/include/lldb/Utility/DataExtractor.h
@@ -1034,15 +1034,8 @@ class DataExtractor {
return {GetDataStart(), size_t(GetByteSize())};
}
- llvm::DWARFDataExtractor GetAsLLVMDWARF() const {
- return llvm::DWARFDataExtractor(GetData(),
- GetByteOrder() == lldb::eByteOrderLittle,
- GetAddressByteSize());
- }
-
llvm::DataExtractor GetAsLLVM() const {
- return {GetData(), GetByteOrder() == lldb::eByteOrderLittle,
- uint8_t(GetAddressByteSize())};
+ return {GetData(), GetByteOrder() == lldb::eByteOrderLittle};
}
protected:
diff --git a/lldb/source/DataFormatters/FormatterBytecode.cpp b/lldb/source/DataFormatters/FormatterBytecode.cpp
index ab6d826d5ff80..c3d64a3fc4c04 100644
--- a/lldb/source/DataFormatters/FormatterBytecode.cpp
+++ b/lldb/source/DataFormatters/FormatterBytecode.cpp
@@ -187,7 +187,7 @@ llvm::Error Interpret(ControlStack &control, DataStack &data, Signatures sig) {
return llvm::Error::success();
// Since the only data types are single endian and ULEBs, the
// endianness should not matter.
- llvm::DataExtractor cur_block(control.back(), true, 64);
+ llvm::DataExtractor cur_block(control.back(), true);
llvm::DataExtractor::Cursor pc(0);
while (!control.empty()) {
@@ -196,7 +196,7 @@ llvm::Error Interpret(ControlStack &control, DataStack &data, Signatures sig) {
// Save the return address.
if (control.size() > 1)
control[control.size() - 2] = cur_block.getData().drop_front(pc.tell());
- cur_block = llvm::DataExtractor(control.back(), true, 64);
+ cur_block = llvm::DataExtractor(control.back(), true);
if (pc)
pc = llvm::DataExtractor::Cursor(0);
};
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.cpp
index a0b8acb585635..d49d6a9b48e16 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.cpp
@@ -16,9 +16,5 @@ llvm::DWARFDataExtractor DWARFDataExtractor::GetAsLLVMDWARF() const {
GetByteOrder() == lldb::eByteOrderLittle,
GetAddressByteSize());
}
-llvm::DataExtractor DWARFDataExtractor::GetAsLLVM() const {
- return llvm::DataExtractor(llvm::ArrayRef(GetDataStart(), GetByteSize()),
- GetByteOrder() == lldb::eByteOrderLittle,
- GetAddressByteSize());
-}
+
} // namespace lldb_private
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h
index f6bcf9b2d27f7..11d023c8f0661 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h
@@ -23,7 +23,6 @@ class DWARFDataExtractor : public DataExtractor {
: DataExtractor(data, offset, length) {}
llvm::DWARFDataExtractor GetAsLLVMDWARF() const;
- llvm::DataExtractor GetAsLLVM() const;
};
} // namespace lldb_private
diff --git a/lldb/source/Symbol/UnwindPlan.cpp b/lldb/source/Symbol/UnwindPlan.cpp
index 9245e52732061..ca6ccd9f6f55a 100644
--- a/lldb/source/Symbol/UnwindPlan.cpp
+++ b/lldb/source/Symbol/UnwindPlan.cpp
@@ -86,8 +86,7 @@ GetByteOrderAndAddrSize(Thread *thread) {
static void DumpDWARFExpr(Stream &s, llvm::ArrayRef<uint8_t> expr, Thread *thread) {
if (auto order_and_width = GetByteOrderAndAddrSize(thread)) {
- llvm::DataExtractor data(expr, order_and_width->first == eByteOrderLittle,
- order_and_width->second);
+ llvm::DataExtractor data(expr, order_and_width->first == eByteOrderLittle);
llvm::DWARFExpression E(data, order_and_width->second,
llvm::dwarf::DWARF32);
printDwarfExpression(&E, s.AsRawOstream(), llvm::DIDumpOptions(), nullptr);
diff --git a/lldb/unittests/Symbol/PostfixExpressionTest.cpp b/lldb/unittests/Symbol/PostfixExpressionTest.cpp
index 2f941efe9e672..b960811800a0c 100644
--- a/lldb/unittests/Symbol/PostfixExpressionTest.cpp
+++ b/lldb/unittests/Symbol/PostfixExpressionTest.cpp
@@ -155,8 +155,7 @@ static std::string ParseAndGenerateDWARF(llvm::StringRef expr) {
ToDWARF(*ast, dwarf);
// print dwarf expression to comparable textual representation
- llvm::DataExtractor extractor(dwarf.GetString(), /*IsLittleEndian=*/true,
- addr_size);
+ llvm::DataExtractor extractor(dwarf.GetString(), /*IsLittleEndian=*/true);
std::string result;
llvm::raw_string_ostream os(result);
diff --git a/lldb/unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp b/lldb/unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp
index eb618b74fb136..f3ee0186d99b4 100644
--- a/lldb/unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp
+++ b/lldb/unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp
@@ -36,7 +36,7 @@ CheckValidProgramTranslation(llvm::StringRef fpo_program,
// print dwarf expression to comparable textual representation
llvm::DataExtractor extractor({stream.GetData(), stream.GetSize()},
- /*IsLittleEndian=*/true, /*AddressSize=*/4);
+ /*IsLittleEndian=*/true);
std::string result;
llvm::raw_string_ostream os(result);
More information about the lldb-commits
mailing list