[PATCH] D56160: [clang-tidy] modernize-use-trailing-return check

Bernhard Manfred Gruber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 27 06:56:41 PST 2019


bernhardmgruber updated this revision to Diff 188528.
bernhardmgruber marked 2 inline comments as done.
bernhardmgruber added a comment.
Herald added a subscriber: jdoerfert.

- rebased onto current master
- implemented a basic check for name collisions of unqualified names in the return type with function arugment names using RecursiveASTVisitor
- moved retrieval of `FunctionTypeLoc` out of `findTrailingReturnTypeSourceLocation()`
- replaced `F.getReturnType().hasLocalQualifiers()` by custom function `hasAnyNestedLocalQualifiers()`, as the former does not work if the qualifiers are not on the topmost type. E.g.: `const int*`. This is a PointerType without qualifiers, the const qualifier is part of the nested pointee type.
- inhibiting the rewrite, if the topmost return type is a `decltype` expression. the source range in this case does not include the expression in parenthesis after the `decltype`
- inserting an additional space after `auto` in case there was no space between the return type and the function name. E.g.: `int*f();`
- extended documentation with known limitations
- added more tests


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56160/new/

https://reviews.llvm.org/D56160

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/UseTrailingReturnCheck.cpp
  clang-tidy/modernize/UseTrailingReturnCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-use-trailing-return.rst
  test/clang-tidy/modernize-use-trailing-return.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56160.188528.patch
Type: text/x-patch
Size: 41827 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190227/d61da04b/attachment-0001.bin>


More information about the cfe-commits mailing list