Skip to content

SafeInteropWrapper crashes with 'cgImage.width' #80948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 30, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lib/ClangImporter/ImportDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4712,7 +4712,7 @@ namespace {
auto loc = Impl.importSourceLoc(decl->getLocation());
auto dc = Impl.importDeclContextOf(
decl, importedName.getEffectiveContext());

SmallVector<GenericTypeParamDecl *, 4> genericParams;
for (auto &param : *decl->getTemplateParameters()) {
auto genericParamDecl =
Expand Down Expand Up @@ -5495,7 +5495,7 @@ namespace {
objcClass->getDeclaredType());
Impl.SwiftContext.evaluator.cacheOutput(ExtendedNominalRequest{result},
std::move(objcClass));

Identifier categoryName;
if (!decl->getName().empty())
categoryName = Impl.SwiftContext.getIdentifier(decl->getName());
Expand Down Expand Up @@ -9122,6 +9122,9 @@ void ClangImporter::Implementation::swiftify(FuncDecl *MappedDecl) {
if (!ClangDecl)
return;

if (ClangDecl->getNumParams() != MappedDecl->getParameters()->size())
return;

llvm::SmallString<128> MacroString;
// We only attach the macro if it will produce an overload. Any __counted_by
// will produce an overload, since UnsafeBufferPointer is still an improvement
Expand Down Expand Up @@ -9537,7 +9540,7 @@ ClangImporter::Implementation::importDeclImpl(const clang::NamedDecl *ClangDecl,
Result = importDecl(UnderlyingDecl, version);
SkippedOverTypedef = true;
}

if (!Result) {
SwiftDeclConverter converter(*this, version);
Result = converter.Visit(ClangDecl);
Expand Down