1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00

Fix nm on GCC 5.1 after the C++14 move

Summary:
As in D66306, fix the invocation of std::sort with std::function by not using
std::function, since it's easier to read and is broken in libstdc++ from GCC 5.1
(see https://gcc.gnu.org/PR65942).

Reviewers: thakis

Subscribers: jkorous, mgrang, dexonsmith, rupprecht, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D66310

llvm-svn: 369045
This commit is contained in:
JF Bastien 2019-08-15 20:38:42 +00:00
parent f8a414589e
commit 3fcfd786dd

View File

@ -711,17 +711,21 @@ static void sortAndPrintSymbolList(SymbolicFile &Obj, bool printName,
const std::string &ArchiveName,
const std::string &ArchitectureName) {
if (!NoSort) {
std::function<bool(const NMSymbol &, const NMSymbol &)> Cmp;
using Comparator = bool (*)(const NMSymbol &, const NMSymbol &);
Comparator Cmp;
if (NumericSort)
Cmp = compareSymbolAddress;
Cmp = &compareSymbolAddress;
else if (SizeSort)
Cmp = compareSymbolSize;
Cmp = &compareSymbolSize;
else
Cmp = compareSymbolName;
Cmp = &compareSymbolName;
if (ReverseSort)
Cmp = [=](const NMSymbol &A, const NMSymbol &B) { return Cmp(B, A); };
llvm::sort(SymbolList, Cmp);
llvm::sort(SymbolList, [=](const NMSymbol &A, const NMSymbol &B) -> bool {
return Cmp(B, A);
});
else
llvm::sort(SymbolList, Cmp);
}
if (!PrintFileName) {