I know that the gcc preprocessor can only use -fpreprocessed to remove comments from a file and leave everything else untouched, but how can I do the same with clang?
As described here , use -E (and probably -P to exclude line number information)
clang -E -P <inputfile> -o <outputfile>
(although this will do more than just delete comments - it will also expand macros, etc.)