File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -678,7 +678,7 @@ bool Converter::RecordDerivesCopy(const clang::RecordDecl *decl) const {
678678
679679bool Converter::RecordHasCopyableFields (const clang::RecordDecl *decl) {
680680 if (auto *cxx = clang::dyn_cast<clang::CXXRecordDecl>(decl);
681- cxx && RecordNeedsDestruction ( cxx)) {
681+ cxx && ! cxx-> hasTrivialDestructor ( )) {
682682 return false ;
683683 }
684684 for (auto f : decl->fields ()) {
Original file line number Diff line number Diff line change @@ -589,39 +589,15 @@ const char *GetOverloadedOperator(const clang::FunctionDecl *decl) {
589589
590590clang::CXXDestructorDecl *
591591GetTranslatableDestructor (const clang::CXXRecordDecl *decl) {
592- if (!decl->hasDefinition () || !IsUserDefinedDecl (decl) ||
593- !decl->hasUserDeclaredDestructor ()) {
592+ if (!IsUserDefinedDecl (decl)) {
594593 return nullptr ;
595594 }
596595 auto *dtor = decl->getDestructor ();
597- if (!dtor || dtor->isImplicit () || !dtor->getDefinition () ||
598- dtor->getDefinition ()->isDefaulted ()) {
596+ if (!dtor || dtor->isImplicit ()) {
599597 return nullptr ;
600598 }
601- return dtor;
602- }
603-
604- bool TypeNeedsDestruction (clang::QualType type) {
605- if (type->isArrayType ()) {
606- type = clang::QualType (type->getBaseElementTypeUnsafe (), 0 );
607- }
608- auto *record = type->getAsCXXRecordDecl ();
609- return record && RecordNeedsDestruction (record);
610- }
611-
612- bool RecordNeedsDestruction (const clang::CXXRecordDecl *decl) {
613- if (!decl->hasDefinition () || !IsUserDefinedDecl (decl)) {
614- return false ;
615- }
616- if (GetTranslatableDestructor (decl)) {
617- return true ;
618- }
619- for (const auto *field : decl->fields ()) {
620- if (TypeNeedsDestruction (field->getType ())) {
621- return true ;
622- }
623- }
624- return false ;
599+ auto *definition = dtor->getDefinition ();
600+ return definition && !definition->isDefaulted () ? dtor : nullptr ;
625601}
626602
627603bool IsOverloadedComparisonOperator (const clang::CXXMethodDecl *decl) {
Original file line number Diff line number Diff line change @@ -122,10 +122,6 @@ bool IsOverloadedComparisonOperator(const clang::CXXMethodDecl *decl);
122122clang::CXXDestructorDecl *
123123GetTranslatableDestructor (const clang::CXXRecordDecl *decl);
124124
125- bool TypeNeedsDestruction (clang::QualType type);
126-
127- bool RecordNeedsDestruction (const clang::CXXRecordDecl *decl);
128-
129125clang::Expr *ToAddrOf (clang::ASTContext &ctx, clang::Expr *expr);
130126
131127std::vector<clang::CXXRecordDecl *>
You can’t perform that action at this time.
0 commit comments