[PATCH] Refactor: Move remove-cstr-calls from a standalone executable to a clang-tidy check

Alexander Kornienko alexfh at google.com
Thu Mar 5 03:56:45 PST 2015


================
Comment at: clang-tidy/readability/RemoveCStrCall.h:20
@@ +19,3 @@
+/// \brief Finds unnecessary calls to std::string::c_str().
+class RemoveCStrCall : public ClangTidyCheck {
+public:
----------------
LegalizeAdulthood wrote:
> LegalizeAdulthood wrote:
> > alexfh wrote:
> > > The fact that it removes something doesn't make it much different from other checks, and it doesn't deserve a place in the name. Let's call this check "readability-redundant-cstr" or "readability-redundant-cstr-calls" instead (and the class `RedundantCStrCheck` or `RedundantCStrCallsCheck`).
> > > 
> > > I posted a relevant comment earlier, but it has fallen through the cracks.
> > Fixed.
> I was thinking about names; we have `RedundantSmartPtrGet` and check name `readability-redundant-smartptr-get`, a check for redundant calls to `get()` on a smartptr class.
> 
> Would that make this `RedundantStringCStr` and check name `readability-redundant-string-cstr`?
I'd prefer the checks have the `Check` suffix in the class name. This convention is not strictly followed, but it probably should. The motivation is discussed in this review thread: http://reviews.llvm.org/D4189.

Thus it can be `RedundantStringCStrCheck` and the check name `readability-redundant-string-cstr`.

http://reviews.llvm.org/D7318

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list