Skip to content

Commit 3c12ea7

Browse files
committed
Fix SILBridging for GlobalAddr_getDecl
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
1 parent 5d18fa7 commit 3c12ea7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

0 commit comments

Comments
 (0)