Skip to content

Commit 8978dc8

Browse files
authored
Merge pull request #36550 from eeckstein/fix-di-verification
SILVerifier: fix a wrong debug-scope verifier crash
2 parents 2eb57d2 + 7d4f7bd commit 8978dc8

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

lib/SIL/Verifier/SILVerifier.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5465,13 +5465,6 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
54655465
return;
54665466

54675467
const SILDebugScope *LastSeenScope = nullptr;
5468-
for (SILInstruction &SI : *BB) {
5469-
if (SI.isMetaInstruction())
5470-
continue;
5471-
LastSeenScope = SI.getDebugScope();
5472-
AlreadySeenScopes.insert(LastSeenScope);
5473-
break;
5474-
}
54755468
for (SILInstruction &SI : *BB) {
54765469
if (SI.isMetaInstruction())
54775470
continue;

test/DebugInfo/guard-let-scope.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,13 @@ func f(c: AnyObject?) {
1111
}
1212
print(x)
1313
}
14+
15+
// Check that we don't crash with a verifier error on this.
16+
protocol P {}
17+
18+
public func testit(_ x: AnyObject) -> Bool {
19+
guard let _ = x as? P else {
20+
return false
21+
}
22+
fatalError()
23+
}

0 commit comments

Comments
 (0)