blob: 36a884c490906d1ec2bd86db8b895c95046205a7 [file] [log] [blame]
James Kuszmaulcf324122023-01-14 14:07:17 -08001From 35b1a8382240732065790c88a0c515701c1a2beb Mon Sep 17 00:00:00 2001
2From: PJ Reiniger <pj.reiniger@gmail.com>
3Date: Thu, 19 May 2022 00:58:36 -0400
4Subject: [PATCH 25/28] Prefer to use static pointers in raw_ostream
5
6See #1401
7---
8 llvm/lib/Support/raw_ostream.cpp | 8 ++++----
9 1 file changed, 4 insertions(+), 4 deletions(-)
10
11diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp
12index 632b52235..a703a75ed 100644
13--- a/llvm/lib/Support/raw_ostream.cpp
14+++ b/llvm/lib/Support/raw_ostream.cpp
15@@ -599,15 +599,15 @@ void raw_fd_ostream::anchor() {}
16 raw_fd_ostream &llvm::outs() {
17 // Set buffer settings to model stdout behavior.
18 std::error_code EC;
19- static raw_fd_ostream S("-", EC, sys::fs::OF_None);
20+ static raw_fd_ostream* S = new raw_fd_ostream("-", EC, sys::fs::OF_None);
21 assert(!EC);
22- return S;
23+ return *S;
24 }
25
26 raw_fd_ostream &llvm::errs() {
27 // Set standard error to be unbuffered and tied to outs() by default.
28- static raw_fd_ostream S(STDERR_FILENO, false, true);
29- return S;
30+ static raw_fd_ostream* S = new raw_fd_ostream(STDERR_FILENO, false, true);
31+ return *S;
32 }
33
34 /// nulls() - This returns a reference to a raw_ostream which discards output.