[clang][Dependency Scanning] Fix the In-Memory Buffer Used for By-Name Scanning (#183396)
This PR fixes two issues of the in-memory buffer we use for the input
file when a dependency scanner performs by-name queries.
First, it renames the buffer. The temporary file was named
`ScanningByName-%%%%%%%%.input`, which leads to weird diagnostics such
as
```
ScanningByName-2d42a1e9.input:1:1: fatal error: could not build module 'X'
```
This PR changes the name of the file buffer, so we get diagnostics such
as
```
module-include.input:1:1: fatal error: could not build module 'X'
```
which is more indicative.
Additionally, this PR fixes a bug where the source location may overflow
the temporary buffer by creating a 64k empty string which the temporary
buffer occupies. When the source location overflows, the diagnostics
could point to some random file that comes after the fake file and is
incorrect.
Currently, the maximum number of unique names from Apple's SDKs is
around 3000. A 64k buffer per dependency scanning worker gives us around
20x capacity per worker (which scans fewer names than 3000 when the
scanning is done in parallel). A fatal error is added to catch
overflows.