[PATCH] D97353: [Coverage][Unittest] Fix stringref issue
Jinsong Ji via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 23 21:10:31 PST 2021
jsji created this revision.
jsji added reviewers: phosek, vsk.
jsji requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D97353
Files:
llvm/unittests/ProfileData/CoverageMappingTest.cpp
Index: llvm/unittests/ProfileData/CoverageMappingTest.cpp
===================================================================
--- llvm/unittests/ProfileData/CoverageMappingTest.cpp
+++ llvm/unittests/ProfileData/CoverageMappingTest.cpp
@@ -201,6 +201,8 @@
void readCoverageRegions(const std::string &Coverage,
OutputFunctionCoverageData &Data) {
+ Filenames.clear(); // We will re-use the StringRef in duplicate tests, clear
+ // it to avoid clobber previous ones.
Filenames.resize(Files.size() + 1);
for (const auto &E : Files)
Filenames[E.getValue()] = E.getKey().str();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97353.325975.patch
Type: text/x-patch
Size: 648 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210224/f8c11c83/attachment.bin>
More information about the llvm-commits
mailing list