Clang discovers the path to it's own executable and uses this
to re-invoke itself when -fno-integrated-cc1 is set, or if there are
multiple jobs, i.e. multiple source files specified. When clang is
invoked as part of the llvm driver, it's executable is going to be the
driver executable 'llvm', not the symlink 'clang', so the invocation
will look like 'llvm -cc1 ...'. The llvm driver will try to find an tool
called '-cc1' and will fail.
This patch changes clang to realize if the executable it found was
the llvm-driver, in which case it will prepend "clang" to the args.
Unconditionally doin'g "clang" is safe because it will only ever
re-invoke itself in cc1 mode, and never need to specify, clang++,
etc.
I'd prefer if this variable was a constant because there's no reason why should ever be changed at runtime.
Rather than defining it here, could we instead define it in llvm/tools/llvm-driver/llvm-driver.cpp and llvm/cmake/driver-template.cpp.in as constant that's initialized to true and false respectively.