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

Zachary Turner via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Dec 21 12:52:46 PST 2016


zturner added a comment.

How about re-writing these to use `llvm::formatv()` since the whole point of it is to eliminate this problem entirely and clayborg@ has agreed that it looks good going forward?

Individual call-site suggestions inlined.



================
Comment at: source/Interpreter/Args.cpp:216-217
     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.Format("{0}[{1}]=\"{2}\"\n", label_name, i++, entry.ref);`


================
Comment at: source/Interpreter/Args.cpp:219
   }
-  s.Printf("%s[%zi]=NULL\n", label_name, i);
+  s.Printf("%s[%d]=NULL\n", label_name, i);
   s.EOL();
----------------
`s.Format("{0}[{1}]=NULL\n", label_name, i);`


================
Comment at: source/Plugins/ExpressionParser/Clang/IRForTarget.cpp:517-519
      log->Printf("Encountered an Objective-C constant string with unusual "
-                 "element size %llu",
+                 "element size %" PRIu64,
                  string_array->getElementByteSize());
----------------
```
log->Format("Encountered an Object-C constant string with unusual "
            "element size {0}", string_array->getElementByteSize());
```


https://reviews.llvm.org/D28028





More information about the lldb-commits mailing list