Skip to content

Commit 3275b18

Browse files
committed
[Coverage] Normalize compilation dir as well
This matches debug info behavior. Differential Revision: https://reviews.llvm.org/D97001
1 parent 6c75a84 commit 3275b18

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

clang/lib/CodeGen/CoverageMappingGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1726,7 +1726,7 @@ void CoverageMappingModuleGen::emit() {
17261726
llvm::SmallVector<std::string, 16> FilenameStrs;
17271727
FilenameStrs.resize(FileEntries.size() + 1);
17281728
// The first filename is the current working directory.
1729-
FilenameStrs[0] = getCurrentDirname();
1729+
FilenameStrs[0] = normalizeFilename(getCurrentDirname());
17301730
for (const auto &Entry : FileEntries) {
17311731
auto I = Entry.second;
17321732
FilenameStrs[I] = normalizeFilename(Entry.first->getName());

clang/test/Profile/profile-prefix-map.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@
1616
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -mllvm -enable-name-compression=false -main-file-name profile-prefix-map.c %t/root/nested/profile-prefix-map.c -fprofile-prefix-map=%/t/root=. -o - | FileCheck --check-prefix=PROFILE-PREFIX-MAP %s
1717
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -mllvm -enable-name-compression=false -main-file-name profile-prefix-map.c ../root/nested/profile-prefix-map.c -fprofile-prefix-map=../root=. -o - | FileCheck --check-prefix=PROFILE-PREFIX-MAP %s
1818
// PROFILE-PREFIX-MAP: @__llvm_coverage_mapping = {{.*"\\02.*}}.{{/|\\+}}nested{{.*profile-prefix-map\.c}}
19+
20+
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -mllvm -enable-name-compression=false -main-file-name profile-prefix-map.c %t/root/nested/profile-prefix-map.c -fprofile-compilation-dir=/custom -fprofile-prefix-map=/custom=/nonsense -o - | FileCheck --check-prefix=PROFILE-COMPILATION-DIR %s
21+
// PROFILE-COMPILATION-DIR: @__llvm_coverage_mapping = {{.*"\\02.*}}nonsense

0 commit comments

Comments
 (0)