[PATCH] D16259: Add clang-tidy readability-redundant-return check
Richard via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 15 22:53:24 PST 2016
LegalizeAdulthood added inline comments.
================
Comment at: clang-tidy/readability/RedundantReturnCheck.cpp:46-49
@@ +45,6 @@
+ auto ReturnRange = CharSourceRange::getCharRange(
+ Start, Lexer::findLocationAfterToken(
+ Return->getLocEnd(), tok::semi, *Result.SourceManager,
+ Result.Context->getLangOpts(),
+ /*SkipTrailingWhitespaceAndNewLine=*/true));
+
----------------
This was a great trick I stole from the unused namespace alias check. I could really use some method for trimming off preceding whitespace for a statement as well. Right now, the `return` statement gets removed, but when it appears on a line by itself, it's indentation whitespace is left in place and I'd like to be able to remove that as well. I tried a couple things, but for this first pass simply decided to let the test cases allow leading whitespace before the closing brace of the function. One can always use artistic style or `clang-format` to reformat the results anyway, so it's not that big a deal I suppose.
http://reviews.llvm.org/D16259
More information about the cfe-commits
mailing list