From 35b1a8382240732065790c88a0c515701c1a2beb Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Thu, 19 May 2022 00:58:36 -0400 Subject: [PATCH 25/28] Prefer to use static pointers in raw_ostream See #1401 --- llvm/lib/Support/raw_ostream.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp index 632b52235..a703a75ed 100644 --- a/llvm/lib/Support/raw_ostream.cpp +++ b/llvm/lib/Support/raw_ostream.cpp @@ -599,15 +599,15 @@ void raw_fd_ostream::anchor() {} raw_fd_ostream &llvm::outs() { // Set buffer settings to model stdout behavior. std::error_code EC; - static raw_fd_ostream S("-", EC, sys::fs::OF_None); + static raw_fd_ostream* S = new raw_fd_ostream("-", EC, sys::fs::OF_None); assert(!EC); - return S; + return *S; } raw_fd_ostream &llvm::errs() { // Set standard error to be unbuffered and tied to outs() by default. - static raw_fd_ostream S(STDERR_FILENO, false, true); - return S; + static raw_fd_ostream* S = new raw_fd_ostream(STDERR_FILENO, false, true); + return *S; } /// nulls() - This returns a reference to a raw_ostream which discards output.