[cfe-dev] Handling multiple files with libclang

Jacob Carlborg doob at me.com
Fri May 18 05:38:18 PDT 2012


What I've understood, libclang can only parse one file/translation unit 
at the time. I'm working on a tool where I would like to be able to pass 
multiple files on the command line and process them with libclang. 
Should I be calling "clang_parseTranslationUnit", or similar, once for 
each file to accomplish this?

If I'm supposed to call "clang_parseTranslationUnit" multiple times then 
my next question is: how do I handle the command line arguments? I know 
that "clang_parseTranslationUnit" handles the command line arguments but 
how do I get the rest of the files, the ones that weren't handle by 
libclang.

I could handle the command line arguments myself but that would 
basically mean to replicate what libclang already does. This would also 
mean that my tool could break if clang removes a flag or adds a new one.

-- 
/Jacob Carlborg




More information about the cfe-dev mailing list