[PATCH] [clang-tidy] Add a checker that warns on const string & members.
Daniel Jasper
djasper at google.com
Wed Jul 16 02:16:59 PDT 2014
================
Comment at: clang-tidy/google/CMakeLists.txt:8
@@ -7,2 +7,3 @@
GoogleTidyModule.cpp
+ MemberStringReferencesCheck.cpp
NamedParameterCheck.cpp
----------------
I'd probably call this StringReferenceMemberCheck, but I don't have a strong objection against this name.
================
Comment at: clang-tidy/google/GoogleTidyModule.cpp:35
@@ -33,1 +34,3 @@
CheckFactories.addCheckFactory(
+ "google-runtime-member-string-references",
+ new ClangTidyCheckFactory<runtime::MemberStringReferencesCheck>());
----------------
Where does "runtime" come from? Does that make sense?
================
Comment at: clang-tidy/google/MemberStringReferencesCheck.h:22
@@ +21,3 @@
+/// const string reference members are generally considered unsafe. This check
+/// emit warnings for both std::string and ::string const reference members.
+///
----------------
Just for my benefit, why are non-const string reference members ok?
http://reviews.llvm.org/D4522
More information about the cfe-commits
mailing list