File tree Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ void EmptyCatchCheck::registerMatchers(MatchFinder *Finder) {
90
90
Finder->addMatcher (
91
91
cxxCatchStmt (unless (isExpansionInSystemHeader ()), unless (isInMacro ()),
92
92
unless (hasCaughtType (IgnoredExceptionType)),
93
+ unless (hasAncestor (cxxDestructorDecl ())),
93
94
hasHandler (compoundStmt (
94
95
statementCountIs (0 ),
95
96
unless (hasAnyTextFromList (IgnoreCatchWithKeywords)))))
Original file line number Diff line number Diff line change @@ -244,6 +244,10 @@ Changes in existing checks
244
244
correcting a spelling mistake on its option
245
245
``NamePrefixSuffixSilenceDissimilarityTreshold ``.
246
246
247
+ - Improved :doc: `bugprone-empty-catch
248
+ <clang-tidy/checks/bugprone/empty-catch>` check by allowing empty
249
+ ``catch `` blocks in destructors.
250
+
247
251
- Improved :doc: `bugprone-exception-escape
248
252
<clang-tidy/checks/bugprone/exception-escape>` check's handling of lambdas:
249
253
exceptions from captures are now diagnosed, exceptions in the bodies of
Original file line number Diff line number Diff line change @@ -65,3 +65,12 @@ void functionWithComment2() {
65
65
// @IGNORE: relax its safe
66
66
}
67
67
}
68
+
69
+ struct StructWithEmptyCatchInDestructor {
70
+ ~StructWithEmptyCatchInDestructor () {
71
+ try {
72
+ }
73
+ catch (...) {
74
+ }
75
+ }
76
+ };
You can’t perform that action at this time.
0 commit comments