[cfe-dev] using the original file name for compiling preprocessed files ("-main-file-name"?)
Robert Lytton
robert at xmos.com
Thu May 1 02:22:19 PDT 2014
Hi,
I would like to call clang twice, once to preprocess and second time to compile.
The second time clang is called, I would like to pass in the original file name for it to use as the ModuleID.
I tried to use:
clang -E test.c -o tmp.i
clang -S -x c tmp.i -o test.s -Xclang -main-file-name -Xclang test.c -emit-llvm
However, the ModuleID is 'tmp.i' rather than that passed in by '-main-file-name'.
Same with:
clang -cc1 -triple x86_64-unknown-linux-gnu -x c tmp.i -o test.s -main-file-name test.c -emit-llvm
I am trying to achieve the same affect as using "-fpreprocessed -dumpbase <file>" with llvm-gcc.
Here it seems the gcc front end fetches the file name from the first line of the preprocessed file.
Thank you.
Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140501/400908a6/attachment.html>
More information about the cfe-dev
mailing list