File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -689,7 +689,8 @@ Type TypeBase::wrapInPointer(PointerTypeKind kind) {
689
689
switch (kind) {
690
690
case PTK_UnsafeMutableRawPointer:
691
691
case PTK_UnsafeRawPointer:
692
- llvm_unreachable (" these pointer types don't take arguments" );
692
+ // these pointer types don't take arguments.
693
+ return (NominalTypeDecl*)nullptr ;
693
694
case PTK_UnsafePointer:
694
695
return ctx.getUnsafePointerDecl ();
695
696
case PTK_UnsafeMutablePointer:
@@ -701,6 +702,10 @@ Type TypeBase::wrapInPointer(PointerTypeKind kind) {
701
702
}());
702
703
703
704
assert (pointerDecl);
705
+ // Don't fail hard on null pointerDecl.
706
+ if (!pointerDecl) {
707
+ return Type ();
708
+ }
704
709
return BoundGenericType::get (pointerDecl, /* parent*/ nullptr , Type (this ));
705
710
}
706
711
Original file line number Diff line number Diff line change @@ -487,9 +487,11 @@ namespace {
487
487
pointerKind = PTK_UnsafeMutablePointer;
488
488
}
489
489
}
490
-
491
- return {pointeeType->wrapInPointer (pointerKind),
492
- ImportHint::OtherPointer};
490
+ if (auto wrapped = pointeeType->wrapInPointer (pointerKind)) {
491
+ return {wrapped, ImportHint::OtherPointer};
492
+ } else {
493
+ return Type ();
494
+ }
493
495
}
494
496
495
497
ImportResult VisitBlockPointerType (const clang::BlockPointerType *type) {
@@ -1926,6 +1928,8 @@ ParameterList *ClangImporter::Implementation::importFunctionParameterList(
1926
1928
auto genericType =
1927
1929
findGenericTypeInGenericDecls (templateParamType, genericParams);
1928
1930
swiftParamTy = genericType->wrapInPointer (pointerKind);
1931
+ if (!swiftParamTy)
1932
+ return nullptr ;
1929
1933
} else if (auto *templateParamType =
1930
1934
dyn_cast<clang::TemplateTypeParmType>(paramTy)) {
1931
1935
swiftParamTy =
You can’t perform that action at this time.
0 commit comments