[llvm] [DWARFLinker] Remove unused argument of DataExtractor constructor (NFC) (PR #196364)
via llvm-commits
llvm-commits at lists.llvm.org
Thu May 7 09:46:44 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-debuginfo
Author: Sergei Barannikov (s-barannikov)
<details>
<summary>Changes</summary>
`AddressSize` parameter is not used by `DataExtractor` and will be removed in the future. See #<!-- -->190519 for more context. As a drive-by change, use the constructor taking ArrayRef where it allows removing extra casts.
---
Full diff: https://github.com/llvm/llvm-project/pull/196364.diff
7 Files Affected:
- (modified) llvm/include/llvm/DWARFLinker/AddressesMap.h (+1-2)
- (modified) llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp (+4-7)
- (modified) llvm/lib/DWARFLinker/Classic/DWARFLinkerCompileUnit.cpp (+1-3)
- (modified) llvm/lib/DWARFLinker/Parallel/DIEAttributeCloner.cpp (+1-3)
- (modified) llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp (+1-2)
- (modified) llvm/lib/DWARFLinker/Parallel/DWARFLinkerImpl.cpp (+1-1)
- (modified) llvm/tools/dsymutil/DwarfLinkerForBinary.cpp (+1-1)
``````````diff
diff --git a/llvm/include/llvm/DWARFLinker/AddressesMap.h b/llvm/include/llvm/DWARFLinker/AddressesMap.h
index f661288c4c51f..38b9a67b124c1 100644
--- a/llvm/include/llvm/DWARFLinker/AddressesMap.h
+++ b/llvm/include/llvm/DWARFLinker/AddressesMap.h
@@ -138,8 +138,7 @@ class AddressesMap {
return std::make_pair(false, std::nullopt);
// Parse 'exprloc' expression.
- DataExtractor Data(toStringRef(*Expr), U->getContext().isLittleEndian(),
- U->getAddressByteSize());
+ DataExtractor Data(*Expr, U->getContext().isLittleEndian());
DWARFExpression Expression(Data, U->getAddressByteSize(),
U->getFormParams().Format);
diff --git a/llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp b/llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp
index 95cddaa7684d4..0739f50231fa6 100644
--- a/llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp
+++ b/llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp
@@ -523,8 +523,7 @@ DWARFLinker::getVariableRelocAdjustment(AddressesMap &RelocMgr,
return std::make_pair(false, std::nullopt);
// Parse 'exprloc' expression.
- DataExtractor Data(toStringRef(*Expr), U->getContext().isLittleEndian(),
- U->getAddressByteSize());
+ DataExtractor Data(*Expr, U->getContext().isLittleEndian());
DWARFExpression Expression(Data, U->getAddressByteSize(),
U->getFormParams().Format);
@@ -1384,8 +1383,7 @@ unsigned DWARFLinker::DIECloner::cloneBlockAttribute(
if (DWARFAttribute::mayHaveLocationExpr(AttrSpec.Attr) &&
(Val.isFormClass(DWARFFormValue::FC_Block) ||
Val.isFormClass(DWARFFormValue::FC_Exprloc))) {
- DataExtractor Data(StringRef((const char *)Bytes.data(), Bytes.size()),
- IsLittleEndian, OrigUnit.getAddressByteSize());
+ DataExtractor Data(Bytes, IsLittleEndian);
DWARFExpression Expr(Data, OrigUnit.getAddressByteSize(),
OrigUnit.getFormParams().Format);
cloneExpression(Data, Expr, File, Unit, Buffer,
@@ -2562,7 +2560,7 @@ void DWARFLinker::patchFrameInfoForObject(LinkContext &Context) {
AllUnitsRanges.insert(CurRange.Range, CurRange.Value);
}
- DataExtractor Data(FrameData, OrigDwarf.isLittleEndian(), 0);
+ DataExtractor Data(FrameData, OrigDwarf.isLittleEndian());
uint64_t InputOffset = 0;
// Store the data of the CIEs defined in this object, keyed by their
@@ -2893,8 +2891,7 @@ Expected<uint64_t> DWARFLinker::DIECloner::cloneAllCompileUnits(
SmallVectorImpl<uint8_t> &OutBytes,
int64_t RelocAdjustment) {
DWARFUnit &OrigUnit = CurrentUnit->getOrigUnit();
- DataExtractor Data(SrcBytes, IsLittleEndian,
- OrigUnit.getAddressByteSize());
+ DataExtractor Data(SrcBytes, IsLittleEndian);
cloneExpression(Data,
DWARFExpression(Data, OrigUnit.getAddressByteSize(),
OrigUnit.getFormParams().Format),
diff --git a/llvm/lib/DWARFLinker/Classic/DWARFLinkerCompileUnit.cpp b/llvm/lib/DWARFLinker/Classic/DWARFLinkerCompileUnit.cpp
index 7fe8f6f77c25b..7620b37c04d0f 100644
--- a/llvm/lib/DWARFLinker/Classic/DWARFLinkerCompileUnit.cpp
+++ b/llvm/lib/DWARFLinker/Classic/DWARFLinkerCompileUnit.cpp
@@ -88,9 +88,7 @@ void CompileUnit::markEverythingAsKept() {
if (auto ExprLockBlock = Value->getAsBlock()) {
// Parse 'exprloc' expression.
- DataExtractor Data(toStringRef(*ExprLockBlock),
- U->getContext().isLittleEndian(),
- U->getAddressByteSize());
+ DataExtractor Data(*ExprLockBlock, U->getContext().isLittleEndian());
DWARFExpression Expression(Data, U->getAddressByteSize(),
U->getFormParams().Format);
diff --git a/llvm/lib/DWARFLinker/Parallel/DIEAttributeCloner.cpp b/llvm/lib/DWARFLinker/Parallel/DIEAttributeCloner.cpp
index 80113504e8199..c58d2937f3ed0 100644
--- a/llvm/lib/DWARFLinker/Parallel/DIEAttributeCloner.cpp
+++ b/llvm/lib/DWARFLinker/Parallel/DIEAttributeCloner.cpp
@@ -565,9 +565,7 @@ size_t DIEAttributeCloner::cloneBlockAttr(
if (DWARFAttribute::mayHaveLocationExpr(AttrSpec.Attr) &&
(Val.isFormClass(DWARFFormValue::FC_Block) ||
Val.isFormClass(DWARFFormValue::FC_Exprloc))) {
- DataExtractor Data(StringRef((const char *)Bytes.data(), Bytes.size()),
- InUnit.getOrigUnit().isLittleEndian(),
- InUnit.getOrigUnit().getAddressByteSize());
+ DataExtractor Data(Bytes, InUnit.getOrigUnit().isLittleEndian());
DWARFExpression Expr(Data, InUnit.getOrigUnit().getAddressByteSize(),
InUnit.getFormParams().Format);
diff --git a/llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp b/llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp
index eb9b3b87f2d39..3f1d5aa09495f 100644
--- a/llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp
+++ b/llvm/lib/DWARFLinker/Parallel/DWARFLinkerCompileUnit.cpp
@@ -518,8 +518,7 @@ void CompileUnit::emitLocations(DebugSectionKind LocationSectionKind) {
CurExpression.Range->HighPC + Patch.AddrAdjustmentValue};
}
- DataExtractor Data(CurExpression.Expr, OrigUnit.isLittleEndian(),
- OrigUnit.getAddressByteSize());
+ DataExtractor Data(CurExpression.Expr, OrigUnit.isLittleEndian());
DWARFExpression InputExpression(Data, OrigUnit.getAddressByteSize(),
OrigUnit.getFormParams().Format);
diff --git a/llvm/lib/DWARFLinker/Parallel/DWARFLinkerImpl.cpp b/llvm/lib/DWARFLinker/Parallel/DWARFLinkerImpl.cpp
index 5595cf9d9cbc5..5b125923aa2ab 100644
--- a/llvm/lib/DWARFLinker/Parallel/DWARFLinkerImpl.cpp
+++ b/llvm/lib/DWARFLinker/Parallel/DWARFLinkerImpl.cpp
@@ -776,7 +776,7 @@ Error DWARFLinkerImpl::LinkContext::cloneAndEmitDebugFrame() {
SectionDescriptor &OutSection =
getOrCreateSectionDescriptor(DebugSectionKind::DebugFrame);
- DataExtractor Data(OrigFrameData, InputDWARFObj.isLittleEndian(), 0);
+ DataExtractor Data(OrigFrameData, InputDWARFObj.isLittleEndian());
uint64_t InputOffset = 0;
// Store the data of the CIEs defined in this object, keyed by their
diff --git a/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp b/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
index 9b883e567e04d..aea59b69b3ee1 100644
--- a/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
+++ b/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
@@ -963,7 +963,7 @@ void DwarfLinkerForBinary::AddressManager::findValidRelocsMachO(
Linker.reportWarning("error reading section", DMO.getObjectFilename());
return;
}
- DataExtractor Data(*ContentsOrErr, Obj.isLittleEndian(), 0);
+ DataExtractor Data(*ContentsOrErr, Obj.isLittleEndian());
bool SkipNext = false;
for (const object::RelocationRef &Reloc : Section.relocations()) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/196364
More information about the llvm-commits
mailing list