[Status] Add a LLDB_ERRORF macro for error reporting (similar to LLDB_LOGF)
authorVedant Kumar <vsk@apple.com>
Wed, 11 Sep 2019 21:23:42 +0000 (21:23 +0000)
committerVedant Kumar <vsk@apple.com>
Wed, 11 Sep 2019 21:23:42 +0000 (21:23 +0000)
llvm-svn: 371667

lldb/include/lldb/Utility/Status.h

index 71a9879..e6a0a8e 100644 (file)
@@ -212,4 +212,11 @@ template <> struct format_provider<lldb_private::Status> {
 };
 }
 
+#define LLDB_ERRORF(status, fmt, ...)                                          \
+  do {                                                                         \
+    if (status) {                                                              \
+      (status)->SetErrorStringWithFormat((fmt), __VA_ARGS__);                  \
+    }                                                                          \
+  } while (0);
+
 #endif // #ifndef LLDB_UTILITY_STATUS_H