Skip to content

Commit 9a65745

Browse files
committed
AST: Robustness fix
1 parent 4c0d148 commit 9a65745

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/AST/Decl.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2404,6 +2404,10 @@ ObjCClassKind ClassDecl::checkObjCAncestry() const {
24042404
if (!CD->hasSuperclass())
24052405
break;
24062406
CD = CD->getSuperclass()->getClassOrBoundGenericClass();
2407+
// If we don't have a valid class here, we should have diagnosed
2408+
// elsewhere.
2409+
if (!CD)
2410+
break;
24072411
}
24082412

24092413
if (!isObjC)

validation-test/compiler_crashers/28367-swift-declcontext-isgenericcontext.swift renamed to validation-test/compiler_crashers_fixed/28367-swift-declcontext-isgenericcontext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
// See https://swift.org/LICENSE.txt for license information
66
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

8-
// RUN: not --crash %target-swift-frontend %s -typecheck
8+
// RUN: not %target-swift-frontend %s -typecheck
99
let a{{}protocol A{class A:d class d<U:A>:A

0 commit comments

Comments
 (0)