[cfe-dev] using python clang.cindex library to generate bindings ?
John McCall
rjmccall at apple.com
Mon May 3 10:59:51 PDT 2010
On May 3, 2010, at 10:45 AM, Stefan Seefeld wrote:
> On 05/01/2010 04:05 AM, Sebastien Binet wrote:
>> hi there,
>>
>> I just noticed that llvm/clang-2.7 provides a ctypes-based library
>> wrapping libCIndex.so for python.
>> Is it possible, planned or adviseable to use such a thing to
>> programatically generate a representation (say in json/xml) of some
>> C/C++ api so it could be then used to automatically generate bindings
>> in other high-level languages ?
>>
>
> I have been looking for such a thing myself. Working on Synopsis
> (http://synopsis.fresco.org), I'm interested into CLang to generate /
> populate Synopsis' abstract semantic graph (ASG) for the parsed code,
> which I then could manipulate further using Synopsis scripts (for
> example to generate API documentation).
>
> It seems the CIndex API is by far not rich enough for my needs, and I'm
> not sure whether that will change. I'm now looking into CLang's own AST
> et al. APIs instead, even though that's said to be much less stable than
> CIndex.
We make absolutely no stability guarantees for interacting with the AST through C++. Feel free to write code against it, but understand that your code will be version-locked and may need to be updated in possibly subtle ways every time you bump clang versions. That said, it's absolutely going to be a richer interface than libclang (f.k.a. CIndex).
John.
More information about the cfe-dev
mailing list