[PATCH] Add readability-remove-void-arg check to clang-tidy

Richard legalize at xmission.com
Tue Feb 24 09:13:43 PST 2015


================
Comment at: clang-tidy/readability/RemoveVoidArg.cpp:174
@@ +173,3 @@
+void RemoveVoidArg::processFieldDecl(const MatchFinder::MatchResult &Result, FieldDecl const *const Member) {
+    std::string const Text = getText(Result, *Member);
+    removeVoidArgumentTokens(Result, Member->getLocStart(), Text, "Redundant void argument list in field declaration.");
----------------
sbenza wrote:
> LegalizeAdulthood wrote:
> > sbenza wrote:
> > > Any reason all of these convert the StringRef into a std::string?
> > > Couldn't they work with the StringRef directly?
> > I tried switching it to a StringRef, but when I tried to combine it with other text to build a replacement for diag(), it got turned into Twine and then failed to match any signature for diag().  I'm open to suggestions for what you'd like to see instead.
> Twine::str() constructs the string.
> I don't mind constructing a string when a match happens. Those are rare.
> But we should avoid allocating memory when no match happens.
> Right now temporary memory allocations are a considerable part of clang-tidy's runtime. We should try to minimize that.
I think we are at that stage now; I do all early-out testing before constructing the replacement string.

http://reviews.llvm.org/D7639

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






More information about the cfe-commits mailing list