Command lines with multiple -arch arguments expand into multiple entries in the compilation database. However, the file writes are not appending, meaning subsequent writes end up overwriting the previous ones, resulting in garbled output.
This patch fixes that by always appending to the file.
rdar://90165004
Usually driver tests don't depend on the -cc1 working. The -cc1 depends on the backends. You'd need to check that the relevant targets have been built and linked in. It'd be better to keep this isolated to the driver?
Is there a way to get the driver to dump the compilation database only (without actually running the actions)?
E.g., will -### still emit the compilation database? Looks like not:
But maybe there's some other way to avoid running the actions. Or, we can add something like -MJ-only <cdb>, which acts like -MJ <cdb> and then exits before running the actions.