[cfe-dev] Running clang programmatically
daniel at zuster.org
Wed Mar 17 18:05:08 CDT 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
> 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 ! :-)
> ...ich hab' noch einen Koffer in Berlin...
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
More information about the cfe-dev