Otherwise we don't warn on a struct containing a single public int, but
we warn on a struct containing a single public std::string, which is
inconsistent.
Details
Diff Detail
Event Timeline
clang-tidy/misc/NonPrivateMemberVariablesInClassesCheck.cpp | ||
---|---|---|
22 | maybe return llvm::any_of(Node.methods(), [](const CXXMethodDecl /* dunno which type this would be */& M) { return !M->isImplicit(); });? |
Some nits.
clang-tidy/misc/NonPrivateMemberVariablesInClassesCheck.cpp | ||
---|---|---|
21 | let's keep this one as-is. | |
31–34 | And change this to something like AST_MATCHER(CXXRecordDecl, hasNonStaticNonImplicitMethod) { return hasMethod(unless(anyOf(isStaticStorageClass(), isImplicit()))) .matches(Node, Finder, Builder); } | |
74–76 | Comment needs updating? | |
docs/clang-tidy/checks/misc-non-private-member-variables-in-classes.rst | ||
9 | I don't like the wording. We are not looking for explicit methods, |
LG other than two nits, thank you!
clang-tidy/misc/NonPrivateMemberVariablesInClassesCheck.cpp | ||
---|---|---|
31 | Please do rename it though, from hasNonStaticMethod to hasNonStaticNonImplicitMethod or something. | |
test/clang-tidy/misc-non-private-member-variables-in-classes.cpp | ||
38 | Can you please duplicate this test and add one static method (into S1Implicit, i think?). |
docs/clang-tidy/checks/misc-non-private-member-variables-in-classes.rst | ||
---|---|---|
13 | Just a small remark: What do you mean exactly by "user-provided" ? The term "user-provided" is defined in 11.4.2 [dcl.fct.def.default]/5 as
|
docs/clang-tidy/checks/misc-non-private-member-variables-in-classes.rst | ||
---|---|---|
13 | Yeah, i'm not sure what is the right word to use here, |
docs/clang-tidy/checks/misc-non-private-member-variables-in-classes.rst | ||
---|---|---|
13 | A suggestion without looking at the rest of the patch: It depends on whether you want to include explicitly defaulted/deleted |
docs/clang-tidy/checks/misc-non-private-member-variables-in-classes.rst | ||
---|---|---|
13 |
Yes, i do not think those should be exempt, i.e. i think the current code is correct (more tests needed?) |
Sorry, forgot to use the magic line at the end of the commit message to auto-close this review. Done in r351686, anyhow.
let's keep this one as-is.