This patch fixes dependency scanning of a TU with prebuilt modular/PCH dependencies.
Such modules/PCH might have been built using non-minimized files, while dependency scanner does use the minimized versions of source files. Implicit build doesn't like the discrepancy in file sizes and errors out.
The issues is worked around by padding the minimized files with whitespace in such scenarios. This approach throws away one advantage of source minimization (the memory savings), but still keeps the benefits of faster preprocessing/lexing.
The padding solution comes with a 14% runtime regression compared to not padding the inputs. (I tested this by forcing padding and running clang-scan-deps -j 20 on LLVM's compile_commands.json with modules disabled.) Interestingly, padding only with newlines (compared to spaces), the regression is 39%.
Depends on D104462.