summaryrefslogtreecommitdiffstats
path: root/lldb/source/Utility/Error.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-02-16 19:38:21 +0000
committerZachary Turner <zturner@google.com>2017-02-16 19:38:21 +0000
commit24ae6294a4a97d4dfe0e43f7bcd52811b6346c17 (patch)
treefbca446d37efde935ee0a5c69ac1410c7c6a1b94 /lldb/source/Utility/Error.cpp
parentcac10f9768594c039d1f4dc41ece8380ba448b07 (diff)
downloadbcm5719-llvm-24ae6294a4a97d4dfe0e43f7bcd52811b6346c17.tar.gz
bcm5719-llvm-24ae6294a4a97d4dfe0e43f7bcd52811b6346c17.zip
Finish breaking the dependency from Utility.
Differential Revision: https://reviews.llvm.org/D29964 llvm-svn: 295368
Diffstat (limited to 'lldb/source/Utility/Error.cpp')
-rw-r--r--lldb/source/Utility/Error.cpp24
1 files changed, 4 insertions, 20 deletions
diff --git a/lldb/source/Utility/Error.cpp b/lldb/source/Utility/Error.cpp
index 3b3d1fa32c4..0b14949e88f 100644
--- a/lldb/source/Utility/Error.cpp
+++ b/lldb/source/Utility/Error.cpp
@@ -20,8 +20,8 @@
#include "llvm/ADT/SmallVector.h"
// Project includes
-#include "lldb/Host/PosixApi.h"
#include "lldb/Utility/Error.h"
+#include "lldb/Utility/VASPrintf.h"
using namespace lldb;
using namespace lldb_private;
@@ -233,25 +233,9 @@ int Error::SetErrorStringWithVarArg(const char *format, va_list args) {
if (Success())
SetErrorToGenericError();
- // Try and fit our error into a 1024 byte buffer first...
- llvm::SmallVector<char, 1024> buf;
- buf.resize(1024);
- // Copy in case our first call to vsnprintf doesn't fit into our
- // allocated buffer above
- va_list copy_args;
- va_copy(copy_args, args);
- unsigned length = ::vsnprintf(buf.data(), buf.size(), format, args);
- if (length >= buf.size()) {
- // The error formatted string didn't fit into our buffer, resize it
- // to the exact needed size, and retry
- buf.resize(length + 1);
- length = ::vsnprintf(buf.data(), buf.size(), format, copy_args);
- va_end(copy_args);
- assert(length < buf.size());
- }
- m_string.assign(buf.data(), length);
- va_end(args);
- return length;
+ llvm::SmallString<1024> buf;
+ VASprintf(buf, format, args);
+ return buf.size();
} else {
m_string.clear();
}
OpenPOWER on IntegriCloud