@john is correct. For posterity, the relevant portions of the FAQ are (with names tweaked to match the question) :
clang -cc1
is the frontend, clang
is the driver. The driver invokes the frontend with options appropriate for your system. To see these options, run:
$ clang++ -### -c foo.cpp
Some clang command line options are driver-only options, some are frontend-only options. Frontend-only options are intended to be used only by clang developers. Users should not run clang -cc1
directly, because -cc1
options are not guaranteed to be stable.
If you want to use a frontend-only option (“a -cc1
option”), for example -ast-dump
, then you need to take the clang -cc1
line generated by the driver and add the option you need. Alternatively, you can run clang -Xclang <option> ...
to force the driver [to] pass <option>
to clang -cc1
.
I did the latter (-Xclang
) for emitting precompiled headers:
/usr/bin/clang++ -x c++-header foo.hpp -Xclang -emit-pch -o foo.hpp.pch <other options>
^^^^^^^
Without the -Xclang
, clang++
ignored the -emit-pch
. When I tried -cc1
, I had the same problem as the OP — clang++
accepted -emit-pch
but didn't have the other options the driver normally provides.