ldrumm created this revision.
ldrumm added reviewers: zturner, clayborg.
ldrumm added a subscriber: LLDB.

This patch fixes use of incorrect `%zi` to format a plain `int`, and switches 
from using "%llu" to format a uint64_t to using the exact width specifier 
PRIu64 from inttypes.h


https://reviews.llvm.org/D28028

Files:
  source/Interpreter/Args.cpp
  source/Plugins/ExpressionParser/Clang/IRForTarget.cpp


Index: source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
===================================================================
--- source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
+++ source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
@@ -38,6 +38,7 @@
 #include "lldb/Symbol/ClangUtil.h"
 #include "lldb/Symbol/CompilerType.h"
 
+#include <cinttypes>
 #include <map>
 
 using namespace llvm;
@@ -514,7 +515,7 @@
    encoding_flags = 0x0600; /* fall back to 0x0600, kCFStringEncodingASCII */
    if (log) {
      log->Printf("Encountered an Objective-C constant string with unusual "
-                 "element size %llu",
+                 "element size %" PRIu64,
                  string_array->getElementByteSize());
    }
  }
Index: source/Interpreter/Args.cpp
===================================================================
--- source/Interpreter/Args.cpp
+++ source/Interpreter/Args.cpp
@@ -213,10 +213,10 @@
   int i = 0;
   for (auto &entry : m_entries) {
     s.Indent();
-    s.Printf("%s[%zi]=\"%*s\"\n", label_name, i++, int(entry.ref.size()),
+    s.Printf("%s[%d]=\"%*s\"\n", label_name, i++, int(entry.ref.size()),
              entry.ref.data());
   }
-  s.Printf("%s[%zi]=NULL\n", label_name, i);
+  s.Printf("%s[%d]=NULL\n", label_name, i);
   s.EOL();
 }
 


Index: source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
===================================================================
--- source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
+++ source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
@@ -38,6 +38,7 @@
 #include "lldb/Symbol/ClangUtil.h"
 #include "lldb/Symbol/CompilerType.h"
 
+#include <cinttypes>
 #include <map>
 
 using namespace llvm;
@@ -514,7 +515,7 @@
    encoding_flags = 0x0600; /* fall back to 0x0600, kCFStringEncodingASCII */
    if (log) {
      log->Printf("Encountered an Objective-C constant string with unusual "
-                 "element size %llu",
+                 "element size %" PRIu64,
                  string_array->getElementByteSize());
    }
  }
Index: source/Interpreter/Args.cpp
===================================================================
--- source/Interpreter/Args.cpp
+++ source/Interpreter/Args.cpp
@@ -213,10 +213,10 @@
   int i = 0;
   for (auto &entry : m_entries) {
     s.Indent();
-    s.Printf("%s[%zi]=\"%*s\"\n", label_name, i++, int(entry.ref.size()),
+    s.Printf("%s[%d]=\"%*s\"\n", label_name, i++, int(entry.ref.size()),
              entry.ref.data());
   }
-  s.Printf("%s[%zi]=NULL\n", label_name, i);
+  s.Printf("%s[%d]=NULL\n", label_name, i);
   s.EOL();
 }
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to