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) {
689689 switch (kind) {
690690 case PTK_UnsafeMutableRawPointer:
691691 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 ;
693694 case PTK_UnsafePointer:
694695 return ctx.getUnsafePointerDecl ();
695696 case PTK_UnsafeMutablePointer:
@@ -701,6 +702,10 @@ Type TypeBase::wrapInPointer(PointerTypeKind kind) {
701702 }());
702703
703704 assert (pointerDecl);
705+ // Don't fail hard on null pointerDecl.
706+ if (!pointerDecl) {
707+ return Type ();
708+ }
704709 return BoundGenericType::get (pointerDecl, /* parent*/ nullptr , Type (this ));
705710}
706711
Original file line number Diff line number Diff line change @@ -487,9 +487,11 @@ namespace {
487487 pointerKind = PTK_UnsafeMutablePointer;
488488 }
489489 }
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+ }
493495 }
494496
495497 ImportResult VisitBlockPointerType (const clang::BlockPointerType *type) {
@@ -1926,6 +1928,8 @@ ParameterList *ClangImporter::Implementation::importFunctionParameterList(
19261928 auto genericType =
19271929 findGenericTypeInGenericDecls (templateParamType, genericParams);
19281930 swiftParamTy = genericType->wrapInPointer (pointerKind);
1931+ if (!swiftParamTy)
1932+ return nullptr ;
19291933 } else if (auto *templateParamType =
19301934 dyn_cast<clang::TemplateTypeParmType>(paramTy)) {
19311935 swiftParamTy =
You can’t perform that action at this time.
0 commit comments