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 {
316316 // Never has user-written code, is just a forwarding initializer.
317317 return false ;
318318 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+ }
319327 // TODO: This checking is currently conservative, we ought to
320328 // exhaustively handle all the cases here, and use emitOrDelayFunction
321329 // 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
22
33// 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.
86
97import CModule
108
11- func foo ( _ x: UnsafePointer < cstruct > ? ) {
9+ func testStruct ( _ x: UnsafePointer < cstruct > ? ) {
1210 _ = x? . pointee. member
11+ _ = cstruct ( )
12+ _ = cstruct ( member: 5 )
1313}
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