<div><br><div class="gmail_quote"><div>On Wed, Feb 15, 2017 at 5:54 AM Pavel Labath via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">labath added inline comments.<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
================<br class="gmail_msg">
Comment at: lldb/source/Utility/VASprintf.cpp:18<br class="gmail_msg">
+                             va_list args) {<br class="gmail_msg">
+  llvm::SmallString<16> error("<Encoding error>");<br class="gmail_msg">
+<br class="gmail_msg">
----------------<br class="gmail_msg">
It doesn't look like you should need to allocate a stack object with the string every time. Can't you just assign `buf = "..."` in the error case?<br class="gmail_msg">
<br class="gmail_msg">
</blockquote><div><br></div><div>No because buf is a SmallVectorImpl, which doesn't have a conversion from anything else</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br class="gmail_msg">
<br class="gmail_msg">
================<br class="gmail_msg">
Comment at: lldb/source/Utility/VASprintf.cpp:28<br class="gmail_msg">
+  if (length < 0) {<br class="gmail_msg">
+    buf = error;<br class="gmail_msg">
+    goto finish;<br class="gmail_msg">
----------------<br class="gmail_msg">
Could you also have the function return false in case of an error? You can leave the callers ignoring it, as they weren't handling these errors anyway, but now at least they would have a chance. I know this is meant to go away in the future, but noone know how soon will that be, and it seems like a bad idea to introduce a new abstraction with such an obviously flawed interface (as in, the only way to check if it failed is to inspect the printed-to string).<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<a href="https://reviews.llvm.org/D29964" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D29964</a><br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
</blockquote></div></div>