From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Thu, 19 May 2022 00:58:36 -0400 Subject: [PATCH 25/30] 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 f9928ac969932b6baea60a80750477d78b6a5b02..1de34976844d500970b833fca35324e2948733b7 100644 --- a/llvm/lib/Support/raw_ostream.cpp +++ b/llvm/lib/Support/raw_ostream.cpp @@ -613,15 +613,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.