[cfe-dev] Proposal: libclang code generation

Gregory Szorc gregory.szorc at gmail.com
Mon Dec 12 22:41:42 PST 2011


I started a conversation in #llvm a few days ago regarding adding code
generation support to libclang (I'm indygreg on IRC). People seemed
receptive to the idea, so, I performed some preliminary work around a
proposal for the API. I've produced a couple of new header files [1][2]
with the proposed API. Higher-level comments and questions are in a
README [3].

I'm requesting review of the proposal from the larger community. I'd
like to get "sign off" of the C API/.h files before I start working on
the implementation so I'm confident I'm producing the right thing.

There likely also needs to be a larger discussion around the structure
of libclang. The gory details are in the README [3]. The tl;dr is that
the existing API pigeonholes generic functionality as specific to the
Index module and feature expansion of libclang will likely require a)
API breakage due to required refactoring, and/or b) an ill-conceived
code layout and naming convention.

This is my first time hacking on LLVM or Clang. I fully expect that
there are many deficiencies in my proposal due to ignorance. I have
thick skin, so let me hear it!

[1]
https://github.com/indygreg/clang/blob/libclang_compiler/include/clang-c/CodeGen.h
[2]
https://github.com/indygreg/clang/blob/libclang_compiler/include/clang-c/Compiler.h
[3]
https://github.com/indygreg/clang/blob/libclang_compiler/README.libclang_changes

Gregory Szorc
gregory.szorc at gmail.com




More information about the cfe-dev mailing list