[PATCH] [clang-tidy] Add a checker that warns on const string & members.
Alexander Kornienko
alexfh at google.com
Wed Jul 16 02:59:20 PDT 2014
================
Comment at: clang-tidy/google/GoogleTidyModule.cpp:35
@@ -33,1 +34,3 @@
CheckFactories.addCheckFactory(
+ "google-runtime-member-string-references",
+ new ClangTidyCheckFactory<runtime::MemberStringReferencesCheck>());
----------------
Benjamin Kramer wrote:
> Daniel Jasper wrote:
> > Where does "runtime" come from? Does that make sense?
> We inherited the categories from cpplint.py and I've been following the existing style. I think it makes sense to have a direct mapping from cpplint categories to tidy checks.
Right. Having references to cpplint.py in some form is valueable, as we could then use the same check identifiers to support targeted NOLINT suppressions already present in the code.
The categories ("runtime", "readability", "build", "compatibility" etc.) used in cpplint.py make some sense: they usually reflect which aspects of the code quality the check addresses.
In this case "runtime" means that patterns detected by this check may lead to runtime errors (as opposed to just readability issues or compatibility problems).
================
Comment at: clang-tidy/google/MemberStringReferencesCheck.cpp:28
@@ +27,3 @@
+
+ // Ignore members in templates.
+ auto InTemplate = hasAncestor(
----------------
Did you mean "in template instantiations"? We don't (and shouldn't) ignore members in template declarations, if the type is not dependent on template arguments.
http://reviews.llvm.org/D4522
More information about the cfe-commits
mailing list