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

2016-12-22 Thread Luke Drummond via Phabricator via lldb-commits
ldrumm updated this revision to Diff 82334.
ldrumm added a comment.

switched to the new llvm::Format API


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
@@ -513,8 +513,8 @@
  default:
encoding_flags = 0x0600; /* fall back to 0x0600, kCFStringEncodingASCII */
if (log) {
- log->Printf("Encountered an Objective-C constant string with unusual "
- "element size %llu",
+ log->Format("Encountered an Objective-C constant string with unusual "
+ "element size {0}",
  string_array->getElementByteSize());
}
  }
Index: source/Interpreter/Args.cpp
===
--- source/Interpreter/Args.cpp
+++ source/Interpreter/Args.cpp
@@ -213,10 +213,9 @@
   int i = 0;
   for (auto &entry : m_entries) {
 s.Indent();
-s.Printf("%s[%zi]=\"%*s\"\n", label_name, i++, int(entry.ref.size()),
- entry.ref.data());
+s.Format("{0}[{1}]=\"{2}\"\n", label_name, i++, entry.ref);
   }
-  s.Printf("%s[%zi]=NULL\n", label_name, i);
+  s.Format("{0}[{1}]=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
@@ -513,8 +513,8 @@
  default:
encoding_flags = 0x0600; /* fall back to 0x0600, kCFStringEncodingASCII */
if (log) {
- log->Printf("Encountered an Objective-C constant string with unusual "
- "element size %llu",
+ log->Format("Encountered an Objective-C constant string with unusual "
+ "element size {0}",
  string_array->getElementByteSize());
}
  }
Index: source/Interpreter/Args.cpp
===
--- source/Interpreter/Args.cpp
+++ source/Interpreter/Args.cpp
@@ -213,10 +213,9 @@
   int i = 0;
   for (auto &entry : m_entries) {
 s.Indent();
-s.Printf("%s[%zi]=\"%*s\"\n", label_name, i++, int(entry.ref.size()),
- entry.ref.data());
+s.Format("{0}[{1}]=\"{2}\"\n", label_name, i++, entry.ref);
   }
-  s.Printf("%s[%zi]=NULL\n", label_name, i);
+  s.Format("{0}[{1}]=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


[Lldb-commits] [lldb] r290359 - Fix a couple of incorrect format string warnings

2016-12-22 Thread Luke Drummond via lldb-commits
Author: ldrumm
Date: Thu Dec 22 13:15:07 2016
New Revision: 290359

URL: http://llvm.org/viewvc/llvm-project?rev=290359&view=rev
Log:
Fix a couple of incorrect format string warnings

This patch fixes use of incorrect `%zi` to format a plain `int`, and using
`%llu` to format a `uint64_t`. The fix is to use the new typesafe
`llvm::Formatv` based API.

Differential Revision: https://reviews.llvm.org/D28028
Subscribers: lldb-commits


Modified:
lldb/trunk/source/Interpreter/Args.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp

Modified: lldb/trunk/source/Interpreter/Args.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Args.cpp?rev=290359&r1=290358&r2=290359&view=diff
==
--- lldb/trunk/source/Interpreter/Args.cpp (original)
+++ lldb/trunk/source/Interpreter/Args.cpp Thu Dec 22 13:15:07 2016
@@ -213,10 +213,9 @@ void Args::Dump(Stream &s, const char *l
   int i = 0;
   for (auto &entry : m_entries) {
 s.Indent();
-s.Printf("%s[%zi]=\"%*s\"\n", label_name, i++, int(entry.ref.size()),
- entry.ref.data());
+s.Format("{0}[{1}]=\"{2}\"\n", label_name, i++, entry.ref);
   }
-  s.Printf("%s[%zi]=NULL\n", label_name, i);
+  s.Format("{0}[{1}]=NULL\n", label_name, i);
   s.EOL();
 }
 

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp?rev=290359&r1=290358&r2=290359&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp Thu Dec 22 
13:15:07 2016
@@ -513,8 +513,8 @@ bool IRForTarget::RewriteObjCConstString
  default:
encoding_flags = 0x0600; /* fall back to 0x0600, kCFStringEncodingASCII */
if (log) {
- log->Printf("Encountered an Objective-C constant string with unusual "
- "element size %llu",
+ log->Format("Encountered an Objective-C constant string with unusual "
+ "element size {0}",
  string_array->getElementByteSize());
}
  }


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2016-12-22 Thread Luke Drummond via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL290359: Fix a couple of incorrect format string warnings 
(authored by ldrumm).

Changed prior to commit:
  https://reviews.llvm.org/D28028?vs=82334&id=82354#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28028

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


Index: lldb/trunk/source/Interpreter/Args.cpp
===
--- lldb/trunk/source/Interpreter/Args.cpp
+++ lldb/trunk/source/Interpreter/Args.cpp
@@ -213,10 +213,9 @@
   int i = 0;
   for (auto &entry : m_entries) {
 s.Indent();
-s.Printf("%s[%zi]=\"%*s\"\n", label_name, i++, int(entry.ref.size()),
- entry.ref.data());
+s.Format("{0}[{1}]=\"{2}\"\n", label_name, i++, entry.ref);
   }
-  s.Printf("%s[%zi]=NULL\n", label_name, i);
+  s.Format("{0}[{1}]=NULL\n", label_name, i);
   s.EOL();
 }
 
Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
===
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
@@ -513,8 +513,8 @@
  default:
encoding_flags = 0x0600; /* fall back to 0x0600, kCFStringEncodingASCII */
if (log) {
- log->Printf("Encountered an Objective-C constant string with unusual "
- "element size %llu",
+ log->Format("Encountered an Objective-C constant string with unusual "
+ "element size {0}",
  string_array->getElementByteSize());
}
  }


Index: lldb/trunk/source/Interpreter/Args.cpp
===
--- lldb/trunk/source/Interpreter/Args.cpp
+++ lldb/trunk/source/Interpreter/Args.cpp
@@ -213,10 +213,9 @@
   int i = 0;
   for (auto &entry : m_entries) {
 s.Indent();
-s.Printf("%s[%zi]=\"%*s\"\n", label_name, i++, int(entry.ref.size()),
- entry.ref.data());
+s.Format("{0}[{1}]=\"{2}\"\n", label_name, i++, entry.ref);
   }
-  s.Printf("%s[%zi]=NULL\n", label_name, i);
+  s.Format("{0}[{1}]=NULL\n", label_name, i);
   s.EOL();
 }
 
Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
===
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
@@ -513,8 +513,8 @@
  default:
encoding_flags = 0x0600; /* fall back to 0x0600, kCFStringEncodingASCII */
if (log) {
- log->Printf("Encountered an Objective-C constant string with unusual "
- "element size %llu",
+ log->Format("Encountered an Objective-C constant string with unusual "
+ "element size {0}",
  string_array->getElementByteSize());
}
  }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits