[Lldb-commits] [PATCH] D29964: Finish breaking the dependency from lldbUtility -> Host

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 15 05:54:30 PST 2017


labath added inline comments.


================
Comment at: lldb/source/Utility/VASprintf.cpp:18
+                             va_list args) {
+  llvm::SmallString<16> error("<Encoding error>");
+
----------------
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?



================
Comment at: lldb/source/Utility/VASprintf.cpp:28
+  if (length < 0) {
+    buf = error;
+    goto finish;
----------------
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).


https://reviews.llvm.org/D29964





More information about the lldb-commits mailing list