[cfe-dev] Running clang programmatically

Daniel Dunbar daniel at zuster.org
Wed Mar 17 16:05:08 PDT 2010


On Wed, Mar 17, 2010 at 8:07 AM, Stefan Seefeld
<stefan.seefeld at gmail.com> wrote:
> 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++ ?

So we won't constantly be breaking your client code. The C API is
stable(ish), the C++ API is not.

We have also put more effort into making the C API "sane", the C++ API
(especially once you dig deeper) has many warts which you might end up
having to grovel through yourself, as opposed to reading the C API
documentation.

 - Daniel

> 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...
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>




More information about the cfe-dev mailing list