[PATCH] D144748: [clang-tidy] Add bugprone-empty-catch check
    Piotr Zegar via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Sun Apr 16 06:13:36 PDT 2023
    
    
  
PiotrZSL marked an inline comment as done.
PiotrZSL added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/bugprone/EmptyCatchCheck.cpp:100
+void EmptyCatchCheck::check(const MatchFinder::MatchResult &Result) {
+  const auto *MatchedCatchStmt = Result.Nodes.getNodeAs<CXXCatchStmt>("catch");
+
----------------
carlosgalvezp wrote:
> Assert that it's not null, or exit early.
I cannot be null.
================
Comment at: clang-tools-extra/clang-tidy/bugprone/EmptyCatchCheck.cpp:104
+      MatchedCatchStmt->getCatchLoc(),
+      "empty catch statements hide issues, to handle exceptions appropriately, "
+      "consider re-throwing, handling, or avoiding catch altogether");
----------------
carlosgalvezp wrote:
> Nit: I believe a semicolon or dot is more appropriate here
I can use semicolon 
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