diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2013-08-24 12:54:27 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2013-08-24 12:54:27 +0000 |
commit | b12cf01908f0a6847f49523f956dacdfc40da3b7 (patch) | |
tree | a21c929c8f817d860aa9d63dd179897ef47b2c15 /llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | |
parent | 260de74e484e5db2657c5b2185e9dafea0bd6342 (diff) | |
download | bcm5719-llvm-b12cf01908f0a6847f49523f956dacdfc40da3b7.tar.gz bcm5719-llvm-b12cf01908f0a6847f49523f956dacdfc40da3b7.zip |
Add a function object to compare the first or second component of a std::pair.
Replace instances of this scattered around the code base.
llvm-svn: 189169
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 42a21650fb3..33bae711f9d 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1287,12 +1287,6 @@ void AsmPrinter::EmitLLVMUsedList(const ConstantArray *InitList) { } } -typedef std::pair<unsigned, Constant*> Structor; - -static bool priority_order(const Structor& lhs, const Structor& rhs) { - return lhs.first < rhs.first; -} - /// EmitXXStructorList - Emit the ctor or dtor list taking into account the init /// priority. void AsmPrinter::EmitXXStructorList(const Constant *List, bool isCtor) { @@ -1309,6 +1303,7 @@ void AsmPrinter::EmitXXStructorList(const Constant *List, bool isCtor) { !isa<PointerType>(ETy->getTypeAtIndex(1U))) return; // Not (int, ptr). // Gather the structors in a form that's convenient for sorting by priority. + typedef std::pair<unsigned, Constant *> Structor; SmallVector<Structor, 8> Structors; for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) { ConstantStruct *CS = dyn_cast<ConstantStruct>(InitList->getOperand(i)); @@ -1324,7 +1319,7 @@ void AsmPrinter::EmitXXStructorList(const Constant *List, bool isCtor) { // Emit the function pointers in the target-specific order const DataLayout *TD = TM.getDataLayout(); unsigned Align = Log2_32(TD->getPointerPrefAlignment()); - std::stable_sort(Structors.begin(), Structors.end(), priority_order); + std::stable_sort(Structors.begin(), Structors.end(), less_first()); for (unsigned i = 0, e = Structors.size(); i != e; ++i) { const MCSection *OutputSection = (isCtor ? |