Skip to content

Commit 6a02dc5

Browse files
authored
[lldb] Remove unused argument of DataExtractor constructor (NFC) (#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() ```
1 parent 39b6d89 commit 6a02dc5

7 files changed

Lines changed: 7 additions & 21 deletions

File tree

lldb/include/lldb/Utility/DataExtractor.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,15 +1034,8 @@ class DataExtractor {
10341034
return {GetDataStart(), size_t(GetByteSize())};
10351035
}
10361036

1037-
llvm::DWARFDataExtractor GetAsLLVMDWARF() const {
1038-
return llvm::DWARFDataExtractor(GetData(),
1039-
GetByteOrder() == lldb::eByteOrderLittle,
1040-
GetAddressByteSize());
1041-
}
1042-
10431037
llvm::DataExtractor GetAsLLVM() const {
1044-
return {GetData(), GetByteOrder() == lldb::eByteOrderLittle,
1045-
uint8_t(GetAddressByteSize())};
1038+
return {GetData(), GetByteOrder() == lldb::eByteOrderLittle};
10461039
}
10471040

10481041
protected:

lldb/source/DataFormatters/FormatterBytecode.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ llvm::Error Interpret(ControlStack &control, DataStack &data, Signatures sig) {
187187
return llvm::Error::success();
188188
// Since the only data types are single endian and ULEBs, the
189189
// endianness should not matter.
190-
llvm::DataExtractor cur_block(control.back(), true, 64);
190+
llvm::DataExtractor cur_block(control.back(), true);
191191
llvm::DataExtractor::Cursor pc(0);
192192

193193
while (!control.empty()) {
@@ -196,7 +196,7 @@ llvm::Error Interpret(ControlStack &control, DataStack &data, Signatures sig) {
196196
// Save the return address.
197197
if (control.size() > 1)
198198
control[control.size() - 2] = cur_block.getData().drop_front(pc.tell());
199-
cur_block = llvm::DataExtractor(control.back(), true, 64);
199+
cur_block = llvm::DataExtractor(control.back(), true);
200200
if (pc)
201201
pc = llvm::DataExtractor::Cursor(0);
202202
};

lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,5 @@ llvm::DWARFDataExtractor DWARFDataExtractor::GetAsLLVMDWARF() const {
1616
GetByteOrder() == lldb::eByteOrderLittle,
1717
GetAddressByteSize());
1818
}
19-
llvm::DataExtractor DWARFDataExtractor::GetAsLLVM() const {
20-
return llvm::DataExtractor(llvm::ArrayRef(GetDataStart(), GetByteSize()),
21-
GetByteOrder() == lldb::eByteOrderLittle,
22-
GetAddressByteSize());
23-
}
19+
2420
} // namespace lldb_private

lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ class DWARFDataExtractor : public DataExtractor {
2323
: DataExtractor(data, offset, length) {}
2424

2525
llvm::DWARFDataExtractor GetAsLLVMDWARF() const;
26-
llvm::DataExtractor GetAsLLVM() const;
2726
};
2827
} // namespace lldb_private
2928

lldb/source/Symbol/UnwindPlan.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ GetByteOrderAndAddrSize(Thread *thread) {
8686

8787
static void DumpDWARFExpr(Stream &s, llvm::ArrayRef<uint8_t> expr, Thread *thread) {
8888
if (auto order_and_width = GetByteOrderAndAddrSize(thread)) {
89-
llvm::DataExtractor data(expr, order_and_width->first == eByteOrderLittle,
90-
order_and_width->second);
89+
llvm::DataExtractor data(expr, order_and_width->first == eByteOrderLittle);
9190
llvm::DWARFExpression E(data, order_and_width->second,
9291
llvm::dwarf::DWARF32);
9392
printDwarfExpression(&E, s.AsRawOstream(), llvm::DIDumpOptions(), nullptr);

lldb/unittests/Symbol/PostfixExpressionTest.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ static std::string ParseAndGenerateDWARF(llvm::StringRef expr) {
155155
ToDWARF(*ast, dwarf);
156156

157157
// print dwarf expression to comparable textual representation
158-
llvm::DataExtractor extractor(dwarf.GetString(), /*IsLittleEndian=*/true,
159-
addr_size);
158+
llvm::DataExtractor extractor(dwarf.GetString(), /*IsLittleEndian=*/true);
160159

161160
std::string result;
162161
llvm::raw_string_ostream os(result);

lldb/unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ CheckValidProgramTranslation(llvm::StringRef fpo_program,
3636

3737
// print dwarf expression to comparable textual representation
3838
llvm::DataExtractor extractor({stream.GetData(), stream.GetSize()},
39-
/*IsLittleEndian=*/true, /*AddressSize=*/4);
39+
/*IsLittleEndian=*/true);
4040

4141
std::string result;
4242
llvm::raw_string_ostream os(result);

0 commit comments

Comments
 (0)