Skip to content

[cxx-interop] Skip already-imported sub decls. #35964

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 1 commit into from
Feb 15, 2021

Conversation

zoecarver
Copy link
Contributor

Rather than skipping non-definitions, we should just check whether we've already seen this decl. This not only fixes the specific problem with class templates but also is a more general fix for other sub decls that might have this issue in the future (i.e., methods).

Rather than skipping non-definitions, we should just check whether we've
already seen this decl. This not only fixes the specific problem with
class templates but also is a more general fix for other sub decls.
@zoecarver zoecarver added the c++ interop Feature: Interoperability with C++ label Feb 13, 2021
@zoecarver
Copy link
Contributor Author

@swift-ci please smoke test.

@zoecarver
Copy link
Contributor Author

@swift-ci please test Windows platform.

@zoecarver zoecarver merged commit 6eb00d5 into swiftlang:main Feb 15, 2021
@@ -3371,6 +3371,11 @@ namespace {
}
}

// If we've already imported this decl, skip it so we don't add the same
// member twice.
if (Impl.ImportedDecls.count({nd->getCanonicalDecl(), getVersion()}))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I think it would be more idiomatic to use find() != end() instead of count, until someone adds a contains_key method to upstream DenseMap.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix, thanks!

zoecarver added a commit to zoecarver/swift that referenced this pull request Feb 16, 2021
Addresses the post commit review comment in swiftlang#35964 and replaces "count()"
with "find() != end()".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ interop Feature: Interoperability with C++
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants