File tree Expand file tree Collapse file tree 2 files changed +11
-12
lines changed Expand file tree Collapse file tree 2 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -207,33 +207,29 @@ void UseDefaultMemberInitCheck::registerMatchers(MatchFinder *Finder) {
207
207
declRefExpr (to (enumConstantDecl ())));
208
208
209
209
auto Init =
210
- anyOf (initListExpr (anyOf (
211
- allOf (initCountIs (1 ), hasInit (0 , ignoringImplicit (InitBase))),
212
- initCountIs (0 ))),
210
+ anyOf (initListExpr (anyOf (allOf (initCountIs (1 ), hasInit (0 , InitBase)),
211
+ initCountIs (0 ))),
213
212
InitBase);
214
213
215
214
Finder->addMatcher (
216
215
cxxConstructorDecl (
217
- isDefaultConstructor (), unless ( isInstantiated ()),
216
+ isDefaultConstructor (),
218
217
forEachConstructorInitializer (
219
218
cxxCtorInitializer (
220
219
forField (unless (anyOf (getLangOpts ().CPlusPlus20
221
220
? unless (anything ())
222
221
: isBitField (),
223
222
hasInClassInitializer (anything ()),
224
223
hasParent (recordDecl (isUnion ()))))),
225
- isWritten (), withInitializer (ignoringImplicit ( Init) ))
224
+ withInitializer (Init))
226
225
.bind (" default" ))),
227
226
this );
228
227
229
228
Finder->addMatcher (
230
- cxxConstructorDecl (
231
- unless (ast_matchers::isTemplateInstantiation ()),
232
- forEachConstructorInitializer (
233
- cxxCtorInitializer (forField (hasInClassInitializer (anything ())),
234
- isWritten (),
235
- withInitializer (ignoringImplicit (Init)))
236
- .bind (" existing" ))),
229
+ cxxConstructorDecl (forEachConstructorInitializer (
230
+ cxxCtorInitializer (forField (hasInClassInitializer (anything ())),
231
+ withInitializer (Init))
232
+ .bind (" existing" ))),
237
233
this );
238
234
}
239
235
Original file line number Diff line number Diff line change @@ -30,6 +30,9 @@ class UseDefaultMemberInitCheck : public ClangTidyCheck {
30
30
void storeOptions (ClangTidyOptions::OptionMap &Opts) override ;
31
31
void registerMatchers (ast_matchers::MatchFinder *Finder) override ;
32
32
void check (const ast_matchers::MatchFinder::MatchResult &Result) override ;
33
+ llvm::Optional<TraversalKind> getCheckTraversalKind () const override {
34
+ return TK_IgnoreUnlessSpelledInSource;
35
+ }
33
36
34
37
private:
35
38
void checkDefaultInit (const ast_matchers::MatchFinder::MatchResult &Result,
You can’t perform that action at this time.
0 commit comments