Skip to content

Commit

Permalink
Fix SILBridging for GlobalAddr_getDecl
Browse files Browse the repository at this point in the history
and RefElementAddr_getDecl.

Fixes:
Assertion failed: (isa<To>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file Casting.h

While running pass swiftlang#224 SILFunctionTransform "LifetimeDependenceDiagnostics"
 swiftlang#7 0x0000000102d3efcc decltype(auto) llvm::cast<swift::DebugValueInst, swift::SILInstruction>(swift::SILInstruction*)
 swiftlang#8 0x0000000102d01e24 swift::DebugValueInst* BridgedInstruction::getAs<swift::DebugValueInst>() const
 swiftlang#9 0x0000000102d01ee4 BridgedInstruction::GlobalAddr_getDecl() const
  • Loading branch information
atrick committed Jul 5, 2024
1 parent 5d18fa7 commit 3c12ea7
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit 3c12ea7

Please sign in to comment.