File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -550,7 +550,7 @@ class Converter : public clang::RecursiveASTVisitor<Converter> {
550550 auto *ctor = expr->getConstructor ();
551551 if (!ctor->isCopyOrMoveConstructor () &&
552552 ctor->isConvertingConstructor (/* AllowExplicit=*/ false ) &&
553- ctor->getNumParams () == 1 ) {
553+ ctor->getNumParams () == 1 && IsIteratorType (expr-> getType ()) ) {
554554 c.suppress_iterator_clone_ = true ;
555555 }
556556 }
@@ -562,6 +562,19 @@ class Converter : public clang::RecursiveASTVisitor<Converter> {
562562 static bool take (Converter &c) {
563563 return std::exchange (c.suppress_iterator_clone_ , false );
564564 }
565+
566+ private:
567+ static bool IsIteratorType (clang::QualType qt) {
568+ if (auto *record = qt->getAsCXXRecordDecl ()) {
569+ for (auto *d : record->decls ()) {
570+ if (auto *tnd = llvm::dyn_cast<clang::TypedefNameDecl>(d)) {
571+ if (tnd->getName () == " iterator_category" )
572+ return true ;
573+ }
574+ }
575+ }
576+ return false ;
577+ }
565578 };
566579
567580 struct PushConstInitializer {
You can’t perform that action at this time.
0 commit comments