[llvm] Move raw_string_ostream back to raw_ostream.cpp (PR #79224)

Andy Kaylor via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 23 15:15:03 PST 2024


https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/79224

The implementation of raw_string_ostream::write_impl() was moved to raw_socket_stream.cpp when the raw_socket_ostream support was separated. This patch moves it back to facilitate disabling socket support in downstream projects.

>From 2a3f2d6fed3c5b3c007bb829a4408d29a910d67b Mon Sep 17 00:00:00 2001
From: Andy Kaylor <andrew.kaylor at intel.com>
Date: Tue, 23 Jan 2024 15:07:19 -0800
Subject: [PATCH] Move raw_string_ostream back to raw_ostream.cpp

The implementation of raw_string_ostream::write_impl() was moved to
raw_socket_stream.cpp when the raw_socket_ostream support was separated.
This patch moves it back to facilitate disabling socket support in
downstream projects.
---
 llvm/lib/Support/raw_ostream.cpp       | 8 ++++++++
 llvm/lib/Support/raw_socket_stream.cpp | 7 -------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp
index 3d3a564af51d12..c7064d2dfedc56 100644
--- a/llvm/lib/Support/raw_ostream.cpp
+++ b/llvm/lib/Support/raw_ostream.cpp
@@ -954,6 +954,14 @@ bool raw_fd_stream::classof(const raw_ostream *OS) {
   return OS->get_kind() == OStreamKind::OK_FDStream;
 }
 
+//===----------------------------------------------------------------------===//
+//  raw_string_ostream
+//===----------------------------------------------------------------------===//
+
+void raw_string_ostream::write_impl(const char *Ptr, size_t Size) {
+  OS.append(Ptr, Size);
+}
+
 //===----------------------------------------------------------------------===//
 //  raw_svector_ostream
 //===----------------------------------------------------------------------===//
diff --git a/llvm/lib/Support/raw_socket_stream.cpp b/llvm/lib/Support/raw_socket_stream.cpp
index 4659880cfe1949..a65865bcede12d 100644
--- a/llvm/lib/Support/raw_socket_stream.cpp
+++ b/llvm/lib/Support/raw_socket_stream.cpp
@@ -170,10 +170,3 @@ raw_socket_stream::createConnectedUnix(StringRef SocketPath) {
 
 raw_socket_stream::~raw_socket_stream() {}
 
-//===----------------------------------------------------------------------===//
-//  raw_string_ostream
-//===----------------------------------------------------------------------===//
-
-void raw_string_ostream::write_impl(const char *Ptr, size_t Size) {
-  OS.append(Ptr, Size);
-}



More information about the llvm-commits mailing list