[PATCH] D97353: [Coverage][Unittest] Fix stringref issue

Jinsong Ji via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 24 07:00:08 PST 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGff6dc053b7ba: [Coverage][Unittest] Fix stringref issue (authored by jsji).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97353/new/

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,9 @@
 
   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();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97353.326079.patch
Type: text/x-patch
Size: 634 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210224/4ae70ce9/attachment.bin>


More information about the llvm-commits mailing list