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