[cfe-dev] PTH for C++

Reid Kleckner reid.kleckner at gmail.com
Mon Jun 28 14:52:41 PDT 2010


Hey folks,

I wanted to ask about the existing PTH support in clang, and how well
it works for C++.

I couldn't find any user facing documentation, but my understanding is
that you use it by picking some representative C++ file that includes
most of the headers you want to pre-tokenize and invoke clang like so:
clang -cc1 -emit-pth most_headers.h -o most_headers.h.pth

Then you do the rest of your compiles with -token-cache most_headers.h.pth:
clang -cc1 -token-cache most_headers.h.pth foo.cc -o foo.o

Is this correct?  If so, how would I go about modifying a standard
Makefile setup to use PTH?  I don't see how this functionality is
exposed through the driver.

Have other people had success with PTH?  I remember ddunbar mentioned
in passing on IRC that PTH doesn't work well for C++, but I'm looking
for more detail.  If no one has numbers for how it performs, I was
going to self-host clang using PTH to make some.

Thanks,
Reid



More information about the cfe-dev mailing list