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

Richard legalize at xmission.com
Wed Mar 4 22:42:43 PST 2015


In http://reviews.llvm.org/D7318#133461, @alexfh wrote:

> In http://reviews.llvm.org/D7318#133243, @LegalizeAdulthood wrote:
>
> > Run clang-format on the source files.
> >  Use the name `readability-redundant-cstr-call` for the check.
>
>
> Thanks for updating this. However could you use one of the alternatives I suggested? If you lean toward using 'call' in the name, let it be `readability-redundant-cstr-calls` and correspondingly `RedundantCStrCallsCheck` for the name of the class and the source files. Something seems wrong to me in using singular `call` in the name of this check, as it's supposed to find any number of them, not just one. Also note the `Check` suffix for the class name (and corresponding file names. It's kind of a naming convention for the checks.
>
> Thanks.
>
> For the reference, here's my previous comment:
>
> > 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).
>





================
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:
> 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`?

http://reviews.llvm.org/D7318

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






More information about the cfe-commits mailing list