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

Richard legalize at xmission.com
Thu Mar 5 12:57:07 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:
----------------
alexfh wrote:
> 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`.
Sounds good, I'll see if I can update that tonight.  I did notice that not all checks had classes ending in `Check`.  I'll create another changeset that fixes that.

http://reviews.llvm.org/D7318

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






More information about the cfe-commits mailing list