[cfe-dev] Getting involved with Clang refactoring

Arnaud de Grandmaison arnaud.allarddegrandmaison at parrot.com
Wed May 30 04:56:09 PDT 2012

On 05/28/2012 12:42 PM, Manuel Klimek wrote:
> On Mon, May 28, 2012 at 12:25 PM, Arnaud ALLARD DE GRANDMAISON
> <arnaud.allarddegrandmaison at parrot.com
> <mailto:arnaud.allarddegrandmaison at parrot.com>> wrote:
>     Hi Manuel,
>     For your information, I started the work on point #2 : integrating
>     compilation database in libclang + the corresponding python binding.
> Awesome - feel free to cc me directly to any patches you send out for
> review regarding this.
> Cheers,
> /Manuel


Here is a preliminary patch to let you know where I stand right now as I
will be away for a few days. It has the libclang c functions + python
bindings to export the CompilationDatabase functionality. It is already
usable with the python script attached.

Feel free to make any comments before I engage further down this way.

A few remarks / questions :
- no tests yet. For libclang, I intend to do it thru c-index-test and
provide a 'compile_commands.json' in test/Index. The JSON syntax does
not allow comments to be embedded inside, so I will probably have to add
a another file to manage the c-index-test call with lit. For the python
binding, I will enhance the attached python script.
- What is the invariant for class CompileCommand ? I understood from the
mailing list that CommandLine[0] is the compiler executable. Are there
any other ?
- Error management : simplistic for now. Either aborts with a hopefully
useful message, or return a value which the caller is expected to
interpret correctly. Any thoughts on this ?
- (not related to this patch) Would it make sense for CompileCommand to
provide a higher level interface for the CommandLine (at the C++ level).
As a user of the CommandLine for a CompileCommand, I would have expected
an easy way to access easily (and separately) some important parts of it
: executable name (ok, that's the first argument), input file and output
file. This capture the fact that a CommandLine is $(compiler)
$(bunch_of_args) -o $(output) $(input) and enable user to adapt to
$(compiler) or mangle $(output) / $(input) depending on the
application's needs.


Arnaud de Grandmaison

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120530/fcbaad53/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cindex-cdb.patch
Type: text/x-patch
Size: 12079 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120530/fcbaad53/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-cdb.py
Type: text/x-python
Size: 568 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120530/fcbaad53/attachment.py>

More information about the cfe-dev mailing list