LLVMCoverage: Unify getCoverageForFile and getCoverageForFunction. NFC (#120842)
Since #119952, `getCoverageForFile` and `getCoverageForFunction` have
similar structure each other. Ther merged method `addFunctionRegions`
has two lambda subfunctions.
* `getCoverageForFile`
- `MainFileID` may be `nullopt`.
- `shouldProcess` picks up relevant records along `FileIDs` that is
scanned based on `MainFileID`. They may have expanded source files.
- `shouldExpand` takes the presense of `MainFileID` into account.
* `getCoverageForFunction`
- This assumes the presense of `MainFileID`.
- `shouldProcess` picks up records that belong only to `MainFileID`.
- `shouldExpand` assumes the presense of `MainFileID`.
This change introduces a wrapper class `MergeableCoverageData` for
further merging instances. At the moment, this returns `CoverageData`
including `buildSegments()`.
This change itself is NFC.