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 | f3a60d67dcd142c175996a2b4d238aa5e97f7b44 (patch) | |
tree | 0b09a3eefee519b0cc5acad9a69faffb4ce27d9d /lib/ReaderWriter/MachO | |
parent | f1738a47c723483eef063fecafb38f7e109468f2 (diff) |
Cleanup. NFC.
Make customOrder pareamter mandatory because the argument is
always passed.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@228342 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ReaderWriter/MachO')
-rw-r--r-- | lib/ReaderWriter/MachO/LayoutPass.cpp | 16 | ||||
-rw-r--r-- | lib/ReaderWriter/MachO/LayoutPass.h | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/ReaderWriter/MachO/LayoutPass.cpp b/lib/ReaderWriter/MachO/LayoutPass.cpp index ed9ef4f0..e754c315 100644 --- a/lib/ReaderWriter/MachO/LayoutPass.cpp +++ b/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); }))); } diff --git a/lib/ReaderWriter/MachO/LayoutPass.h b/lib/ReaderWriter/MachO/LayoutPass.h index 453e118e..186f29be 100644 --- a/lib/ReaderWriter/MachO/LayoutPass.h +++ b/lib/ReaderWriter/MachO/LayoutPass.h @@ -42,7 +42,7 @@ public: typedef std::function<bool (const DefinedAtom *left, const DefinedAtom *right, bool &leftBeforeRight)> SortOverride; - LayoutPass(const Registry ®istry, SortOverride sorter=nullptr); + LayoutPass(const Registry ®istry, SortOverride sorter); /// Sorts atoms in mergedFile by content type then by command line order. void perform(std::unique_ptr<MutableFile> &mergedFile) override; |