Remove the 'N' modifier from llvm-ar.
[oota-llvm.git] / tools / llvm-size / llvm-size.cpp
index b1be0ce6283abe221a792c390101a9bdeaa9b4b3..3de6605285bf2f22d8a2511ef49aab1c9b19e475 100644 (file)
@@ -23,8 +23,8 @@
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/PrettyStackTrace.h"
-#include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/Signals.h"
+#include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/system_error.h"
 #include <algorithm>
 #include <string>
@@ -78,7 +78,7 @@ static bool error(error_code ec) {
 
 /// @brief Get the length of the string that represents @p num in Radix
 ///        including the leading 0x or 0 for hexadecimal and octal respectively.
-static unsigned int getNumLengthAsString(uint64_t num) {
+static size_t getNumLengthAsString(uint64_t num) {
   APInt conv(64, num);
   SmallString<32> result;
   conv.toString(result, Radix, false, true);
@@ -96,13 +96,13 @@ static void PrintObjectSectionSizes(ObjectFile *o) {
   const char *radix_fmt = 0;
   switch (Radix) {
   case octal:
-    radix_fmt = "llo";
+    radix_fmt = PRIo64;
     break;
   case decimal:
-    radix_fmt = "llu";
+    radix_fmt = PRIu64;
     break;
   case hexadecimal:
-    radix_fmt = "llx";
+    radix_fmt = PRIx64;
     break;
   }
   if (OutputFormat == sysv) {
@@ -112,9 +112,9 @@ static void PrintObjectSectionSizes(ObjectFile *o) {
     std::size_t max_size_len = strlen("size");
     std::size_t max_addr_len = strlen("addr");
     error_code ec;
-    for (ObjectFile::section_iterator i = o->begin_sections(),
-                                      e = o->end_sections(); i != e;
-                                      i.increment(ec)) {
+    for (section_iterator i = o->begin_sections(),
+                          e = o->end_sections(); i != e;
+                          i.increment(ec)) {
       if (error(ec))
         return;
       uint64_t size = 0;
@@ -127,10 +127,8 @@ static void PrintObjectSectionSizes(ObjectFile *o) {
       if (error(i->getName(name))) return;
       if (error(i->getAddress(addr))) return;
       max_name_len = std::max(max_name_len, name.size());
-      max_size_len = std::max(max_size_len,
-                              (std::size_t) getNumLengthAsString(size));
-      max_addr_len = std::max(max_addr_len,
-                              (std::size_t) getNumLengthAsString(addr));
+      max_size_len = std::max(max_size_len, getNumLengthAsString(size));
+      max_addr_len = std::max(max_addr_len, getNumLengthAsString(addr));
     }
 
     // Add extra padding.
@@ -156,9 +154,9 @@ static void PrintObjectSectionSizes(ObjectFile *o) {
         << "%#" << max_addr_len << radix_fmt << "\n";
 
     // Print each section.
-    for (ObjectFile::section_iterator i = o->begin_sections(),
-                                      e = o->end_sections(); i != e;
-                                      i.increment(ec)) {
+    for (section_iterator i = o->begin_sections(),
+                          e = o->end_sections(); i != e;
+                          i.increment(ec)) {
       if (error(ec))
         return;
 
@@ -192,9 +190,9 @@ static void PrintObjectSectionSizes(ObjectFile *o) {
 
     // Make one pass over the section table to calculate sizes.
     error_code ec;
-    for (ObjectFile::section_iterator i = o->begin_sections(),
-                                      e = o->end_sections(); i != e;
-                                      i.increment(ec)) {
+    for (section_iterator i = o->begin_sections(),
+                          e = o->end_sections(); i != e;
+                          i.increment(ec)) {
       if (error(ec))
         return;
 
@@ -225,8 +223,8 @@ static void PrintObjectSectionSizes(ObjectFile *o) {
                      total_data,
                      total_bss);
     fmtbuf.clear();
-    fmt << "%7" << (Radix == octal ? "llo" : "llu") << " "
-        << "%7llx ";
+    fmt << "%7" << (Radix == octal ? PRIo64 : PRIu64) << " "
+        << "%7" PRIx64 " ";
     outs() << format(fmt.str().c_str(),
                      total,
                      total);