Skip to content

[cxx-interop] Discard duplicating IteratorTy::iterator_category decls #70466

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
Dec 14, 2023

Conversation

egorzhdan
Copy link
Contributor

libc++ recently split the std module into many top-level modules: llvm/llvm-project@571178a

This broke the logic that conforms C++ iterator types to UnsafeCxxInputIterator/UnsafeCxxRandomAccessIterator. To determine if a C++ type is an iterator type, we look for its inner type called iterator_category. After module std was split, Clang instantiates std::string::const_iterator::iterator_category twice and doing a Clang lookup within the const_iterator type returns two identical TypedefDecls. Clang itself has logic to merge them, but Swift doesn't.

rdar://119270491

libc++ recently split the `std` module into many top-level modules: llvm/llvm-project@571178a

This broke the logic that conforms C++ iterator types to `UnsafeCxxInputIterator`/`UnsafeCxxRandomAccessIterator`. To determine if a C++ type is an iterator type, we look for its inner type called `iterator_category`. After module std was split, Clang instantiates `std::string::const_iterator::iterator_category` twice and doing a Clang lookup within the `const_iterator` type returns two identical `TypedefDecl`s. Clang itself has logic to merge them, but Swift doesn't.

rdar://119270491
@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Dec 14, 2023
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

@egorzhdan egorzhdan merged commit b4a3fbe into main Dec 14, 2023
@egorzhdan egorzhdan deleted the egorzhdan/split-libcxx-iterator-category branch December 14, 2023 21:24
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