[libc-commits] [libc] [llvm] [libc] Make rpc_server.h independent from libc internals (PR #190423)

Matt Arsenault via libc-commits libc-commits at lists.llvm.org
Mon Apr 6 07:31:07 PDT 2026


================
@@ -9,15 +9,778 @@
 #ifndef LLVM_LIBC_SHARED_RPC_SERVER_H
 #define LLVM_LIBC_SHARED_RPC_SERVER_H
 
-#include "libc_common.h"
-#include "src/__support/RPC/rpc_server.h"
+#include "rpc.h"
+#include "rpc_opcodes.h"
 
-namespace LIBC_NAMESPACE_DECL {
-namespace shared {
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
-using LIBC_NAMESPACE::rpc::handle_libc_opcodes;
+#ifdef _WIN32
+#define flockfile _lock_file
+#define funlockfile _unlock_file
+#define fwrite_unlocked _fwrite_nolock
+#endif
 
-} // namespace shared
-} // namespace LIBC_NAMESPACE_DECL
+namespace rpc {
+
+// Minimal replacement for 'std::vector' that works for trivial types.
+template <typename T> class TempVector {
+  T *data_;
+  size_t current;
+  size_t capacity;
+
+public:
+  inline TempVector() : data_(nullptr), current(0), capacity(0) {}
+
+  inline ~TempVector() { free(data_); }
+
+  inline void push_back(const T &value) {
+    if (current == capacity)
+      grow();
+    data_[current++] = value;
+  }
+
+  inline void pop_back() { --current; }
----------------
arsenm wrote:

Don't need all these inlines 

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


More information about the libc-commits mailing list