[PATCH] D144748: [clang-tidy] Add bugprone-empty-catch check

Shivam Gupta via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 23 06:43:16 PDT 2023


xgupta added a comment.

Other than these three points everything looks good to me.



================
Comment at: clang-tools-extra/clang-tidy/bugprone/EmptyCatchCheck.cpp:71
+
+bool EmptyCatchCheck::isLanguageVersionSupported(
+    const LangOptions &LangOpts) const {
----------------
This can be defined in the header file itself like other checks.


================
Comment at: clang-tools-extra/clang-tidy/bugprone/EmptyCatchCheck.cpp:76
+
+std::optional<TraversalKind> EmptyCatchCheck::getCheckTraversalKind() const {
+  return TK_IgnoreUnlessSpelledInSource;
----------------
This can be defined in the header file itself like other checks.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone/empty-catch.cpp:3
+// RUN: -config="{CheckOptions: [{key: bugprone-empty-catch.AllowEmptyCatchForExceptions, value: '::SafeException;WarnException'}, \
+// RUN:        {key: bugprone-empty-catch.IgnoreCatchWithKeywords, value: '@IGNORE;@TODO'}]}"
+
----------------
If TODO is in default then it does not require to be in value here, right?
I tested without that, it gives the warning. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144748/new/

https://reviews.llvm.org/D144748



More information about the cfe-commits mailing list