[cfe-dev] Pre-tokenized header file usage

Steve Frankwilde mexicocanwait at hotmail.com
Mon Jul 29 23:36:56 PDT 2013


Greetings clang devs!

Firstly, thanks very much where appropriate for the work on this 
compiler solution; it's a life saver to have such a powerful compiler 
available with yet such a permissive license.

I have a question about the usage of PTH files for a small project I'm 
working on involving Clang.

I'm using Clang to compile small scripts that my users write for my 
application. When the user hits the compile button the program adds a 
bunch of glue code to the script and adds some includes from a small 
code base. The end user doesn't need to see any of that code.

Ideally I want this code base embedded in my application rather than 
distributed with the program as headers/cpp files, however having it 
stored in a pre-tokenized header file (a so-called "token cache") also 
sounds like a good option, particularly since it would speed up 
compilation a bit.

So before I dig too deeply into this, my question is: would it be 
possible for me to bundle all of my code into a PTH file and use that 
during compilation without requiring the original header files to be 
distributed with my application?

Thanks very much for your consideration!
Steve



More information about the cfe-dev mailing list