[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:37:43 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL369045: Fix nm on GCC 5.1 after the C++14 move (authored by jfb, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D66310?vs=215464&id=215465#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66310/new/

https://reviews.llvm.org/D66310

Files:
  llvm/trunk/tools/llvm-nm/llvm-nm.cpp


Index: llvm/trunk/tools/llvm-nm/llvm-nm.cpp
===================================================================
--- llvm/trunk/tools/llvm-nm/llvm-nm.cpp
+++ llvm/trunk/tools/llvm-nm/llvm-nm.cpp
@@ -711,17 +711,21 @@
                                    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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66310.215465.patch
Type: text/x-patch
Size: 1125 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190815/c51c950e/attachment.bin>


More information about the llvm-commits mailing list