In a private chat with @ben.boeckel , we get in consensus it would be great for cmake if the invocation of clang-scan-deps can get rid of compilation database. Due to the compilation database can't do very well for the files which are not existed yet. @ben.boeckel may have more context to add here.
This patch should be innocent for others usages.
Documents and ReleaseNotes would be added later if this get accepted.
I don't think this is correct in cases where the command line already contains an input, or is malformed. As an example, if the last element is an option that expects a value (e.g. "-ferror-limit"), appending FilePath will trigger diagnostics in the driver that the argument to -ferror-limit is not numeric and that an input needs to be specified. While the correct/expected behavior would be to emit single diagnostic complaining about missing value for the last option.
Clang's tooling is littered with ad-hoc command-line parsing/manipulation and it's rarely handling all the edge-cases. I'd prefer this complexity lived somewhere outside of Clang, in the tool that actually constructed the command line in the first place.