This diff adds addTargetAndModeForProgramName, a utility function that will add appropriate -target foo and --driver-mode=g++ tokens to a command line for driver invocations of the form a/b/foo-g++. It is intended to support tooling: for example, should a compilation database record some invocation of foo-g++ without these implicit flags, a Clang tool may use this function to add them back.
Note that a compilation database won't necessarily store these invocations without their corresponding implicit flags. Some may use addTargetAndModeForProgramName when the database is first written out so that later readers don't need to repeat the operation.
Add that for tools, CommandLine[0] will need to be a tool path relatively to which the builtin headers can be found.