[PATCH] D97196: [clang-tidy] Add new check 'bugprone-unhandled-exception-at-new'.

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 23 08:37:46 PST 2021


njames93 added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/bugprone/UnhandledExceptionAtNewCheck.cpp:23-24
+    const CXXCatchStmt *CatchS = Node.getHandler(I);
+    if (InnerMatcher.matches(CatchS->getCaughtType(), Finder, Builder))
+      return true;
+    // Generic catch handler should match anything.
----------------
This can leak bound nodes If it doesn't match.


================
Comment at: clang-tools-extra/clang-tidy/bugprone/UnhandledExceptionAtNewCheck.h:28
+  bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
+    return LangOpts.CPlusPlus;
+  }
----------------
I'd suggest this check is only ran when exceptions are enabled.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97196



More information about the cfe-commits mailing list