projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dsymutil: Make resolveDIEReference and getUnitForOffset static functions.
[oota-llvm.git]
/
tools
/
dsymutil
/
DwarfLinker.cpp
diff --git
a/tools/dsymutil/DwarfLinker.cpp
b/tools/dsymutil/DwarfLinker.cpp
index f74486ef75b60396f6cf389e1b59c3fbd0849b9e..039e7a3e43cd0f32a64d53d48ac642088b47a308 100644
(file)
--- a/
tools/dsymutil/DwarfLinker.cpp
+++ b/
tools/dsymutil/DwarfLinker.cpp
@@
-1375,13
+1375,6
@@
private:
/// \defgroup Helpers Various helper methods.
///
/// @{
/// \defgroup Helpers Various helper methods.
///
/// @{
- const DWARFDebugInfoEntryMinimal *
- resolveDIEReference(const DWARFFormValue &RefValue, const DWARFUnit &Unit,
- const DWARFDebugInfoEntryMinimal &DIE,
- CompileUnit *&ReferencedCU);
-
- CompileUnit *getUnitForOffset(unsigned Offset);
-
bool createStreamer(Triple TheTriple, StringRef OutputFilename);
/// \brief Attempt to load a debug object from disk.
bool createStreamer(Triple TheTriple, StringRef OutputFilename);
/// \brief Attempt to load a debug object from disk.
@@
-1425,9
+1418,10
@@
private:
uint32_t LastCIEOffset;
};
uint32_t LastCIEOffset;
};
-/// \brief Similar to DWARFUnitSection::getUnitForOffset(), but
-/// returning our CompileUnit object instead.
-CompileUnit *DwarfLinker::getUnitForOffset(unsigned Offset) {
+/// Similar to DWARFUnitSection::getUnitForOffset(), but returning our
+/// CompileUnit object instead.
+static CompileUnit *getUnitForOffset(MutableArrayRef<CompileUnit> Units,
+ unsigned Offset) {
auto CU =
std::upper_bound(Units.begin(), Units.end(), Offset,
[](uint32_t LHS, const CompileUnit &RHS) {
auto CU =
std::upper_bound(Units.begin(), Units.end(), Offset,
[](uint32_t LHS, const CompileUnit &RHS) {
@@
-1436,21
+1430,22
@@
CompileUnit *DwarfLinker::getUnitForOffset(unsigned Offset) {
return CU != Units.end() ? &*CU : nullptr;
}
return CU != Units.end() ? &*CU : nullptr;
}
-///
\brief
Resolve the DIE attribute reference that has been
+/// Resolve the DIE attribute reference that has been
/// extracted in \p RefValue. The resulting DIE migh be in another
/// CompileUnit which is stored into \p ReferencedCU.
/// \returns null if resolving fails for any reason.
/// extracted in \p RefValue. The resulting DIE migh be in another
/// CompileUnit which is stored into \p ReferencedCU.
/// \returns null if resolving fails for any reason.
-const DWARFDebugInfoEntryMinimal *DwarfLinker::resolveDIEReference(
+static const DWARFDebugInfoEntryMinimal *resolveDIEReference(
+ const DwarfLinker &Linker, MutableArrayRef<CompileUnit> Units,
const DWARFFormValue &RefValue, const DWARFUnit &Unit,
const DWARFDebugInfoEntryMinimal &DIE, CompileUnit *&RefCU) {
assert(RefValue.isFormClass(DWARFFormValue::FC_Reference));
uint64_t RefOffset = *RefValue.getAsReference(&Unit);
const DWARFFormValue &RefValue, const DWARFUnit &Unit,
const DWARFDebugInfoEntryMinimal &DIE, CompileUnit *&RefCU) {
assert(RefValue.isFormClass(DWARFFormValue::FC_Reference));
uint64_t RefOffset = *RefValue.getAsReference(&Unit);
- if ((RefCU = getUnitForOffset(RefOffset)))
+ if ((RefCU = getUnitForOffset(
Units,
RefOffset)))
if (const auto *RefDie = RefCU->getOrigUnit().getDIEForOffset(RefOffset))
return RefDie;
if (const auto *RefDie = RefCU->getOrigUnit().getDIEForOffset(RefOffset))
return RefDie;
- reportWarning("could not find referenced DIE", &Unit, &DIE);
+
Linker.
reportWarning("could not find referenced DIE", &Unit, &DIE);
return nullptr;
}
return nullptr;
}
@@
-2102,7
+2097,8
@@
void DwarfLinker::keepDIEAndDependencies(RelocationManager &RelocMgr,
Val.extractValue(Data, &Offset, &Unit);
CompileUnit *ReferencedCU;
if (const auto *RefDIE =
Val.extractValue(Data, &Offset, &Unit);
CompileUnit *ReferencedCU;
if (const auto *RefDIE =
- resolveDIEReference(Val, Unit, Die, ReferencedCU)) {
+ resolveDIEReference(*this, MutableArrayRef<CompileUnit>(Units), Val,
+ Unit, Die, ReferencedCU)) {
uint32_t RefIdx = ReferencedCU->getOrigUnit().getDIEIndex(RefDIE);
CompileUnit::DIEInfo &Info = ReferencedCU->getInfo(RefIdx);
// If the referenced DIE has a DeclContext that has already been
uint32_t RefIdx = ReferencedCU->getOrigUnit().getDIEIndex(RefDIE);
CompileUnit::DIEInfo &Info = ReferencedCU->getInfo(RefIdx);
// If the referenced DIE has a DeclContext that has already been
@@
-2231,7
+2227,7
@@
unsigned DwarfLinker::DIECloner::cloneDieReferenceAttribute(
DeclContext *Ctxt = nullptr;
const DWARFDebugInfoEntryMinimal *RefDie =
DeclContext *Ctxt = nullptr;
const DWARFDebugInfoEntryMinimal *RefDie =
-
Linker.resolveDIEReference(
Val, U, InputDIE, RefUnit);
+
resolveDIEReference(Linker, CompileUnits,
Val, U, InputDIE, RefUnit);
// If the referenced DIE is not found, drop the attribute.
if (!RefDie)
// If the referenced DIE is not found, drop the attribute.
if (!RefDie)