File tree Expand file tree Collapse file tree 2 files changed +17
-19
lines changed Expand file tree Collapse file tree 2 files changed +17
-19
lines changed Original file line number Diff line number Diff line change @@ -26,26 +26,21 @@ void RedundantMemberInitCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
26
26
}
27
27
28
28
void RedundantMemberInitCheck::registerMatchers (MatchFinder *Finder) {
29
- auto Construct =
30
- cxxConstructExpr (
31
- hasDeclaration (cxxConstructorDecl (hasParent (
32
- cxxRecordDecl (unless (isTriviallyDefaultConstructible ()))))))
33
- .bind (" construct" );
34
-
35
29
Finder->addMatcher (
36
- traverse (
37
- TK_AsIs,
38
- cxxConstructorDecl (
39
- unless (isDelegatingConstructor ()),
40
- ofClass (unless (
41
- anyOf (isUnion (), ast_matchers::isTemplateInstantiation ()))),
42
- forEachConstructorInitializer (
43
- cxxCtorInitializer (
44
- isWritten (), withInitializer (ignoringImplicit (Construct)),
45
- unless (forField (hasType (isConstQualified ()))),
46
- unless (forField (hasParent (recordDecl (isUnion ())))))
47
- .bind (" init" )))
48
- .bind (" constructor" )),
30
+ cxxConstructorDecl (
31
+ unless (isDelegatingConstructor ()), ofClass (unless (isUnion ())),
32
+ forEachConstructorInitializer (
33
+ cxxCtorInitializer (
34
+ withInitializer (
35
+ cxxConstructExpr (
36
+ hasDeclaration (
37
+ cxxConstructorDecl (ofClass (cxxRecordDecl (
38
+ unless (isTriviallyDefaultConstructible ()))))))
39
+ .bind (" construct" )),
40
+ unless (forField (hasType (isConstQualified ()))),
41
+ unless (forField (hasParent (recordDecl (isUnion ())))))
42
+ .bind (" init" )))
43
+ .bind (" constructor" ),
49
44
this );
50
45
}
51
46
Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ class RedundantMemberInitCheck : public ClangTidyCheck {
32
32
void storeOptions (ClangTidyOptions::OptionMap &Opts) override ;
33
33
void registerMatchers (ast_matchers::MatchFinder *Finder) override ;
34
34
void check (const ast_matchers::MatchFinder::MatchResult &Result) override ;
35
+ llvm::Optional<TraversalKind> getCheckTraversalKind () const override {
36
+ return TK_IgnoreUnlessSpelledInSource;
37
+ }
35
38
36
39
private:
37
40
bool IgnoreBaseInCopyConstructors;
You can’t perform that action at this time.
0 commit comments