[cfe-dev] Running clang programmatically

Stefan Seefeld stefan.seefeld at gmail.com
Wed Mar 17 08:07:09 PDT 2010


Doug, Daniel,

thanks for your help.

On 03/17/2010 02:18 AM, Douglas Gregor wrote:
>
>> 1) Is the function call sequence above (approximately) correct ? (If
>> not, what is wrong ?)
>
>
> Do not pass -Xclang. It is for internal use only, and misuse will 
> confuse the driver. You don't need to pass any arguments.

OK, I have removed that, and the error as well as the segfault went away.


>
>> 2) Where is the current error emitted, and how may I intercept it
>> programmatically ?
>
> Driver errors can't easily be intercepted at the moment, so they go to 
> standard error. In the near future, all diagnostics will go through 
> the diagnostic interface of CIndex.

OK, thanks.

Is there any reason why I should use the current C API, instead of C++ ? 
I'd expect C++ to give me a much more structured API with a more 
fine-grained control over the preprocessing and parsing process, instead 
of having to pass options as string arguments. That almost looks like 
shell scripting ! :-)

Thanks,
         Stefan

-- 

       ...ich hab' noch einen Koffer in Berlin...




More information about the cfe-dev mailing list