[PATCH] D40108: [clang-tidy] Adding Fuchsia checkers to clang-tidy

Julie Hockett via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 21 15:05:27 PST 2017


juliehockett added a comment.

We're going to go with fuchsia-* for the module name, since the style applies to the broader project. Also, there may be zircon-specific checks at some point, so we want to leave the door open for that.



================
Comment at: clang-tidy/fuchsia/DefaultArgumentsCheck.cpp:35-38
+    SourceRange RemovalRange(
+          Lexer::getLocForEndOfToken(D->getLocation(), 0, 
+                *Result.SourceManager, Result.Context->getLangOpts()),
+          D->getDefaultArgRange().getEnd()
----------------
aaron.ballman wrote:
> Does `getDefaultArgRange()` not provide the correct range already (so you don't need to go back to the original source)? Or does that range miss the `=`?
> 
> You might want to disable the fix-it in the case `getDefaultArgRange()` returns an empty range, or in case the default arg expression comes from a macro (and add a test for the latter case). e.g.,
> ```
> #define DERP(val)  = val
> 
> void f(int i DERP);
> ```
> Additionally, a test where the identifier is elided would be good as well: `void f(int = 12);`
`getDefaultArgRange()` misses the `=` -- though if there's a better way to do it I'm all ears! 


https://reviews.llvm.org/D40108





More information about the cfe-commits mailing list