[llvm] Add raw_socket_stream (PR #73603)

Michael Spencer via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 12 00:05:02 PST 2023


================
@@ -942,6 +959,146 @@ bool raw_fd_stream::classof(const raw_ostream *OS) {
   return OS->get_kind() == OStreamKind::OK_FDStream;
 }
 
+//===----------------------------------------------------------------------===//
+//  raw_socket_stream
+//===----------------------------------------------------------------------===//
+
+#ifdef _WIN32
+WSABalancer::WSABalancer() {
+  WSADATA WsaData = {0};
+  if (WSAStartup(MAKEWORD(2, 2), &WsaData) != 0) {
+    llvm::report_fatal_error("WSAStartup failed");
+  }
+}
+
+WSABalancer::~WSABalancer() { WSACleanup(); }
+
+#endif // _WIN32
+
+std::error_code getLastSocketErrorCode() {
----------------
Bigcheese wrote:

This should be `static` as it's only used in this file.

https://github.com/llvm/llvm-project/pull/73603


More information about the llvm-commits mailing list