[cfe-dev] extending clang C-API (CIndex)

Sebastien Binet binet at cern.ch
Fri Jun 11 16:22:18 PDT 2010


Stefan,

On Fri, 11 Jun 2010 16:14:15 -0400, Stefan Seefeld <seefeld at sympatico.ca> wrote:
> On 06/11/2010 03:24 PM, Sebastien Binet wrote:
> > hi there,
> >
> > I am about to work on extending the C-API provided by CIndex and friends
> > so I can introspect the AST and (especially) all the xyzDecl (from
> > python-ctypes.)
> >
> >
> >    
> 
> > so the convention would be:
> >
> > clang_[C++class-name]_[method-name]( cursor )
> >
> >
> > what do you think ?
> >    

[...]
> If you propose such a one-to-one mapping, it seems your proposed C API 
> will be no more stable than the C++ API. Why would anyone use that ?

the lingua franca beeing C, this extended C-api could be the basis for
bindings other than the python-ctypes ones.
every language out there has some kind FFI based on C.

I considered using the C++ API and the CPython one, but it felt like
work duplication wrt doing the same, extending directly libclang.
now, granted that some automation could be leveraged (swig,
gccxml+whatever) but that's an external dependency which I feel is
unnecessary.

cheers,
sebastien.
-- 
#########################################
# Dr. Sebastien Binet
# Laboratoire de l'Accelerateur Lineaire
# Universite Paris-Sud XI
# Batiment 200
# 91898 Orsay
#########################################



More information about the cfe-dev mailing list