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

via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 4 04:27:27 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE LINT COMMENT: clang-tidy-->


:warning: C/C++ code linter clang-tidy found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

```bash

git diff -U0 origin/main...HEAD -- clang-tools-extra/clang-tidy/bugprone/EmptyCatchCheck.cpp |
python3 clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py \
  -path build -p1 -quiet
```

</details>

<details>
<summary>
View the output from clang-tidy here.
</summary>

```
clang/include/clang/ASTMatchers/ASTMatchersInternal.h:1363:13: error: calling a private constructor of class 'clang::ast_matchers::internal::Matcher<clang::CXXCatchStmt>' [clang-diagnostic-error]
 1363 |     return {Matcher<T>(std::get<Is>(Params))...};
      |             ^
clang/include/clang/ASTMatchers/ASTMatchersInternal.h:1348:16: note: in instantiation of function template specialization 'clang::ast_matchers::internal::VariadicOperatorMatcher<clang::ast_matchers::internal::Matcher<clang::Decl>>::getMatchers<clang::CXXCatchStmt, 0UL>' requested here
 1348 |                getMatchers<T>(std::index_sequence_for<Ps...>()))
      |                ^
clang/include/clang/ASTMatchers/ASTMatchersInternal.h:128:52: note: in instantiation of function template specialization 'clang::ast_matchers::internal::VariadicOperatorMatcher<clang::ast_matchers::internal::Matcher<clang::Decl>>::operator Matcher<clang::CXXCatchStmt>' requested here
  128 |     return Execute(Arg1, static_cast<const ArgT &>(Args)...);
      |                                                    ^
clang-tools-extra/clang-tidy/bugprone/EmptyCatchCheck.cpp:91:19: note: in instantiation of function template specialization 'clang::ast_matchers::internal::VariadicFunction<clang::ast_matchers::internal::BindableMatcher<clang::Stmt>, clang::ast_matchers::internal::Matcher<clang::CXXCatchStmt>, &clang::ast_matchers::internal::makeDynCastAllOfComposite>::operator()<clang::ast_matchers::internal::VariadicOperatorMatcher<clang::ast_matchers::internal::Matcher<clang::CXXCatchStmt>>, clang::ast_matchers::internal::VariadicOperatorMatcher<clang::ast_matchers::internal::Matcher<clang::CXXCatchStmt>>, clang::ast_matchers::internal::VariadicOperatorMatcher<clang::ast_matchers::internal::Matcher<clang::Decl>>, clang::ast_matchers::internal::Matcher<clang::CXXCatchStmt>>' requested here
   91 |       cxxCatchStmt(unless(isExpansionInSystemHeader()), unless(isInMacro()),
      |                   ^
clang/include/clang/ASTMatchers/ASTMatchersInternal.h:666:12: note: declared private here
  666 |   explicit Matcher(const DynTypedMatcher &Implementation)
      |            ^
```

</details>


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


More information about the cfe-commits mailing list