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.
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.
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.
Yeah, my approach is definitely one of "get it done as quickly as possible for my specific use case", and since Allegro made its headers easy to parse, I decided to just take advantage of that.
Maybe in the future I'll rewrite it to use libclang.
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.