diff options
author | Jinsong Ji <jji@us.ibm.com> | 2021-02-24 14:27:23 +0000 |
---|---|---|
committer | Jinsong Ji <jji@us.ibm.com> | 2021-02-24 14:59:40 +0000 |
commit | ff6dc053b7ba8ffb7d02c9c4560fe80b66b117b8 (patch) | |
tree | 81fe2dbfef714fde9b5a88917f1aaaf0994fc5a1 /llvm/unittests/ProfileData/CoverageMappingTest.cpp | |
parent | 9ced8b3b614ceba7dcd4a8fc3d2fc0be7d09f650 (diff) | |
download | llvm-ff6dc053b7ba8ffb7d02c9c4560fe80b66b117b8.zip llvm-ff6dc053b7ba8ffb7d02c9c4560fe80b66b117b8.tar.gz llvm-ff6dc053b7ba8ffb7d02c9c4560fe80b66b117b8.tar.bz2 |
[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
Diffstat (limited to 'llvm/unittests/ProfileData/CoverageMappingTest.cpp')
-rw-r--r-- | llvm/unittests/ProfileData/CoverageMappingTest.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/unittests/ProfileData/CoverageMappingTest.cpp b/llvm/unittests/ProfileData/CoverageMappingTest.cpp index 44b7a13..d1bb87a 100644 --- a/llvm/unittests/ProfileData/CoverageMappingTest.cpp +++ b/llvm/unittests/ProfileData/CoverageMappingTest.cpp @@ -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(); |