Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move raw_string_ostream back to raw_ostream.cpp #79224

Merged
merged 1 commit into from
Jan 24, 2024

Conversation

andykaylor
Copy link
Contributor

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.

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.
@llvmbot
Copy link
Collaborator

llvmbot commented Jan 23, 2024

@llvm/pr-subscribers-llvm-support

Author: Andy Kaylor (andykaylor)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/79224.diff

2 Files Affected:

  • (modified) llvm/lib/Support/raw_ostream.cpp (+8)
  • (modified) llvm/lib/Support/raw_socket_stream.cpp (-7)
diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp
index 3d3a564af51d120..c7064d2dfedc562 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 4659880cfe19499..a65865bcede12dd 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);
-}

Copy link

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff 6c98c5bd99b4c71a7895337cd4e437e023c2ec7a 2a3f2d6fed3c5b3c007bb829a4408d29a910d67b -- llvm/lib/Support/raw_ostream.cpp llvm/lib/Support/raw_socket_stream.cpp
View the diff from clang-format here.
diff --git a/llvm/lib/Support/raw_socket_stream.cpp b/llvm/lib/Support/raw_socket_stream.cpp
index a65865bced..6dc5d1fb3e 100644
--- a/llvm/lib/Support/raw_socket_stream.cpp
+++ b/llvm/lib/Support/raw_socket_stream.cpp
@@ -169,4 +169,3 @@ raw_socket_stream::createConnectedUnix(StringRef SocketPath) {
 }
 
 raw_socket_stream::~raw_socket_stream() {}
-

@andykaylor
Copy link
Contributor Author

This code was previously moved here: #75653

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@andykaylor andykaylor merged commit bb65f5a into llvm:main Jan 24, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants