[cfe-dev] How to setup a basic program using clang libs?

Manuel Klimek klimek at google.com
Mon Jun 11 12:34:25 PDT 2012


On Sun, Jun 10, 2012 at 2:52 AM, Sean Silva <silvas at purdue.edu> wrote:

> The system headers thing is a major gotcha that really frustrated me when
> I was first starting to program with clang. The reality is that the work of
> setting up the default system headers is done by the Driver (or Frontend, I
> forget which). Those parts of clang are separate from the Preprocessor, so
> there is just no simple way to have it "just work" :(
>
> The "usual" way to work around this is to run as a clang plugin. There are
> docs about that at http://clang.llvm.org/docs/ClangPlugins.html
>

Depending on what your goals are, libclang or libtooling might also fit
your use case.
Start at:
http://clang.llvm.org/docs/Tooling.html
with a comparison of the approaches (I don't know whether libclang supports
preprocessor interception; if not, libtooling and clang plugins are your
options).

Cheers,
/Manuel


>
> best of luck,
> --Sean Silva
>
> On Sat, Jun 9, 2012 at 2:22 PM, Bertjan Broeksema <broeksema at kde.org>wrote:
>
>> Hi all,
>>
>> I'm trying to get known with using the clang libraries but I'm somewhat
>> stuck. First of all most documentation (in particular tutorials) seem
>> outdated, any pointers would be appreciated.
>>
>> Currently I've a simple program which does nothing more than setting up
>> the
>> preprocessor but it doesn't find standard include headers it seems.
>> Probably
>> I'm missing something trivial but I currently don't see what. Any help
>> would
>> be appreciated.
>>
>> For the context, I'm trying to write a little program that prints out the
>> include tree of a source file.
>>
>> Cheers,
>>
>> Bertjan
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120611/69c7d5f0/attachment.html>


More information about the cfe-dev mailing list