blob: f5dce6b523016518c8e1b13c71e3a356d056b557 [file] [log] [blame]
James Kuszmaulb13e13f2023-11-22 20:44:04 -08001From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
James Kuszmaulcf324122023-01-14 14:07:17 -08002From: PJ Reiniger <pj.reiniger@gmail.com>
3Date: Thu, 19 May 2022 00:58:36 -0400
James Kuszmaulb13e13f2023-11-22 20:44:04 -08004Subject: [PATCH 24/31] Prefer to use static pointers in raw_ostream
James Kuszmaulcf324122023-01-14 14:07:17 -08005
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
James Kuszmaulb13e13f2023-11-22 20:44:04 -080012index f9928ac969932b6baea60a80750477d78b6a5b02..1de34976844d500970b833fca35324e2948733b7 100644
James Kuszmaulcf324122023-01-14 14:07:17 -080013--- a/llvm/lib/Support/raw_ostream.cpp
14+++ b/llvm/lib/Support/raw_ostream.cpp
James Kuszmaulb13e13f2023-11-22 20:44:04 -080015@@ -613,15 +613,15 @@ void raw_fd_ostream::anchor() {}
James Kuszmaulcf324122023-01-14 14:07:17 -080016 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.