[llvm] 834a38b - Revert "[CoverageMapping] Remove dots from paths inside the profile"

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 27 23:21:47 PDT 2022


Author: Petr Hosek
Date: 2022-06-27T23:20:54-07:00
New Revision: 834a38bbcbcf5f507fe5d47174629bf5635fdb2d

URL: https://github.com/llvm/llvm-project/commit/834a38bbcbcf5f507fe5d47174629bf5635fdb2d
DIFF: https://github.com/llvm/llvm-project/commit/834a38bbcbcf5f507fe5d47174629bf5635fdb2d.diff

LOG: Revert "[CoverageMapping] Remove dots from paths inside the profile"

This reverts commit d1b098fc825176242afee12b8f9dc14adf5eec51 since
it is failing on Windows builders.

Added: 
    

Modified: 
    llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
    llvm/test/tools/llvm-cov/coverage-prefix-map.test
    llvm/unittests/ProfileData/CoverageMappingTest.cpp

Removed: 
    llvm/test/tools/llvm-cov/Inputs/relative_dir/header.h
    llvm/test/tools/llvm-cov/Inputs/relative_dir/main.c
    llvm/test/tools/llvm-cov/Inputs/relative_dir/main.covmapping
    llvm/test/tools/llvm-cov/Inputs/relative_dir/main.proftext
    llvm/test/tools/llvm-cov/relative-dir.test


################################################################################
diff  --git a/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp b/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
index 1a187795a8a0d..0bb1c575df4b1 100644
--- a/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
+++ b/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
@@ -175,8 +175,7 @@ Error RawCoverageFilenamesReader::readUncompressed(CovMapVersion Version,
         else
           P.assign(CWD);
         llvm::sys::path::append(P, Filename);
-        sys::path::remove_dots(P, /*remove_dot_dot=*/true);
-        Filenames.push_back(static_cast<std::string>(P.str()));
+        Filenames.push_back(static_cast<std::string>(P));
       }
     }
   }

diff  --git a/llvm/test/tools/llvm-cov/Inputs/relative_dir/header.h b/llvm/test/tools/llvm-cov/Inputs/relative_dir/header.h
deleted file mode 100644
index a39fce095f2f3..0000000000000
--- a/llvm/test/tools/llvm-cov/Inputs/relative_dir/header.h
+++ /dev/null
@@ -1 +0,0 @@
-int f() { return 0; }

diff  --git a/llvm/test/tools/llvm-cov/Inputs/relative_dir/main.c b/llvm/test/tools/llvm-cov/Inputs/relative_dir/main.c
deleted file mode 100644
index 26e97a5cd2902..0000000000000
--- a/llvm/test/tools/llvm-cov/Inputs/relative_dir/main.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "header.h"
-
-int main() {
-  return f();
-}

diff  --git a/llvm/test/tools/llvm-cov/Inputs/relative_dir/main.covmapping b/llvm/test/tools/llvm-cov/Inputs/relative_dir/main.covmapping
deleted file mode 100644
index 665aa963ebd36..0000000000000
Binary files a/llvm/test/tools/llvm-cov/Inputs/relative_dir/main.covmapping and /dev/null 
diff er

diff  --git a/llvm/test/tools/llvm-cov/Inputs/relative_dir/main.proftext b/llvm/test/tools/llvm-cov/Inputs/relative_dir/main.proftext
deleted file mode 100644
index ab94aa2f17298..0000000000000
--- a/llvm/test/tools/llvm-cov/Inputs/relative_dir/main.proftext
+++ /dev/null
@@ -1,16 +0,0 @@
-f
-# Func Hash:
-24
-# Num Counters:
-1
-# Counter Values:
-1
-
-main
-# Func Hash:
-24
-# Num Counters:
-1
-# Counter Values:
-1
-

diff  --git a/llvm/test/tools/llvm-cov/coverage-prefix-map.test b/llvm/test/tools/llvm-cov/coverage-prefix-map.test
index 5e8fae4fb4a3a..eaebae3f0db77 100644
--- a/llvm/test/tools/llvm-cov/coverage-prefix-map.test
+++ b/llvm/test/tools/llvm-cov/coverage-prefix-map.test
@@ -13,7 +13,7 @@
 # REPORT: {{^}}bar.h{{.*}}
 # REPORT: {{^}}TOTAL{{.*}}100.00%
 
-# LCOV: SF:bar.h
+# LCOV: SF:.{{/|\\+}}bar.h
 # LCOV-NOT: SF
 
 Instructions for regenerating the test:

diff  --git a/llvm/test/tools/llvm-cov/relative-dir.test b/llvm/test/tools/llvm-cov/relative-dir.test
deleted file mode 100644
index 1fc902bc00e1e..0000000000000
--- a/llvm/test/tools/llvm-cov/relative-dir.test
+++ /dev/null
@@ -1,10 +0,0 @@
-# RUN: llvm-profdata merge %S/Inputs/relative_dir/main.proftext \
-# RUN:   -o %t.profdata
-# RUN: llvm-cov report %S/Inputs/relative_dir/main.covmapping \
-# RUN:   -instr-profile %t.profdata \
-# RUN:   -compilation-dir=%S/Inputs/relative_dir/out/default \
-# RUN:   %S/Inputs/relative_dir/header.h \
-# RUN:   | FileCheck -DDIR=%S/Inputs/relative_dir --check-prefix=REPORT %s
-
-# REPORT: {{^}}[[DIR]]{{/|\\}}header.h{{.*}}
-# REPORT: {{^}}TOTAL{{.*}}100.00%

diff  --git a/llvm/unittests/ProfileData/CoverageMappingTest.cpp b/llvm/unittests/ProfileData/CoverageMappingTest.cpp
index 758398daeeebc..cc4c953e65351 100644
--- a/llvm/unittests/ProfileData/CoverageMappingTest.cpp
+++ b/llvm/unittests/ProfileData/CoverageMappingTest.cpp
@@ -943,7 +943,7 @@ TEST(CoverageMappingTest, filename_roundtrip) {
     for (unsigned I = 1; I < Paths.size(); ++I) {
       SmallString<256> P(Paths[0]);
       llvm::sys::path::append(P, Paths[I]);
-      ASSERT_EQ(ReadFilenames[I], P);
+      ASSERT_TRUE(ReadFilenames[I] == P);
     }
   }
 }
@@ -969,7 +969,7 @@ TEST(CoverageMappingTest, filename_compilation_dir) {
     for (unsigned I = 1; I < Paths.size(); ++I) {
       SmallString<256> P(CompilationDir);
       llvm::sys::path::append(P, Paths[I]);
-      ASSERT_EQ(ReadFilenames[I], P);
+      ASSERT_TRUE(ReadFilenames[I] == P);
     }
   }
 }


        


More information about the llvm-commits mailing list