malcolm.parsons added inline comments.
================ Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:165 - Finder->addMatcher( - cxxConstructorDecl( - isDefaultConstructor(), unless(isInstantiated()), - forEachConstructorInitializer( - cxxCtorInitializer( - forField(unless(anyOf(isBitField(), - hasInClassInitializer(anything()), - hasParent(recordDecl(isUnion()))))), - isWritten(), withInitializer(ignoringImplicit(Init))) - .bind("default"))), - this); + if (getLangOpts().CPlusPlus2a) + Finder->addMatcher( ---------------- aaron.ballman wrote: > I wonder if we could add a `nothing()` matcher (sibling to the `anything()` > matcher) so that this could be rewritten as: > > `unless(anyOf(getLangOpts().CPlusPlus2a ? nothing() : isBitField()))` > > The duplication here adds complexity if we decide to change the matchers in > the future. `unless(anything())` is equivalent to `nothing()`. ================ Comment at: test/clang-tidy/modernize-use-default-member-init-bitfield.cpp:1 +// RUN: %check_clang_tidy %s modernize-use-default-member-init %t -- -- -std=c++2a + ---------------- aaron.ballman wrote: > I'd like to see a test where C++2a is not enabled to ensure that the fix is > not suggested in that case. See [[ https://reviews.llvm.org/source/clang-tools-extra/browse/clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-member-init.cpp;323204$222 | modernize-use-default-member-init.cpp:222 ]] Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D42413 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits