From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: PJ Reiniger Date: Thu, 19 May 2022 00:58:36 -0400 Subject: [PATCH 21/34] raw_ostream: 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 ca4492ad814505349f3e5ddfe67a165d78e35a6e..09f7ede10e4c3decb2c6d70a3e8ce7660f542519 100644 --- a/llvm/lib/Support/raw_ostream.cpp +++ b/llvm/lib/Support/raw_ostream.cpp @@ -605,9 +605,9 @@ raw_fd_ostream &llvm::outs() { assert(!EC1); (void)EC1; - 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() { @@ -617,8 +617,8 @@ raw_fd_ostream &llvm::errs() { (void)EC; // Set standard error to be unbuffered. - 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.