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;
1515namespace clang ::tidy::bugprone {
1616
1717void ThrowKeywordMissingCheck::registerMatchers (MatchFinder *Finder) {
18- auto CtorInitializerList =
19- cxxConstructorDecl (hasAnyConstructorInitializer (anything ()));
20-
2118 Finder->addMatcher (
2219 cxxConstructExpr (
2320 hasType (cxxRecordDecl (
@@ -27,7 +24,7 @@ void ThrowKeywordMissingCheck::registerMatchers(MatchFinder *Finder) {
2724 stmt (anyOf (cxxThrowExpr (), callExpr (), returnStmt ()))),
2825 hasAncestor (decl (anyOf (varDecl (), fieldDecl ()))),
2926 hasAncestor (expr (cxxNewExpr (hasAnyPlacementArg (anything ())))),
30- allOf (hasAncestor (CtorInitializerList ),
27+ allOf (hasAncestor (cxxConstructorDecl () ),
3128 unless (hasAncestor (cxxCatchStmt ()))))))
3229 .bind (" temporary-exception-not-thrown" ),
3330 this );
Original file line number Diff line number Diff line change @@ -177,6 +177,10 @@ Changes in existing checks
177177 usages of ``sizeof() ``, ``alignof() ``, and ``offsetof() `` when adding or
178178 subtracting from a pointer directly or when used to scale a numeric value.
179179
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+
180184- Improved :doc: `bugprone-unchecked-optional-access
181185 <clang-tidy/checks/bugprone/unchecked-optional-access>` to support
182186 `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
139139 RegularException ();
140140}
141141
142+ namespace GH115055 {
143+ class CtorInitializerListTest2 {
144+ public:
145+ CtorInitializerListTest2 () {}
146+ private:
147+ RegularException exc{};
148+ };
149+ } // namespace GH115055
150+
142151RegularException funcReturningExceptionTest (int i) {
143152 return RegularException ();
144153}
You can’t perform that action at this time.
0 commit comments