File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -15,9 +15,6 @@ using namespace clang::ast_matchers;
15
15
namespace clang ::tidy::bugprone {
16
16
17
17
void ThrowKeywordMissingCheck::registerMatchers (MatchFinder *Finder) {
18
- auto CtorInitializerList =
19
- cxxConstructorDecl (hasAnyConstructorInitializer (anything ()));
20
-
21
18
Finder->addMatcher (
22
19
cxxConstructExpr (
23
20
hasType (cxxRecordDecl (
@@ -27,7 +24,7 @@ void ThrowKeywordMissingCheck::registerMatchers(MatchFinder *Finder) {
27
24
stmt (anyOf (cxxThrowExpr (), callExpr (), returnStmt ()))),
28
25
hasAncestor (decl (anyOf (varDecl (), fieldDecl ()))),
29
26
hasAncestor (expr (cxxNewExpr (hasAnyPlacementArg (anything ())))),
30
- allOf (hasAncestor (CtorInitializerList ),
27
+ allOf (hasAncestor (cxxConstructorDecl () ),
31
28
unless (hasAncestor (cxxCatchStmt ()))))))
32
29
.bind (" temporary-exception-not-thrown" ),
33
30
this );
Original file line number Diff line number Diff line change @@ -177,6 +177,10 @@ Changes in existing checks
177
177
usages of ``sizeof() ``, ``alignof() ``, and ``offsetof() `` when adding or
178
178
subtracting from a pointer directly or when used to scale a numeric value.
179
179
180
+ - Improved :doc: `bugprone-throw-keyword-missing
181
+ <clang-tidy/checks/bugprone/throw-keyword-missing>` by fixing a false positive
182
+ when using non-static member initializers and a constructor.
183
+
180
184
- Improved :doc: `bugprone-unchecked-optional-access
181
185
<clang-tidy/checks/bugprone/unchecked-optional-access>` to support
182
186
`bsl::optional ` and `bdlb::NullableValue ` from
Original file line number Diff line number Diff line change @@ -139,6 +139,15 @@ CtorInitializerListTest::CtorInitializerListTest(float) try : exc(RegularExcepti
139
139
RegularException ();
140
140
}
141
141
142
+ namespace GH115055 {
143
+ class CtorInitializerListTest2 {
144
+ public:
145
+ CtorInitializerListTest2 () {}
146
+ private:
147
+ RegularException exc{};
148
+ };
149
+ } // namespace GH115055
150
+
142
151
RegularException funcReturningExceptionTest (int i) {
143
152
return RegularException ();
144
153
}
You can’t perform that action at this time.
0 commit comments