

Measuring C API Coverage with Go - dradtke
http://blog.damienradtke.org/cgo-api-coverage/

======
jessevdk
Shameless plug (but possibly interesting), we do something similar (but using
clang) to generate a coverage report for the gobject bindings for libgit2:
[https://git.gnome.org/browse/libgit2-glib/tree/tools/coverag...](https://git.gnome.org/browse/libgit2-glib/tree/tools/coverage.py)

~~~
SloopJon
Wow. Although I was vaguely aware that Clang is tool friendly, I had no idea
about libclang, let alone its Python bindings. A search for "python clang
module" turned up a mention of pycparser. Any idea how it compares? I guess
its main advantage is that it's pure Python.

~~~
jessevdk
I can't really compare, because I've personally never used pycparser. The nice
thing about using libclang is that you're just using the same backend as the
actual compiler and you can be sure that you're going to parse complex things
correctly and reliably.

------
unfamiliar
To make this applicable to other APIs, wouldn't it be better to use the Clang
API to parse the C/C++ code and get a list of functions? Writing your own
parser seems prone to failure given the difficulty of C/C++ parsing.

~~~
girvo
Yeah. Has GCC built that feature in as well yet, or is the "plugin" side still
pretty crippled? If one went about writing a nice generic tool like this,
you'd want it to be able to handle both, I guess.

~~~
stingraycharles
Officially, GCC has it built-in, but I don't know of many projects using it.
As far as I understand, Clang's API is more pleasant to use.

