[PATCH] D66310: Fix nm on GCC 5.1 after the C++14 move
JF Bastien via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 15 13:15:58 PDT 2019
jfb created this revision.
jfb added a reviewer: thakis.
Herald added subscribers: llvm-commits, rupprecht, dexonsmith, mgrang, jkorous.
Herald added a project: LLVM.
As in D66306 <https://reviews.llvm.org/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).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D66310
Files:
llvm/tools/llvm-nm/llvm-nm.cpp
Index: llvm/tools/llvm-nm/llvm-nm.cpp
===================================================================
--- llvm/tools/llvm-nm/llvm-nm.cpp
+++ llvm/tools/llvm-nm/llvm-nm.cpp
@@ -711,17 +711,17 @@
const std::string &ArchiveName,
const std::string &ArchitectureName) {
if (!NoSort) {
- std::function<bool(const NMSymbol &, const NMSymbol &)> Cmp;
- if (NumericSort)
- Cmp = compareSymbolAddress;
- else if (SizeSort)
- Cmp = compareSymbolSize;
- else
- Cmp = compareSymbolName;
+ using Comparator = bool (*)(const NMSymbol &, const NMSymbol &);
+ Comparator Cmp = NumericSort
+ ? &compareSymbolAddress
+ : (SizeSort ? &compareSymbolSize : &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) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66310.215460.patch
Type: text/x-patch
Size: 1150 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190815/c4e013a8/attachment.bin>
More information about the llvm-commits
mailing list