[clangd-dev] Transport layer abstraction
Jan Korous via clangd-dev
clangd-dev at lists.llvm.org
Wed Sep 12 09:20:29 PDT 2018
We had an internal discussion about XPC use with clangd and the result is that XPC-based transport layer in clangd is a hard requirement. This effectively means that the adapter approach is not feasible and I am looking into the transport layer abstraction Sam proposed earlier (https://reviews.llvm.org/D49389). Sorry for the trouble!
There is a difficulty with designing an abstraction over transport layer due to XPC API requiring client code to hand control over. It's necessary for XPC server to call xpc_main() with a message handling callback:
But XPC is running it's own message loop inside xpc_main() which is supposed to never return (in case of failure exit() is called) which makes it difficult to have common interface for JSON RPC and XPC.
Unless I am mistaken that means that the message loop (Transport::loop(), ClangdLSPServer::run()) can't be part of generic code.
I am curious what are other people's thoughts on this?
I tried to come up with some reasonable abstraction but I am probably already anchored by my previous work (https://reviews.llvm.org/D48559) - all my design ideas tend to go in the direction of abstraction over JsonOutput and custom dispatchers (StdIoDispatcher/XPCDispatcher).
More information about the clangd-dev