[clang-tools-extra] [clang-tidy]: Ignore empty `catch` blocks in destructors in `bugprone-empty-catch` check (PR #161379)

Julian Schmidt via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 4 06:28:45 PDT 2025


================
@@ -90,6 +90,7 @@ void EmptyCatchCheck::registerMatchers(MatchFinder *Finder) {
   Finder->addMatcher(
       cxxCatchStmt(unless(isExpansionInSystemHeader()), unless(isInMacro()),
                    unless(hasCaughtType(IgnoredExceptionType)),
+                   unless(hasAncestor(cxxDestructorDecl())),
----------------
5chmidti wrote:

You're right, the matcher I was thinking about was when you needed to get to a specific declcontext or had some additional constraints

https://github.com/llvm/llvm-project/pull/161379


More information about the cfe-commits mailing list