Skip to content

Commit 87e9bc7

Browse files
authored
Merge pull request #29478 from vedantk/prof
2 parents 9274e86 + dfdb2e5 commit 87e9bc7

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/SILGen/SILGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ static bool haveProfiledAssociatedFunction(SILDeclRef constant) {
551551
/// Set up the function for profiling instrumentation.
552552
static void setUpForProfiling(SILDeclRef constant, SILFunction *F,
553553
ForDefinition_t forDefinition) {
554-
if (!forDefinition)
554+
if (!forDefinition || F->getProfiler())
555555
return;
556556

557557
ASTNode profiledNode;

test/Profiler/coverage_struct.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_struct %s | %FileCheck %s
2+
3+
struct Foo {
4+
var a = false
5+
6+
// CHECK: sil_coverage_map {{.*}}// variable initialization expression of coverage_struct.Foo.b : Swift.Bool
7+
// CHECK-NEXT: [[@LINE+1]]:11 -> [[@LINE+3]]:6 : 0
8+
let b = {
9+
false
10+
}()
11+
}

0 commit comments

Comments
 (0)