[cfe-dev] index-test

Douglas Gregor dgregor at apple.com
Wed Sep 29 18:21:30 PDT 2010



Sent from my iPhone

On Sep 29, 2010, at 5:46 PM, dawn at burble.org wrote:

> http://clang.llvm.org/docs/libIndex.html describes how to use tool
> index-test, but this tools was apparently removed according to an ealier
> post (yet no one updated the doc!  doh!).

Oops. I'll kill the dead documentation. 

> I found c-index-test which has similar functionality but takes different
> arguments.  I would like to be able to study this tool to see how the
> CIndex API works, so would love it if someone could document how to use
> c-index-test.  I can only figure out how to do simple things from the
> usage.  For example, I created a pch from a source file with -write-pch
> but have no idea what it's good for.  Is this the "PCH preamble"
> discussed in a resply to my previous email?

No. It just creates a PCH file, and is equivalent to using the -x c-header or -x c++-header arguments to the normal clang driver. 
>   $/home/dawn/dev/llvm/Debug+Asserts/bin/c-index-test -write-pch /tmp/x.pch /tmp/x.c 
> 
> Now what?  I want to use /tmp/x.pch instead of /tmp/x.c.

-include /tmp/x 

will include it as a precompiled prefix header. That's just normal PCH usage, as documented in the user manual. 

> Ultimate goal - to create and use a PCH preamble with code completion to see how it works.

PCH preambles are automatic in libclang, but turning them on is a total hack. Set the CINDEXTEST_EDITING environment variables, as we do in the test suite, to enable them. 

> Thanks, 
> -Dawn
> _______________________________________________
> 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