Is there a way to compile C++ several files using Clang in one process?
For benchmarking reason, I need to use the Clang (clang++) compiler to compile several C++ files using only one process.
Indeed, by default, the compiler use several process to compile the files and that makes my benchmark to not works the way I want.
I know this is a unc开发者_开发技巧ommon question, but this is only for a special case, in general, I don't need that.
Edit : It is breaking my benchmark, because I generate a call graph of the execution using CallGrind and then I've several call graphs, one by process
Edit 2 : From what I understand, clang++ is forking to clang for every file
Take a look at the result of clang++ file1.cc -c -###
(plus whatever flags you need). You should be able to stuff additional input files into the command starting with clang -cc1
, and have them all compile without any forking. This mode of operation isn't really supported, but it works as far as I know.
精彩评论