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

Richard legalize at xmission.com
Mon May 18 09:26:07 PDT 2015

Comment at: clang-tidy/readability/RedundantVoidArgCheck.cpp:244
@@ +243,3 @@
+    removeVoidArgumentTokens(
+        Result, shrinkRangeByOne(SourceRange(CStyleCast->getLParenLoc(),
+                                             CStyleCast->getRParenLoc())),
alexfh wrote:
> Character-based offsets can be brittle in case escaped newlines and alternative tokens are used. I'd prefer getting the type range directly when it's possible. Here and for other casts something like this should work: `CStyleCast->getTypeInfoAsWritten()->getTypeLoc().getSourceRange()`.
> Also, do we need separate functions for `ExplicitCastExpr` and two of its children classes?
I don't think the character based offsets can be avoided here.  The nodes don't provide getter functions for all the locations I'm interested in and I have to construct the appropriate source location myself.  I will try what you suggest and see how it goes.

I tried doing things with just `ExplicitCastExpr` initially and when I added test cases for the functional and C-style casts, I needed to do different replacement ranges.



More information about the cfe-commits mailing list