From 3490ff40020aa1b46ca63bfe40afd219a3b54606 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 18 Aug 2010 22:04:43 +0000 Subject: [PATCH] Tidy. llvm-svn: 111432 --- llvm/lib/Support/ErrorHandling.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/llvm/lib/Support/ErrorHandling.cpp b/llvm/lib/Support/ErrorHandling.cpp index 08830dc80b0f..0b7af3e5905b 100644 --- a/llvm/lib/Support/ErrorHandling.cpp +++ b/llvm/lib/Support/ErrorHandling.cpp @@ -66,11 +66,10 @@ void llvm::report_fatal_error(const Twine &Reason) { // succeeds (e.g. handling EINTR) and we can't use errs() here because // raw ostreams can call report_fatal_error. SmallVector 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(); + (void)::write(2, MessageStr.data(), MessageStr.size()); } // If we reached here, we are failing ungracefully. Run the interrupt handlers