[cfe-dev] PTH questions
Daniel Dunbar
daniel at zuster.org
Sat Apr 4 10:33:19 PDT 2009
On Sat, Apr 4, 2009 at 2:04 AM, Robert Purves <listrp at gmail.com> wrote:
> 2. The command clang test.h produces the expected file test.h.gch.
> Is this file recognised and used automatically in subsequent
> compilations containing #include "test.h" (as gcc does), or is it
> necessary to add the option -include-pth=test.h.gch?
Yes, the driver will automatically look for this file when it sees a
-include option. If it finds it, it will automatically use the -include-pth
option to clang-cc.
--
ddunbar at ozzy:tmp$ touch t.h
ddunbar at ozzy:tmp$ touch t.c
ddunbar at ozzy:tmp$ clang t.h
ddunbar at ozzy:tmp$ ls
t.c t.h t.h.gch
ddunbar at ozzy:tmp$ clang -### -include t.h t.h
clang version 1.0
(https://ddunbar@llvm.org/svn/llvm-project/cfe/trunk68413:68417M)
Target: i386-apple-darwin10
"/Volumes/Data/ddunbar/llvm/Debug/bin/clang-cc" "-triple"
"i386-apple-darwin10" "-emit-pth" "-disable-free" "--relocation-model" "pic"
"--disable-fp-elim" "--unwind-tables=0" "--fmath-errno=0"
"-mmacosx-version-min=10.6.0" "-include-pth" "t.h.gch" "-o" "t.h.gch" "-x"
"c-header" "t.h"e
--
The design was chosen so that 'clang' could be dropped into a build system
that already uses gcc PCH files, and things would "just work". In the long
term we can do a lot more with PTH...
3. -include-pth hates to have the '=' omitted:
> $ clang -c test.c -o test.o -include-pth=test.h.gch
> $ clang -c test.c -o test.o -include-pth test.h.gch
> clang: warning: test.h.gch: 'linker' input file unused when '-c' is
> present
> error: PTH file -o could not be read
>
> Is this inscrutable error a bug, or By Design?
-include-pth is not intended to be used directly.
- Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090404/2ddc0213/attachment.html>
More information about the cfe-dev
mailing list