Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions clang-tools-extra/clang-tidy/bugprone/EmptyCatchCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ void EmptyCatchCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
cxxCatchStmt(unless(isExpansionInSystemHeader()), unless(isInMacro()),
unless(hasCaughtType(IgnoredExceptionType)),
unless(hasAncestor(cxxDestructorDecl())),
hasHandler(compoundStmt(
statementCountIs(0),
unless(hasAnyTextFromList(IgnoreCatchWithKeywords)))))
Expand Down
4 changes: 4 additions & 0 deletions clang-tools-extra/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ Changes in existing checks
correcting a spelling mistake on its option
``NamePrefixSuffixSilenceDissimilarityTreshold``.

- Improved :doc:`bugprone-empty-catch
<clang-tidy/checks/bugprone/empty-catch>` check by allowing empty
``catch`` blocks in destructors.

- Improved :doc:`bugprone-exception-escape
<clang-tidy/checks/bugprone/exception-escape>` check's handling of lambdas:
exceptions from captures are now diagnosed, exceptions in the bodies of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,12 @@ void functionWithComment2() {
// @IGNORE: relax its safe
}
}

struct StructWithEmptyCatchInDestructor {
~StructWithEmptyCatchInDestructor() {
try {
}
catch (...) {
}
}
};