diff options
author | Rui Ueyama <ruiu@google.com> | 2015-02-05 20:08:04 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2015-02-05 20:08:04 +0000 |
commit | 540842ccf5923878b3992cc604dd593a636e4ce5 (patch) | |
tree | 97755d0c279908324ac4b3dc51c8074bedf1a61e /lld/lib/ReaderWriter/MachO/LayoutPass.cpp | |
parent | 0076215b883da30934133a0f95f7b28f1a1e405a (diff) | |
download | bcm5719-llvm-540842ccf5923878b3992cc604dd593a636e4ce5.tar.gz bcm5719-llvm-540842ccf5923878b3992cc604dd593a636e4ce5.zip |
Cleanup. NFC.
Make customOrder pareamter mandatory because the argument is
always passed.
llvm-svn: 228342
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/LayoutPass.cpp')
-rw-r--r-- | lld/lib/ReaderWriter/MachO/LayoutPass.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lld/lib/ReaderWriter/MachO/LayoutPass.cpp b/lld/lib/ReaderWriter/MachO/LayoutPass.cpp index ed9ef4f0e34..e754c3157ed 100644 --- a/lld/lib/ReaderWriter/MachO/LayoutPass.cpp +++ b/lld/lib/ReaderWriter/MachO/LayoutPass.cpp @@ -26,7 +26,7 @@ namespace mach_o { static bool compareAtoms(const LayoutPass::SortKey &, const LayoutPass::SortKey &, - LayoutPass::SortOverride customSorter=nullptr); + LayoutPass::SortOverride customSorter); #ifndef NDEBUG // Return "reason (leftval, rightval)" @@ -38,11 +38,12 @@ static std::string formatReason(StringRef reason, int leftVal, int rightVal) { // Less-than relationship of two atoms must be transitive, which is, if a < b // and b < c, a < c must be true. This function checks the transitivity by // checking the sort results. -static void checkTransitivity(std::vector<LayoutPass::SortKey> &vec) { +static void checkTransitivity(std::vector<LayoutPass::SortKey> &vec, + LayoutPass::SortOverride customSorter) { for (auto i = vec.begin(), e = vec.end(); (i + 1) != e; ++i) { for (auto j = i + 1; j != e; ++j) { - assert(compareAtoms(*i, *j)); - assert(!compareAtoms(*j, *i)); + assert(compareAtoms(*i, *j, customSorter)); + assert(!compareAtoms(*j, *i, customSorter)); } } } @@ -168,7 +169,7 @@ void LayoutPass::checkFollowonChain(MutableFile::DefinedAtomRange &range) { /// b) Sorts atoms by their ordinal overrides (layout-after/ingroup) /// c) Sorts atoms by their permissions /// d) Sorts atoms by their content -/// e) If custom sorter provided, let it sort +/// e) Sorts atoms by custom sorter /// f) Sorts atoms on how they appear using File Ordinality /// g) Sorts atoms on how they appear within the File static bool compareAtomsSub(const LayoutPass::SortKey &lc, @@ -473,7 +474,7 @@ void LayoutPass::perform(std::unique_ptr<MutableFile> &mergedFile) { [&](const LayoutPass::SortKey &l, const LayoutPass::SortKey &r) -> bool { return compareAtoms(l, r, _customSorter); }); - DEBUG(checkTransitivity(vec)); + DEBUG(checkTransitivity(vec, _customSorter)); undecorate(atomRange, vec); DEBUG({ @@ -485,8 +486,7 @@ void LayoutPass::perform(std::unique_ptr<MutableFile> &mergedFile) { void addLayoutPass(PassManager &pm, const MachOLinkingContext &ctx) { pm.add(std::unique_ptr<Pass>(new LayoutPass( ctx.registry(), [&](const DefinedAtom * left, const DefinedAtom * right, - bool & leftBeforeRight) - ->bool { + bool & leftBeforeRight) ->bool { return ctx.customAtomOrderer(left, right, leftBeforeRight); }))); } |