From d1b098fc825176242afee12b8f9dc14adf5eec51 Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Mon, 21 Mar 2022 18:30:35 -0700 Subject: [CoverageMapping] Remove dots from paths inside the profile We already remove dots from collected paths and path mappings. This makes it difficult to match paths inside the profile which contain dots. For example, we would never match /path/to/../file.c because the collected path is always be normalized to /path/file.c. This change enables dot removal for paths inside the profile to address the issue. Differential Revision: https://reviews.llvm.org/D122750 --- llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp') diff --git a/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp b/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp index 0bb1c57..1a18779 100644 --- a/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp +++ b/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp @@ -175,7 +175,8 @@ Error RawCoverageFilenamesReader::readUncompressed(CovMapVersion Version, else P.assign(CWD); llvm::sys::path::append(P, Filename); - Filenames.push_back(static_cast(P)); + sys::path::remove_dots(P, /*remove_dot_dot=*/true); + Filenames.push_back(static_cast(P.str())); } } } -- cgit v1.1