Skip to content

Commit 73d8419

Browse files
authored
Merge pull request #32352 from keith/ks/reland-emit-coverage-mappings-for-all-modules
reland: Emit coverage mappings for all modules
2 parents 4849947 + 76ca05f commit 73d8419

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

lib/IRGen/GenDecl.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,8 +1105,11 @@ void IRGenerator::emitGlobalTopLevel(llvm::StringSet<> *linkerDirectives) {
11051105
IGM->emitSILDifferentiabilityWitness(&dw);
11061106
}
11071107

1108-
// Emit code coverage mapping data.
1109-
PrimaryIGM->emitCoverageMapping();
1108+
// Emit code coverage mapping data for all modules
1109+
for (auto Iter : *this) {
1110+
IRGenModule *IGM = Iter.second;
1111+
IGM->emitCoverageMapping();
1112+
}
11101113

11111114
for (auto Iter : *this) {
11121115
IRGenModule *IGM = Iter.second;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
func func1() {}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
func func2() {}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -num-threads 0 -emit-ir %S/Inputs/coverage_num_threads1.swift | %FileCheck %s -check-prefix=SINGLE-SOURCE --implicit-check-not="llvm_coverage_mapping ="
2+
3+
// SINGLE-SOURCE: llvm_coverage_mapping =
4+
5+
// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -num-threads 0 -emit-ir %S/Inputs/coverage_num_threads1.swift %S/Inputs/coverage_num_threads2.swift | %FileCheck %s -check-prefix=SINGLE-OBJECT --implicit-check-not="llvm_coverage_mapping ="
6+
7+
// SINGLE-OBJECT: llvm_coverage_mapping =
8+
9+
// Using 1 goes down the multithreaded codepath but only operates with a single thread to work around an issue on Windows where the output of both IR modules is interleaved and therefore the output is invalid
10+
// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -num-threads 1 -emit-ir %S/Inputs/coverage_num_threads1.swift %S/Inputs/coverage_num_threads2.swift | %FileCheck %s -check-prefix=MULTIPLE-OBJECTS --implicit-check-not="llvm_coverage_mapping ="
11+
12+
// MULTIPLE-OBJECTS: llvm_coverage_mapping =
13+
// MULTIPLE-OBJECTS: llvm_coverage_mapping =

0 commit comments

Comments
 (0)