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

Victor Chernyakin via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 1 13:14:29 PDT 2025


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

You can try something like `hasDeclContext(functionDecl())`

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


More information about the cfe-commits mailing list