#include "llvm/System/Signals.h"
#include "llvm/System/Threading.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/Config/config.h"
#include <cassert>
#include <cstdlib>
// succeeds (e.g. handling EINTR) and we can't use errs() here because
// raw ostreams can call report_fatal_error.
SmallVector<char, 64> Buffer;
- StringRef ReasonStr = Reason.toStringRef(Buffer);
-
- ::write(2, "LLVM ERROR: ", 12);
- ::write(2, ReasonStr.data(), ReasonStr.size());
- ::write(2, "\n", 1);
+ raw_svector_ostream OS(Buffer);
+ OS << "LLVM ERROR: " << Reason << "\n";
+ StringRef MessageStr = OS.str();
+ ssize_t written = ::write(2, MessageStr.data(), MessageStr.size());
+ (void)written; // If something went wrong, we deliberately just give up.
}
// If we reached here, we are failing ungracefully. Run the interrupt handlers