@@ -563,36 +563,29 @@ namespace {
563563 const clang::RecordDecl *ClangDecl;
564564
565565 const clang::CXXConstructorDecl *findCopyConstructor () const {
566- const clang::CXXRecordDecl *cxxRecordDecl =
567- dyn_cast<clang::CXXRecordDecl>(ClangDecl);
566+ const auto *cxxRecordDecl = dyn_cast<clang::CXXRecordDecl>(ClangDecl);
568567 if (!cxxRecordDecl)
569568 return nullptr ;
570- for (auto method : cxxRecordDecl->methods ()) {
571- if (auto ctor = dyn_cast<clang::CXXConstructorDecl>(method)) {
572- if (ctor->isCopyConstructor () &&
573- ctor->getAccess () == clang::AS_public &&
574- // rdar://106964356
575- // ctor->doesThisDeclarationHaveABody() &&
576- !ctor->isDeleted ())
577- return ctor;
578- }
569+ for (auto ctor : cxxRecordDecl->ctors ()) {
570+ if (ctor->isCopyConstructor () &&
571+ ctor->getAccess () == clang::AS_public &&
572+ // rdar://106964356
573+ // ctor->doesThisDeclarationHaveABody() &&
574+ !ctor->isDeleted ())
575+ return ctor;
579576 }
580577 return nullptr ;
581578 }
582579
583580 const clang::CXXConstructorDecl *findMoveConstructor () const {
584- const clang::CXXRecordDecl *cxxRecordDecl =
585- dyn_cast<clang::CXXRecordDecl>(ClangDecl);
581+ const auto *cxxRecordDecl = dyn_cast<clang::CXXRecordDecl>(ClangDecl);
586582 if (!cxxRecordDecl)
587583 return nullptr ;
588- for (auto method : cxxRecordDecl->methods ()) {
589- if (auto ctor = dyn_cast<clang::CXXConstructorDecl>(method)) {
590- if (ctor->isMoveConstructor () &&
591- ctor->getAccess () == clang::AS_public &&
592- ctor->doesThisDeclarationHaveABody () &&
593- !ctor->isDeleted ())
594- return ctor;
595- }
584+ for (auto ctor : cxxRecordDecl->ctors ()) {
585+ if (ctor->isMoveConstructor () &&
586+ ctor->getAccess () == clang::AS_public &&
587+ ctor->doesThisDeclarationHaveABody () && !ctor->isDeleted ())
588+ return ctor;
596589 }
597590 return nullptr ;
598591 }
0 commit comments