Skip to content

Commit 933ae41

Browse files
authored
Merge pull request #59601 from apple/egorzhdan/revert-accidental
[ClangImporter] Revert accidentally committed logic
2 parents 8b20c88 + 832733e commit 933ae41

File tree

1 file changed

+1
-47
lines changed

1 file changed

+1
-47
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2464,53 +2464,7 @@ namespace {
24642464
if (!isCxxRecordImportable(decl))
24652465
return nullptr;
24662466

2467-
auto result = VisitRecordDecl(decl);
2468-
if (!result)
2469-
return nullptr;
2470-
2471-
// If this struct is a C++ input iterator, we try to synthesize a
2472-
// conformance to the UnsafeCxxInputIterator protocol (which is defined in
2473-
// the std overlay). We consider a struct to be an input iterator if it
2474-
// has this member: `using iterator_category = std::input_iterator_tag`.
2475-
for (clang::Decl *member : decl->decls()) {
2476-
if (auto typeDecl = dyn_cast<clang::TypeDecl>(member)) {
2477-
if (!typeDecl->getIdentifier())
2478-
continue;
2479-
2480-
if (typeDecl->getName() == "iterator_category") {
2481-
// If this is a typedef or a using-decl, retrieve the underlying
2482-
// struct decl.
2483-
clang::CXXRecordDecl *underlyingDecl = nullptr;
2484-
if (auto typedefDecl = dyn_cast<clang::TypedefNameDecl>(typeDecl)) {
2485-
auto type = typedefDecl->getUnderlyingType();
2486-
underlyingDecl = type->getAsCXXRecordDecl();
2487-
} else {
2488-
underlyingDecl = dyn_cast<clang::CXXRecordDecl>(typeDecl);
2489-
}
2490-
if (underlyingDecl) {
2491-
auto isInputIteratorDecl = [&](const clang::CXXRecordDecl *base) {
2492-
return base->isInStdNamespace() && base->getIdentifier() &&
2493-
base->getName() == "input_iterator_tag";
2494-
};
2495-
2496-
// Traverse all transitive bases of `underlyingDecl` to check if
2497-
// it inherits from `std::input_iterator_tag`.
2498-
bool isInputIterator = isInputIteratorDecl(underlyingDecl);
2499-
underlyingDecl->forallBases(
2500-
[&](const clang::CXXRecordDecl *base) {
2501-
if (isInputIteratorDecl(base)) {
2502-
isInputIterator = true;
2503-
return false;
2504-
}
2505-
return true;
2506-
});
2507-
llvm::errs();
2508-
}
2509-
}
2510-
}
2511-
}
2512-
2513-
return result;
2467+
return VisitRecordDecl(decl);
25142468
}
25152469

25162470
bool isSpecializationDepthGreaterThan(

0 commit comments

Comments
 (0)