[cfe-dev] [PATCH] get access to all files of compilation database

Tobias Koenig tobias.koenig at kdab.com
Thu Jul 12 06:39:34 PDT 2012


Hej,

when implementing some static code analysis tool based on clang, you often 
want to introspect the complete code base of a project. With the current API, 
you have to specify the list of files explicitly by passing them as second 
parameter to the constructor of tooling::ClangTool and
the common approach seems to be to pass in this list as command line 
parameters to your application.
Now I wonder whether the CompilationDatabase class (which has loaded all the 
compilation information from compile_commands.json already) could provide a 
getter method to retrieve the list of files and passing it to 
tooling::ClangTool directly.

Attached is a patch for that. No idea how to handle the usage of 
FixedCompilationDatabase in this case though.

Any suggestions, objections, comments?

Ciao,
Tobias
-- 
Tobias Koenig | tobias.koenig at kdab.com | Developer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel. Germany +49-30-521325470, Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compilationdatabase.patch
Type: text/x-patch
Size: 2834 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120712/f36b7250/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3636 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120712/f36b7250/attachment-0001.bin>


More information about the cfe-dev mailing list