Using Clang infrastructure to generate semantic databases

Marco Craveiro <[email protected]> Tue, 26 May 2015 20:12:46 +0100
Newsgroups gmane.emacs.cedet
Message-ID <CAKRNd4zORrDOMcFdPurgMirMAOHnRkO9n2VCe8NvGxsrugy4hw@mail.gmail.com>
Hi Cedeters,

First, apologies if this has been discussed already, but I have
struggled with the mailinglist searches.

My emacs stalls occasionally whilst generating the semantic database
files. I am aware of the idle time approach and the ahead of time
scanning and so on, but this got me wondering: would it not make sense
to use clang to dump the semantic information directly? e.g. to write
a tool that generates the semantic files in exactly the same format as
semantic needs them. The tool could then be integrated with the build
process. The tool would have no dependencies at all on semantic (or
emacs or lisp for that matter) - other than, of course, outputting
according to the semantic file format.

Please note that I am not proposing some intermediate file format or
accessing the AST directly as mentioned in other discussions[1];
instead, I am thinking of an executable that, given a hpp or cpp file,
generates the corresponding semantic cache files. These files are
expected to be identical to those that would have been generated by
semantic itself (within reason, such as ordering, etc). The tool would
receive a path to the compilation database with all of the required
configuration.

Has anyone done such a thing - or are there reasons why this would not work?

Many thanks for your time.

Marco
-- 
Optimism is an occupational hazard of programming; feedback is the
treatment. -- Kent Beck

http://about.me/marcocraveiro

[1] https://lwn.net/Articles/632773/

------------------------------------------------------------------------------