[dsymutil] Use UnitListTy consistently (NFC)

Use the UnitListTy typedef consistently throughout the Dwarf linker and
pass it by const reference where possible.

llvm-svn: 335860
This commit is contained in:
Jonas Devlieghere 2018-06-28 15:01:42 +00:00
parent 365ebcbf1a
commit 0235d49a69
2 changed files with 15 additions and 18 deletions

View File

@ -106,9 +106,7 @@ namespace dsymutil {
/// Similar to DWARFUnitSection::getUnitForOffset(), but returning our
/// CompileUnit object instead.
static CompileUnit *
getUnitForOffset(std::vector<std::unique_ptr<CompileUnit>> &Units,
unsigned Offset) {
static CompileUnit *getUnitForOffset(const UnitListTy &Units, unsigned Offset) {
auto CU = std::upper_bound(
Units.begin(), Units.end(), Offset,
[](uint32_t LHS, const std::unique_ptr<CompileUnit> &RHS) {
@ -120,11 +118,12 @@ getUnitForOffset(std::vector<std::unique_ptr<CompileUnit>> &Units,
/// Resolve the DIE attribute reference that has been extracted in \p RefValue.
/// The resulting DIE might be in another CompileUnit which is stored into \p
/// ReferencedCU. \returns null if resolving fails for any reason.
static DWARFDie
resolveDIEReference(const DwarfLinker &Linker, const DebugMapObject &DMO,
std::vector<std::unique_ptr<CompileUnit>> &Units,
const DWARFFormValue &RefValue, const DWARFUnit &Unit,
const DWARFDie &DIE, CompileUnit *&RefCU) {
static DWARFDie resolveDIEReference(const DwarfLinker &Linker,
const DebugMapObject &DMO,
const UnitListTy &Units,
const DWARFFormValue &RefValue,
const DWARFUnit &Unit, const DWARFDie &DIE,
CompileUnit *&RefCU) {
assert(RefValue.isFormClass(DWARFFormValue::FC_Reference));
uint64_t RefOffset = *RefValue.getAsReference();
@ -673,12 +672,10 @@ unsigned DwarfLinker::shouldKeepDIE(RelocationManager &RelocMgr,
/// back to lookForDIEsToKeep while adding TF_DependencyWalk to the
/// TraversalFlags to inform it that it's not doing the primary DIE
/// tree walk.
void DwarfLinker::keepDIEAndDependencies(RelocationManager &RelocMgr,
RangesTy &Ranges, UnitListTy &Units,
const DWARFDie &Die,
CompileUnit::DIEInfo &MyInfo,
const DebugMapObject &DMO,
CompileUnit &CU, bool UseODR) {
void DwarfLinker::keepDIEAndDependencies(
RelocationManager &RelocMgr, RangesTy &Ranges, const UnitListTy &Units,
const DWARFDie &Die, CompileUnit::DIEInfo &MyInfo,
const DebugMapObject &DMO, CompileUnit &CU, bool UseODR) {
DWARFUnit &Unit = CU.getOrigUnit();
MyInfo.Keep = true;
@ -773,7 +770,7 @@ void DwarfLinker::keepDIEAndDependencies(RelocationManager &RelocMgr,
///
/// The return value indicates whether the DIE is incomplete.
bool DwarfLinker::lookForDIEsToKeep(RelocationManager &RelocMgr,
RangesTy &Ranges, UnitListTy &Units,
RangesTy &Ranges, const UnitListTy &Units,
const DWARFDie &Die,
const DebugMapObject &DMO, CompileUnit &CU,
unsigned Flags) {
@ -2108,7 +2105,7 @@ Error DwarfLinker::loadClangModule(StringRef Filename, StringRef ModulePath,
outs() << "cloning .debug_info from " << Filename << "\n";
}
std::vector<std::unique_ptr<CompileUnit>> CompileUnits;
UnitListTy CompileUnits;
CompileUnits.push_back(std::move(Unit));
DIECloner(*this, RelocMgr, DIEAlloc, CompileUnits, Options)
.cloneAllCompileUnits(*DwarfContext, DMO, Ranges, StringPool);

View File

@ -180,7 +180,7 @@ private:
///
/// The return value indicates whether the DIE is incomplete.
bool lookForDIEsToKeep(RelocationManager &RelocMgr, RangesTy &Ranges,
UnitListTy &Units, const DWARFDie &DIE,
const UnitListTy &Units, const DWARFDie &DIE,
const DebugMapObject &DMO, CompileUnit &CU,
unsigned Flags);
@ -221,7 +221,7 @@ private:
/// Mark the passed DIE as well as all the ones it depends on as kept.
void keepDIEAndDependencies(RelocationManager &RelocMgr, RangesTy &Ranges,
UnitListTy &Units, const DWARFDie &DIE,
const UnitListTy &Units, const DWARFDie &DIE,
CompileUnit::DIEInfo &MyInfo,
const DebugMapObject &DMO, CompileUnit &CU,
bool UseODR);