Skip to content

Commit e61f514

Browse files
authored
Merge pull request #74995 from atrick/fix-vardecl
Fix SILBridging for GlobalAddr_getDecl
2 parents 8733ecd + 32ca35c commit e61f514

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Diff for: include/swift/SIL/SILBridgingImpl.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1362,11 +1362,11 @@ BridgedNullableVarDecl BridgedInstruction::AllocBox_getDecl() const {
13621362
}
13631363

13641364
BridgedNullableVarDecl BridgedInstruction::GlobalAddr_getDecl() const {
1365-
return {getAs<swift::DebugValueInst>()->getDecl()};
1365+
return {getAs<swift::GlobalAddrInst>()->getReferencedGlobal()->getDecl()};
13661366
}
13671367

13681368
BridgedNullableVarDecl BridgedInstruction::RefElementAddr_getDecl() const {
1369-
return {getAs<swift::DebugValueInst>()->getDecl()};
1369+
return {getAs<swift::RefElementAddrInst>()->getField()};
13701370
}
13711371

13721372
OptionalBridgedSILDebugVariable

Diff for: test/SILOptimizer/lifetime_dependence/lifetime_dependence_borrow_fail.swift

+6
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,9 @@ func bv_incorrect_annotation2(_ w1: borrowing Wrapper, _ w2: borrowing Wrapper)
6464
return w1.bv // expected-note @-1{{it depends on the lifetime of argument 'w1'}}
6565
} // expected-note @-1{{this use causes the lifetime-dependent value to escape}}
6666

67+
let ptr = UnsafeRawPointer(bitPattern: 1)!
68+
let nc = NC(ptr, 0) // expected-error {{lifetime-dependent variable 'nc' escapes its scope}}
69+
70+
func bv_global(dummy: BV) -> BV {
71+
nc.getBV()
72+
} // expected-note {{this use causes the lifetime-dependent value to escape}}

0 commit comments

Comments
 (0)