@@ -563,36 +563,29 @@ namespace {
563
563
const clang::RecordDecl *ClangDecl;
564
564
565
565
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);
568
567
if (!cxxRecordDecl)
569
568
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;
579
576
}
580
577
return nullptr ;
581
578
}
582
579
583
580
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);
586
582
if (!cxxRecordDecl)
587
583
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;
596
589
}
597
590
return nullptr ;
598
591
}
0 commit comments