================
Comment at: clang-tidy/google/CMakeLists.txt:8
@@ -7,2 +7,3 @@
   GoogleTidyModule.cpp
+  MemberStringReferencesCheck.cpp
   NamedParameterCheck.cpp
----------------
Daniel Jasper wrote:
> I'd probably call this StringReferenceMemberCheck, but I don't have a strong 
> objection against this name.
Less backwards that suggestion is, rename the file I will.

================
Comment at: clang-tidy/google/GoogleTidyModule.cpp:35
@@ -33,1 +34,3 @@
     CheckFactories.addCheckFactory(
+        "google-runtime-member-string-references",
+        new ClangTidyCheckFactory<runtime::MemberStringReferencesCheck>());
----------------
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.

================
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.
+///
----------------
Daniel Jasper wrote:
> Just for my benefit, why are non-const string reference members ok?
The rationale is that you can initialize the following class with a const char 
*, creating a string temporary and leave a dangling reference. This behavior 
won't come up with non-const refs.


```
struct S {
  S(const string &S) : Str(S) {}

  const string &Str;
};
```

I'll add that info to the checker description comment.

http://reviews.llvm.org/D4522



_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to