24 return llvm::any_of(Node.bases(), [&](
const CXXBaseSpecifier &BaseSpec) {
38 isDefaulted(), isOutOfLine(),
39 unless(anyOf(isVirtual(),
40 ofClass(cxxRecordDecl(
41 anyOf(hasBase(unless(isTriviallyDestructible())),
43 hasType(isTriviallyDestructible()))))))))))
49 const auto *MatchedDecl = Result.Nodes.getNodeAs<CXXDestructorDecl>(
"decl");
52 const SourceManager &SM = *Result.SourceManager;
53 const auto *FirstDecl = cast<CXXMethodDecl>(MatchedDecl->getFirstDecl());
55 FirstDecl->getEndLoc(), SM, getLangOpts());
56 const CharSourceRange SecondDeclRange = CharSourceRange::getTokenRange(
57 MatchedDecl->getBeginLoc(),
60 if (FirstDeclEnd.isInvalid() || SecondDeclRange.isInvalid())
64 diag(FirstDecl->getLocation(),
65 "class %0 can be made trivially destructible by defaulting the "
66 "destructor on its first declaration")
67 << FirstDecl->getParent()
68 << FixItHint::CreateInsertion(FirstDeclEnd,
" = default")
69 << FixItHint::CreateRemoval(SecondDeclRange);
70 diag(MatchedDecl->getLocation(),
"destructor definition is here",