File tree Expand file tree Collapse file tree 4 files changed +18
-7
lines changed Expand file tree Collapse file tree 4 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -316,6 +316,14 @@ bool SILDeclRef::hasUserWrittenCode() const {
316
316
// Never has user-written code, is just a forwarding initializer.
317
317
return false ;
318
318
default :
319
+ if (auto decl = getDecl ()) {
320
+ // Declarations synthesized by ClangImporter by definition don't have
321
+ // user written code, but despite that they aren't always marked
322
+ // implicit.
323
+ auto moduleContext = decl->getDeclContext ()->getModuleScopeContext ();
324
+ if (isa<ClangModuleUnit>(moduleContext))
325
+ return false ;
326
+ }
319
327
// TODO: This checking is currently conservative, we ought to
320
328
// exhaustively handle all the cases here, and use emitOrDelayFunction
321
329
// in more cases to take advantage of it.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change 1
- // RUN: %target-swift-frontend -emit-ir -profile-generate -profile-coverage-mapping -Xcc -fprofile-instr-generate -Xcc -fcoverage-mapping -I %S/Inputs/issue-57483 %s | %FileCheck %s
1
+ // RUN: %target-swift-frontend -emit-ir -profile-generate -profile-coverage-mapping -Xcc -fprofile-instr-generate -Xcc -fcoverage-mapping -I %S/Inputs/CModule %s | %FileCheck %s
2
2
3
3
// https://github.com/apple/swift/issues/57483 (rdar://82820628)
4
- // Make sure we don't crash in IRGen attempting to emit the coverage map for the
5
- // implicit Clang getter for the member bitfield.
6
-
7
- // CHECK: define {{.*}} @"$So7cstructV$member$getter"
4
+ // Make sure we don't crash in IRGen attempting to emit the coverage map for any
5
+ // implicit Clang decls.
8
6
9
7
import CModule
10
8
11
- func foo ( _ x: UnsafePointer < cstruct > ? ) {
9
+ func testStruct ( _ x: UnsafePointer < cstruct > ? ) {
12
10
_ = x? . pointee. member
11
+ _ = cstruct ( )
12
+ _ = cstruct ( member: 5 )
13
13
}
14
- foo ( nil )
14
+ testStruct ( nil )
15
+
16
+ // CHECK: define {{.*}} @"$So7cstructV$member$setter"
17
+ // CHECK: define {{.*}} @"$So7cstructV$member$getter"
You can’t perform that action at this time.
0 commit comments