[LLVMdev] [RFC] Developer Policy for LLVM C API

Chris Lattner clattner at apple.com
Sun Jul 19 21:54:59 PDT 2015


On Jul 19, 2015, at 7:24 PM, Eric Christopher <echristo at gmail.com> wrote:
> So, I made this proposal for what I think is a pretty good reason. There's an "unofficial" as Juergen said, policy that the C API is the stable API. There's nothing wrong with a stable C API, but that's what I'm proposing should move out of tree to where those that are most concerned with it can develop it and ensure that it remains stable for whatever guarantees they want.

I don’t get it :-)

> Some background here:
> 
> Right now we definitely have this dichotomy between a "bindings" C API and a "stable" C API. The unofficial policy as I mentioned above is that there's one C API and that's the stable API. Over the last 3-5 years or so the "stable" C API has started growing in ways that encompass just about every class and API in llvm. We've occasionally denied bindings level API support because we knew the code in that area was going to change - but just imagine we'd let a few of them in, we wouldn't have been able to do the IR/Metadata split at all. As it is we technically broke the C API, just not in a way that any external user cared about.

Ok, I don’t see how splitting it out to a separate project helps that.

> Back to the proposal:
> 
> What I'm proposing is that we make the C API that exists in tree a bindings API that has the same stability guarantees as the C++ API. Honestly it'll probably much more stable, but at least then we won't have to worry or revert work because the C API was "too close to the machine" or rather the C++ code.  This means that someone that wants a stable C API can go off and develop one (tests and all) and we can possibly look at bringing it back into tree at some point in the future. For example, if someone comes up with a good "libjit" api then we can look at how the API design works and make sure it's general enough that it's not going to cause undue solidification of the existing APIs.
> 
> Caveat: I'm not talking about the existing libclang or liblto libraries. Those seem to work and have a small enough API surface that they seem reasonable to support and we can move to a new API if they seem to be hindering development in the future.
> 
> This help explain where I'm coming from here?

No, this makes me even more concerned.

The entire original reason for the C API is to provide a stable interface for people who didn’t want to chase the C++ API (or didn’t want to chase *as much* of it).  In this sense, I consider the LLVM C API to be unlike the other “bindings” for generating IR: its purpose is to remain stable, not to be a language binding for people who prefer to write things in C.

If your claim is that the C API is too restrictive and prevents C++ evolution, then we just need to be careful about what we add to the C API.  Splitting it out to another project would not address this concern anyway, unless what you’re really saying is “we can break the C API even though it is trying to be stable, because its an external project”.

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150719/3015f81a/attachment.html>


More information about the llvm-dev mailing list