Skip to content

Fix SILBridging for GlobalAddr_getDecl #74995

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/swift/SIL/SILBridgingImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1362,11 +1362,11 @@ BridgedNullableVarDecl BridgedInstruction::AllocBox_getDecl() const {
}

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

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

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

let ptr = UnsafeRawPointer(bitPattern: 1)!
let nc = NC(ptr, 0) // expected-error {{lifetime-dependent variable 'nc' escapes its scope}}

func bv_global(dummy: BV) -> BV {
nc.getBV()
} // expected-note {{this use causes the lifetime-dependent value to escape}}