[clang][driver] Fix compilation database dump with multiple architectures
authorJan Svoboda <jan_svoboda@apple.com>
Thu, 9 Jun 2022 14:58:09 +0000 (16:58 +0200)
committerJan Svoboda <jan_svoboda@apple.com>
Mon, 13 Jun 2022 11:30:57 +0000 (13:30 +0200)
commita85670001ba2487988839656299771915ebc7633
treecf4fbfba34325cb490f37b3ba7ae20e909baa067
parentc12577c61dbf37b1b6ae25ed422a900ac71f18fe
[clang][driver] Fix compilation database dump with multiple architectures

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

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D121997
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/compilation_database.c
clang/test/Driver/compilation_database_multiarch.c [new file with mode: 0644]