forked from OSchip/llvm-project
Fix false positive in `bugprone-throw-keyword-missing` check
Fixes PR#52400. The tests for bugprone-throw-keyword-missing actually already contain exceptions as class members, but not as members with initializers, which was probably just an oversight.
This commit is contained in:
parent
098c01c132
commit
738e7f1231
|
@ -26,7 +26,7 @@ void ThrowKeywordMissingCheck::registerMatchers(MatchFinder *Finder) {
|
|||
isSameOrDerivedFrom(matchesName("[Ee]xception|EXCEPTION")))),
|
||||
unless(anyOf(hasAncestor(stmt(
|
||||
anyOf(cxxThrowExpr(), callExpr(), returnStmt()))),
|
||||
hasAncestor(varDecl()),
|
||||
hasAncestor(decl(anyOf(varDecl(), fieldDecl()))),
|
||||
allOf(hasAncestor(CtorInitializerList),
|
||||
unless(hasAncestor(cxxCatchStmt()))))))
|
||||
.bind("temporary-exception-not-thrown"),
|
||||
|
|
|
@ -118,6 +118,7 @@ void localVariableInitTest() {
|
|||
|
||||
class CtorInitializerListTest {
|
||||
RegularException exc;
|
||||
RegularException exc2{};
|
||||
|
||||
CtorInitializerListTest() : exc(RegularException()) {}
|
||||
|
||||
|
|
Loading…
Reference in New Issue