mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-26 21:32:10 +00:00
[C++11] DwarfDebug: Turn single-use functors into lambdas.
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203276 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bc3b24269e
commit
adb294d284
@ -2498,28 +2498,6 @@ void DwarfDebug::emitDebugLoc() {
|
||||
}
|
||||
}
|
||||
|
||||
struct SymbolCUSorter {
|
||||
SymbolCUSorter(const MCStreamer &s) : Streamer(s) {}
|
||||
const MCStreamer &Streamer;
|
||||
|
||||
bool operator()(const SymbolCU &A, const SymbolCU &B) {
|
||||
unsigned IA = A.Sym ? Streamer.GetSymbolOrder(A.Sym) : 0;
|
||||
unsigned IB = B.Sym ? Streamer.GetSymbolOrder(B.Sym) : 0;
|
||||
|
||||
// Symbols with no order assigned should be placed at the end.
|
||||
// (e.g. section end labels)
|
||||
if (IA == 0)
|
||||
IA = (unsigned)(-1);
|
||||
if (IB == 0)
|
||||
IB = (unsigned)(-1);
|
||||
return IA < IB;
|
||||
}
|
||||
};
|
||||
|
||||
static bool CUSort(const DwarfUnit *A, const DwarfUnit *B) {
|
||||
return (A->getUniqueID() < B->getUniqueID());
|
||||
}
|
||||
|
||||
struct ArangeSpan {
|
||||
const MCSymbol *Start, *End;
|
||||
};
|
||||
@ -2553,8 +2531,19 @@ void DwarfDebug::emitDebugARanges() {
|
||||
continue;
|
||||
|
||||
// Sort the symbols by offset within the section.
|
||||
SymbolCUSorter sorter(Asm->OutStreamer);
|
||||
std::sort(List.begin(), List.end(), sorter);
|
||||
std::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;
|
||||
});
|
||||
|
||||
// If we have no section (e.g. common), just write out
|
||||
// individual spans for each symbol.
|
||||
@ -2595,7 +2584,9 @@ void DwarfDebug::emitDebugARanges() {
|
||||
}
|
||||
|
||||
// Sort the CU list (again, to ensure consistent output order).
|
||||
std::sort(CUs.begin(), CUs.end(), CUSort);
|
||||
std::sort(CUs.begin(), CUs.end(), [](const DwarfUnit *A, const DwarfUnit *B) {
|
||||
return A->getUniqueID() < B->getUniqueID();
|
||||
});
|
||||
|
||||
// Emit an arange table for each CU we used.
|
||||
for (DwarfCompileUnit *CU : CUs) {
|
||||
|
Loading…
Reference in New Issue
Block a user