Skip to content

Commit b4a3fbe

Browse files
authored
Merge pull request #70466 from apple/egorzhdan/split-libcxx-iterator-category
[cxx-interop] Discard duplicating `IteratorTy::iterator_category` decls
2 parents 74a592a + 3ca0d56 commit b4a3fbe

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/ClangImporter/ClangDerivedConformances.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,11 @@ getIteratorCategoryDecl(const clang::CXXRecordDecl *clangDecl) {
126126
clang::IdentifierInfo *iteratorCategoryDeclName =
127127
&clangDecl->getASTContext().Idents.get("iterator_category");
128128
auto iteratorCategories = clangDecl->lookup(iteratorCategoryDeclName);
129-
if (!iteratorCategories.isSingleResult())
129+
// If this is a templated typedef, Clang might have instantiated several
130+
// equivalent typedef decls. If they aren't equivalent, Clang has already
131+
// complained about this. Let's assume that they are equivalent. (see
132+
// filterNonConflictingPreviousTypedefDecls in clang/Sema/SemaDecl.cpp)
133+
if (iteratorCategories.empty())
130134
return nullptr;
131135
auto iteratorCategory = iteratorCategories.front();
132136

0 commit comments

Comments
 (0)