[cfe-dev] Handling multiple files with libclang

Jacob Carlborg doob at me.com
Fri May 18 12:53:27 PDT 2012


On 2012-05-18 17:25, Douglas Gregor wrote:

> Unfortunately, libclang just skips over all files beyond the first one, and doesn't even tell you that it's doing it. We would need to introduce some new API into libclang to parse a command line into its respective pieces to get this information back to the user.

That would be nice to have.

> Since you're building the tool yourself, you might consider just tweaking your command-line syntax to make this obvious for your tool where the source files are. For example, do something like:
>
> 	your-tool source1.c source2.cpp source3.cpp -- -Wall<command-line arguments>
>
> 	- Doug

I've currently implemented it like this:

I'm iterating over all arguments. If an argument doesn't start with '-' 
and then previous argument doesn't start with '-' then I'm considering 
it to be an input file. I'm not sure if this covers all cases.

-- 
/Jacob Carlborg




More information about the cfe-dev mailing list