[cfe-dev] Clang server with Thrift

Piotr Kukiełka piotr.kukielka at gmail.com
Fri Jan 4 12:36:57 PST 2013


This is my first post on this mailing list, so hello to everybody ;)

I wanted to use Clang for building C++ IDE in java.
Unlucky as you all know there is no default API for java (nor for
anything else than C and python).
I created drop-in replacement by auto generating java JNA API from C,
but it's a bit messy (for example doesn't have enums; if you want you
can find it here: https://github.com/pkukielka/jclang).
Actually this is general problem, not only for java.
Possible solution could be to use some external Clang server with API
defined in some standard, easy to implement format (like JSON). There
was already proposal of something like that
(http://clang-developers.42468.n3.nabble.com/RFC-A-proposal-for-a-Clang-based-service-architecture-td4024449.html)
but there are some problems with this design (like using own binary
protocol). Besides I don't know if any work on this was started.

IMHO possible solution to the problem would be to use Thrift to define
Clang API.
It would be based on current C API, with changes when needed (Thrift
support only passing by value).
That would allow us to generate C++ server and clients in virtually
any language (C++, C#, Cocoa, D, Delphi, Erlang, Haskell, Java, OCaml,
Perl, PHP, Python, Ruby, Smalltalk). Server would require some work
(but still much, much less than in original proposal) and clients
would require no work at all to create.

I already started working on this, for my own use if not for anything else.
But I'm curious about your opinions: does it make sense, would you
benefit from something like that?
Or maybe you see any serious problems with this Thrift approach?
Feel free to share your thoughts with me.


Thanks,
Peter



More information about the cfe-dev mailing list