[cfe-commits] r68594 - /cfe/trunk/docs/PTHInternals.html

Ted Kremenek kremenek at apple.com
Thu Apr 9 10:36:44 PDT 2009


On Apr 8, 2009, at 7:30 AM, Neil Booth wrote:

>> +<p>The high-level interface to generate a PTH file is the same as  
>> GCC's:</p>
>> +
>> +<pre>
>> +  $ gcc -x c-header test.h -o test.h.gch
>> +  $ clang -x c-header test.h -o test.h.pth
>> +</pre>
>> +
>> +<p>A PTH file can then be used as a prefix header when a <tt>- 
>> include</tt>
>> +option is passed to <tt>clang</tt>:</p>
>
> -include-pth?

No.  'clang', being the high-level driver, matches the interface of  
gcc.  There we use '-include'; if a pth file is found clang passes '- 
include-pth' to clang-cc; otherwise it passes '-include' with the  
original .h file to clang-cc.

>
>> +<p>In this example, <tt>clang</tt> will not automatically use the  
>> PTH file for
>> +<tt>test.h</tt> since <tt>test.h</tt> was included directly in the  
>> source file
>> +and not specified on the command line using <tt>-include</tt>.</p>
>
> Again? If not I can't reconcile with
>
>> +files.  Similarly, PTH files can be used as prefix headers using  
>> the <tt>-include-pth</tt> option:</p>

Both sections are labeled with "high-level" and "low-level" interface  
respectively.  Do you have any advice on how to clarify this to the  
reader?

>
> As an aside, having read your documentation, it would be perhaps
> more user-friendly if the compiler would manage to figure out itself
> if a precompiled header file were usable and if so use it  
> automatically

I'm not debating this point, but I'm not certain what you mean.   
'clang' already does this for the '-include' option.

> (given a suitable command line option, that however wouldn't require
> a file name).  I believe Borland and EDG use something like this
> (and maybe MSVC), in conjunction with the #pragma hrdstop hint to
> indicate up to where the PCH should be available until.

Could you elaborate a little more?  This point isn't completely clear  
to me.

Thanks Neil.



More information about the cfe-commits mailing list