[clang-tidy] Add a checker that warns on const string & members.
Summary:
Those are considered unsafe and should be replaced with simple pointers or
full copies. It recognizes both std::string and ::string.
Reviewers: alexfh, djasper
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4522
llvm-svn: 213133
diff --git a/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp b/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp
index 36e11d4..43eacfc3 100644
--- a/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/google/GoogleTidyModule.cpp
@@ -15,6 +15,7 @@
#include "ExplicitMakePairCheck.h"
#include "NamedParameterCheck.h"
#include "OverloadedUnaryAndCheck.h"
+#include "StringReferenceMemberCheck.h"
using namespace clang::ast_matchers;
@@ -34,6 +35,9 @@
"google-runtime-operator",
new ClangTidyCheckFactory<runtime::OverloadedUnaryAndCheck>());
CheckFactories.addCheckFactory(
+ "google-runtime-member-string-references",
+ new ClangTidyCheckFactory<runtime::StringReferenceMemberCheck>());
+ CheckFactories.addCheckFactory(
"google-readability-casting",
new ClangTidyCheckFactory<readability::AvoidCStyleCastsCheck>());
CheckFactories.addCheckFactory(