This patch adds a new option called -gen-cdb-fragment-path to the driver, which can be used to specify a directory path to which clang can emit a fragment of a CDB for each compilation it needs to invoke.
The CDB fragment is emitted into a unique file in the specified directory. It contains the -cc1 clang invocation in its command. The file itself is actually a valid standalone CDB (if you disregard the not yet well supported -cc1 innovation by the CDB, which I'll fix). To load the full CDB that can be emitted during a build, I'm going to add a new CDB reader from a directory that reads all fragments and aggregates them into one CDB in a follow-up patch.
This is useful to setup verification infrastructure for clang-scan-deps for some projects that don't have a way of constructing a CDB from their build.
IIUC this feature might end up being used from some test script. I'm wondering - what would happen had the argument been an empty string?