[Lldb-commits] [PATCH] D28028: Fix a couple of incorrect format strings

Luke Drummond via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Dec 21 12:30:05 PST 2016


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();
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28028.82256.patch
Type: text/x-patch
Size: 1291 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20161221/8ce9af04/attachment.bin>


More information about the lldb-commits mailing list