dwarfdump: Added macro support to llvm-dwarfdump tool.
[oota-llvm.git] / lib / Support / Statistic.cpp
index 9c28176b730e954dd10a1a4422423359d2dc2b0f..ee6c1305cdbe526473b0946c23168b6a6152b67a 100644 (file)
@@ -24,6 +24,7 @@
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/ManagedStatic.h"
@@ -84,20 +85,6 @@ void Statistic::RegisterStatistic() {
   }
 }
 
-namespace {
-
-struct NameCompare {
-  bool operator()(const Statistic *LHS, const Statistic *RHS) const {
-    int Cmp = std::strcmp(LHS->getName(), RHS->getName());
-    if (Cmp != 0) return Cmp < 0;
-
-    // Secondary key is the description.
-    return std::strcmp(LHS->getDesc(), RHS->getDesc()) < 0;
-  }
-};
-
-}
-
 // Print information when destroyed, iff command line option is specified.
 StatisticInfo::~StatisticInfo() {
   llvm::PrintStatistics();
@@ -124,7 +111,14 @@ void llvm::PrintStatistics(raw_ostream &OS) {
   }
 
   // Sort the fields by name.
-  std::stable_sort(Stats.Stats.begin(), Stats.Stats.end(), NameCompare());
+  std::stable_sort(Stats.Stats.begin(), Stats.Stats.end(),
+                   [](const Statistic *LHS, const Statistic *RHS) {
+    if (int Cmp = std::strcmp(LHS->getName(), RHS->getName()))
+      return Cmp < 0;
+
+    // Secondary key is the description.
+    return std::strcmp(LHS->getDesc(), RHS->getDesc()) < 0;
+  });
 
   // Print out the statistics header...
   OS << "===" << std::string(73, '-') << "===\n"