From a5c7adcb38e89cd23ed3cbbc813d2da2546a9161 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Tue, 28 Jun 2016 18:42:33 +0000 Subject: [PATCH] [lld][MachO] Remove SimpleFile::definedAtoms(). This method just duplicates the functionality of SimpleFile::defined(). llvm-svn: 274048 --- lld/include/lld/Core/Simple.h | 3 --- lld/lib/ReaderWriter/MachO/LayoutPass.cpp | 14 +++++++------- lld/lib/ReaderWriter/MachO/LayoutPass.h | 10 +++++----- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/lld/include/lld/Core/Simple.h b/lld/include/lld/Core/Simple.h index cfef02e049d3..f75b40327db4 100644 --- a/lld/include/lld/Core/Simple.h +++ b/lld/include/lld/Core/Simple.h @@ -104,9 +104,6 @@ public: _absolute.clear(); } - typedef AtomRange DefinedAtomRange; - DefinedAtomRange definedAtoms() { return _defined; } - private: AtomVector _defined; AtomVector _undefined; diff --git a/lld/lib/ReaderWriter/MachO/LayoutPass.cpp b/lld/lib/ReaderWriter/MachO/LayoutPass.cpp index d68ba77ea4b3..dd2ee8567ec9 100644 --- a/lld/lib/ReaderWriter/MachO/LayoutPass.cpp +++ b/lld/lib/ReaderWriter/MachO/LayoutPass.cpp @@ -134,7 +134,7 @@ static void checkReachabilityFromRoot(AtomToAtomT &followOnRoots, } } -static void printDefinedAtoms(const SimpleFile::DefinedAtomRange &atomRange) { +static void printDefinedAtoms(const File::AtomRange &atomRange) { for (const DefinedAtom *atom : atomRange) { llvm::dbgs() << " file=" << atom->file().path() << ", name=" << atom->name() @@ -147,7 +147,7 @@ static void printDefinedAtoms(const SimpleFile::DefinedAtomRange &atomRange) { /// Verify that the followon chain is sane. Should not be called in /// release binary. -void LayoutPass::checkFollowonChain(const SimpleFile::DefinedAtomRange &range) { +void LayoutPass::checkFollowonChain(const File::AtomRange &range) { ScopedTask task(getDefaultDomain(), "LayoutPass::checkFollowonChain"); // Verify that there's no cycle in follow-on chain. @@ -331,7 +331,7 @@ void LayoutPass::setChainRoot(const DefinedAtom *targetAtom, /// d) If the targetAtom is part of a different chain and the root of the /// targetAtom until the targetAtom has all atoms of size 0, then chain the /// targetAtoms and its tree to the current chain -void LayoutPass::buildFollowOnTable(const SimpleFile::DefinedAtomRange &range) { +void LayoutPass::buildFollowOnTable(const File::AtomRange &range) { ScopedTask task(getDefaultDomain(), "LayoutPass::buildFollowOnTable"); // Set the initial size of the followon and the followonNext hash to the // number of atoms that we have. @@ -400,7 +400,7 @@ void LayoutPass::buildFollowOnTable(const SimpleFile::DefinedAtomRange &range) { /// already assigned skip the atom and move to the next. This is the /// main map thats used to sort the atoms while comparing two atoms together void -LayoutPass::buildOrdinalOverrideMap(const SimpleFile::DefinedAtomRange &range) { +LayoutPass::buildOrdinalOverrideMap(const File::AtomRange &range) { ScopedTask task(getDefaultDomain(), "LayoutPass::buildOrdinalOverrideMap"); uint64_t index = 0; for (const DefinedAtom *ai : range) { @@ -420,7 +420,7 @@ LayoutPass::buildOrdinalOverrideMap(const SimpleFile::DefinedAtomRange &range) { } std::vector -LayoutPass::decorate(SimpleFile::DefinedAtomRange &atomRange) const { +LayoutPass::decorate(File::AtomRange &atomRange) const { std::vector ret; for (OwningAtomPtr &atom : atomRange.owning_ptrs()) { auto ri = _followOnRoots.find(atom.get()); @@ -432,7 +432,7 @@ LayoutPass::decorate(SimpleFile::DefinedAtomRange &atomRange) const { return ret; } -void LayoutPass::undecorate(SimpleFile::DefinedAtomRange &atomRange, +void LayoutPass::undecorate(File::AtomRange &atomRange, std::vector &keys) const { size_t i = 0; for (SortKey &k : keys) @@ -444,7 +444,7 @@ llvm::Error LayoutPass::perform(SimpleFile &mergedFile) { DEBUG(llvm::dbgs() << "******** Laying out atoms:\n"); // sort the atoms ScopedTask task(getDefaultDomain(), "LayoutPass"); - SimpleFile::DefinedAtomRange atomRange = mergedFile.definedAtoms(); + File::AtomRange atomRange = mergedFile.defined(); // Build follow on tables buildFollowOnTable(atomRange); diff --git a/lld/lib/ReaderWriter/MachO/LayoutPass.h b/lld/lib/ReaderWriter/MachO/LayoutPass.h index 8cf741eba7bf..c18777eded0a 100644 --- a/lld/lib/ReaderWriter/MachO/LayoutPass.h +++ b/lld/lib/ReaderWriter/MachO/LayoutPass.h @@ -73,10 +73,10 @@ public: private: // Build the followOn atoms chain as specified by the kindLayoutAfter // reference type - void buildFollowOnTable(const SimpleFile::DefinedAtomRange &range); + void buildFollowOnTable(const File::AtomRange &range); // Build a map of Atoms to ordinals for sorting the atoms - void buildOrdinalOverrideMap(const SimpleFile::DefinedAtomRange &range); + void buildOrdinalOverrideMap(const File::AtomRange &range); const Registry &_registry; SortOverride _customSorter; @@ -104,13 +104,13 @@ private: void setChainRoot(const DefinedAtom *targetAtom, const DefinedAtom *root); - std::vector decorate(SimpleFile::DefinedAtomRange &atomRange) const; + std::vector decorate(File::AtomRange &atomRange) const; - void undecorate(SimpleFile::DefinedAtomRange &atomRange, + void undecorate(File::AtomRange &atomRange, std::vector &keys) const; // Check if the follow-on graph is a correct structure. For debugging only. - void checkFollowonChain(const SimpleFile::DefinedAtomRange &range); + void checkFollowonChain(const File::AtomRange &range); }; } // namespace mach_o