[lld] r228342 - Cleanup. NFC.
Rui Ueyama
ruiu at google.com
Thu Feb 5 12:08:04 PST 2015
Author: ruiu
Date: Thu Feb 5 14:08:04 2015
New Revision: 228342
URL: http://llvm.org/viewvc/llvm-project?rev=228342&view=rev
Log:
Cleanup. NFC.
Make customOrder pareamter mandatory because the argument is
always passed.
Modified:
lld/trunk/lib/ReaderWriter/MachO/LayoutPass.cpp
lld/trunk/lib/ReaderWriter/MachO/LayoutPass.h
Modified: lld/trunk/lib/ReaderWriter/MachO/LayoutPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/LayoutPass.cpp?rev=228342&r1=228341&r2=228342&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/LayoutPass.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/LayoutPass.cpp Thu Feb 5 14:08:04 2015
@@ -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(StringRe
// 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(Muta
/// 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
[&](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
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);
})));
}
Modified: lld/trunk/lib/ReaderWriter/MachO/LayoutPass.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/LayoutPass.h?rev=228342&r1=228341&r2=228342&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/LayoutPass.h (original)
+++ lld/trunk/lib/ReaderWriter/MachO/LayoutPass.h Thu Feb 5 14:08:04 2015
@@ -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;
More information about the llvm-commits
mailing list