[PATCH] D56160: [clang-tidy] modernize-use-trailing-return check
Bernhard Manfred Gruber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 6 16:29:33 PST 2019
bernhardmgruber updated this revision to Diff 180419.
bernhardmgruber added a comment.
Big thank you to @JonasToth for providing some macro test cases. I played a bit with macros and settled on the following behavior:
- if the closing parenthesis of the function is inside a macro, no FixIt will be created (I cannot relyably lex for subsequent CV and ref qualifiers and maybe we do not want to make changes in macros)
- if the return type is not CV qualified, i allow macros to be part of it because no lexing is required
- if the return type is CV qualified and contains macros, I provide no FixIt
I improved findTrailingReturnTypeSourceLocation() by discovering FunctionTypeLoc::getRParenLoc(). I still require some lexing for CV and ref qualifiers though.
I tried to improve findReturnTypeAndCVSourceRange() by finding a way to get the source range directly from the AST, but it seems the AST does not store source locations for CV qualifiers of types. I read that in the docs for QualifiedTypeLoc <https://clang.llvm.org/doxygen/classclang_1_1QualifiedTypeLoc.html#details>. So it seems I cannot circumvent finding the locations of const and volatile by my own.
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.180419.patch
Type: text/x-patch
Size: 25332 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190107/0b1cafe7/attachment-0001.bin>
More information about the cfe-commits
mailing list