diff options
author | Fangrui Song <maskray@google.com> | 2019-04-23 14:51:27 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2019-04-23 14:51:27 +0000 |
commit | efd94c56badf696ed7193f4a83c7a59f7dfbfc6e (patch) | |
tree | 63f7a8a57c367cf6ba845a80eda9177b62c516be /llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | |
parent | 99cf58339fceadee43ba3fdbf962a083cd5af6c4 (diff) | |
download | llvm-efd94c56badf696ed7193f4a83c7a59f7dfbfc6e.zip llvm-efd94c56badf696ed7193f4a83c7a59f7dfbfc6e.tar.gz llvm-efd94c56badf696ed7193f4a83c7a59f7dfbfc6e.tar.bz2 |
Use llvm::stable_sort
While touching the code, simplify if feasible.
llvm-svn: 358996
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index f94215b..5b0e77b 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2233,19 +2233,18 @@ void DwarfDebug::emitDebugARanges() { } // Sort the symbols by offset within the section. - std::stable_sort( - List.begin(), List.end(), [&](const SymbolCU &A, const SymbolCU &B) { - unsigned IA = A.Sym ? Asm->OutStreamer->GetSymbolOrder(A.Sym) : 0; - unsigned IB = B.Sym ? Asm->OutStreamer->GetSymbolOrder(B.Sym) : 0; - - // Symbols with no order assigned should be placed at the end. - // (e.g. section end labels) - if (IA == 0) - return false; - if (IB == 0) - return true; - return IA < IB; - }); + llvm::stable_sort(List, [&](const SymbolCU &A, const SymbolCU &B) { + unsigned IA = A.Sym ? Asm->OutStreamer->GetSymbolOrder(A.Sym) : 0; + unsigned IB = B.Sym ? Asm->OutStreamer->GetSymbolOrder(B.Sym) : 0; + + // Symbols with no order assigned should be placed at the end. + // (e.g. section end labels) + if (IA == 0) + return false; + if (IB == 0) + return true; + return IA < IB; + }); // Insert a final terminator. List.push_back(SymbolCU(nullptr, Asm->OutStreamer->endSection(Section))); |