Add support for the new va_arg instruction
[oota-llvm.git] / lib / Support / Statistic.cpp
index b6c75c2adee49e5048bf8d27ead48b5f3144801a..f6645c6ae401132d93e7e12a2b15c7c6fcec1031 100644 (file)
@@ -18,6 +18,7 @@
 #include "Support/CommandLine.h"
 #include <iostream>
 #include <sstream>
+#include <algorithm>
 
 bool DebugFlag;  // DebugFlag - Exported boolean set by the -debug option
 
@@ -29,10 +30,13 @@ unsigned StatisticBase::NumStats = 0;
 static cl::opt<bool>
 Enabled("stats", cl::desc("Enable statistics output from program"));
 
+#ifndef NDEBUG
 // -debug - Command line option to enable the DEBUG statements in the passes.
+// This flag may only be enabled in debug builds.
 static cl::opt<bool, true>
 Debug("debug", cl::desc("Enable debug output"), cl::Hidden,
       cl::location(DebugFlag));
+#endif
 
 struct StatRecord {
   std::string Value;
@@ -70,8 +74,10 @@ void StatisticBase::destroy() const {
     // Figure out how long the biggest Value and Name fields are...
     unsigned MaxNameLen = 0, MaxValLen = 0;
     for (unsigned i = 0, e = AccumStats->size(); i != e; ++i) {
-      MaxValLen = std::max(MaxValLen, (*AccumStats)[i].Value.length());
-      MaxNameLen = std::max(MaxNameLen, std::strlen((*AccumStats)[i].Name));
+      MaxValLen = std::max(MaxValLen, 
+                           (unsigned)(*AccumStats)[i].Value.length());
+      MaxNameLen = std::max(MaxNameLen, 
+                            (unsigned)std::strlen((*AccumStats)[i].Name));
     }
 
     // Sort the fields...