1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[Coverage][Unittest] Fix stringref issue

We will pass StringRef and change it in reader.
But we reuse the same Filename vector without clear it,
so in some systems, we may clobbeer previous results.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D97353
This commit is contained in:
Jinsong Ji 2021-02-24 14:27:23 +00:00
parent 1203ef24fe
commit 5c4630a66a

View File

@ -201,6 +201,9 @@ struct CoverageMappingTest : ::testing::TestWithParam<std::pair<bool, bool>> {
void readCoverageRegions(const std::string &Coverage,
OutputFunctionCoverageData &Data) {
// We will re-use the StringRef in duplicate tests, clear it to avoid
// clobber previous ones.
Filenames.clear();
Filenames.resize(Files.size() + 1);
for (const auto &E : Files)
Filenames[E.getValue()] = E.getKey().str();