[PATCH] D33531: Clang-tidy readability: avoid const value return
Alexander Kornienko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 29 04:57:01 PDT 2017
alexfh added inline comments.
================
Comment at: clang-tidy/readability/ConstValueReturnCheck.cpp:27
+ // skip those too.
+ Finder->addMatcher(functionDecl(returns(qualType(
+ isConstQualified(),
----------------
How about just matching definitions to avoid duplicate warnings?
================
Comment at: test/clang-tidy/readability-const-value-return.cpp:1
+// RUN: %check_clang_tidy %s readability-const-value-return %t
+
----------------
Please add tests for:
1. a function with multiple declarations and a definition
2. function declarations/definitions in macros
3. a class method
4. implicit stuff (I'm not sure if a lambda can be made to return a const type without an explicit return type specification)
================
Comment at: test/clang-tidy/readability-const-value-return.cpp:50
+template <typename T>
+const T f_returns_template_param();
+
----------------
It would be nice to ensure the check doesn't trigger on template instantiation of this function as well.
Repository:
rL LLVM
https://reviews.llvm.org/D33531
More information about the cfe-commits
mailing list