summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/performance-unnecessary-value-param.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [ClangTidy] Separate tests for infrastructure and checkersDmitri Gribenko2019-10-111-383/+0
| | | | | | | | | | | | | | | | | | | | Summary: This change moves tests for checkers and infrastructure into separate directories, making it easier to find infrastructure tests. Tests for checkers are already easy to find because they are named after the checker. Tests for infrastructure were difficult to find because they were outnumbered by tests for checkers. Now they are in a separate directory. Reviewers: jfb, jdoerfert, lebedev.ri Subscribers: srhines, nemanjai, aheejin, kbarton, christof, mgrang, arphaman, jfb, lebedev.ri, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68807 llvm-svn: 374540
* Use ExprMutationAnalyzer in performance-unnecessary-value-paramShuai Wang2018-08-031-0/+22
| | | | | | | | | | | | | | | | | | | | | | Summary: This yields better recall as ExprMutationAnalyzer is more accurate. One common pattern this check is now able to catch is: ``` void foo(std::vector<X> v) { for (const auto& elm : v) { // ... } } ``` Reviewers: george.karpenkov Subscribers: a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D50102 llvm-svn: 338903
* [clang-tidy] Do not issue fixit for explicit template specializationsFelix Berger2017-07-261-0/+11
| | | | | | | | | | | | | | Summary: Do not issue fixit in UnnecessaryValueParamCheck if the function is an explicit template specialization as this could cause build breakages. Reviewers: alexfh Subscribers: JDevlieghere, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D35718 llvm-svn: 309067
* [clang-tidy] Ignore implicit functions in performance-unnecessary-value-paramMalcolm Parsons2017-01-231-0/+17
| | | | | | | | | | | | | | | | | Summary: The performance-unnecessary-value-param check mangled inherited constructors, as the constructors' parameters do not have useful source locations. Fix this by ignoring implicit functions. Fixes PR31684. Reviewers: flx, alexfh, aaron.ballman Subscribers: madsravn, JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D29018 llvm-svn: 292786
* [clang-tidy] Do not trigger move fix for non-copy assignment operators in ↵Felix Berger2017-01-191-0/+11
| | | | | | | | | | | | performance-unnecessary-value-param check Reviewers: alexfh, sbenza, malcolm.parsons Subscribers: JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D28899 llvm-svn: 292491
* [clang-tidy] Handle constructors in performance-unnecessary-value-paramMalcolm Parsons2017-01-031-2/+24
| | | | | | | | | | | | | | Summary: modernize-pass-by-value doesn't warn about value parameters that cannot be moved, so performance-unnecessary-value-param should. Reviewers: aaron.ballman, flx, alexfh Subscribers: JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D28022 llvm-svn: 290883
* [clang-tidy] Do not move parameter if only DeclRefExpr occurs inside of a loopFelix Berger2016-12-161-0/+9
| | | | | | | | | | | | Summary: This fixes a bug where the performance-unnecessary-value-param check suggests a fix to move the parameter inside of a loop which could be invoked multiple times. Reviewers: sbenza, aaron.ballman, alexfh Subscribers: JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D27187 llvm-svn: 289912
* [clang-tidy] Do not trigger unnecessary-value-param check on methods marked ↵Felix Berger2016-12-021-0/+18
| | | | | | | | | | | | | | | | | as final Summary: Virtual method overrides of dependent types cannot be recognized unless they are marked as override or final. Exclude methods marked as final from check and add test. Reviewers: sbenza, hokein, alexfh Subscribers: malcolm.parsons, JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D27248 llvm-svn: 288502
* [clang-tidy] Do not issue fix for functions that are referenced outside of ↵Felix Berger2016-11-101-0/+18
| | | | | | | | | | | | | | | | | | | callExpr Summary: Suppress fixes for functions that are referenced within the compilation unit outside of a call expression as the signature change could break the code referencing the function. We still issue a warning in this case so that users can decide to manually change the function signature. Reviewers: alexfh, sbenza, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26203 llvm-svn: 286424
* [clang-tidy] Move incomplete type test into separate test fileFelix Berger2016-11-071-8/+1
| | | | | | | | | | | | Summary: Move in complete type test which does not compile into its own test file. Reviewers: alexfh, sbenza, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26369 llvm-svn: 286155
* [ClangTidy - performance-unnecessary-value-param] Only add "const" when ↵Felix Berger2016-11-041-0/+16
| | | | | | | | | | | | current parameter is not already const qualified Reviewers: alexfh, sbenza, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26207 llvm-svn: 286010
* [clang-tidy] Ignore incomplete types when determining whether they are ↵Felix Berger2016-11-041-1/+8
| | | | | | | | | | | | | | | | expensive to copy Summary: IsExpensiveToCopy can return false positives for incomplete types, so ignore them. All existing ClangTidy tests that depend on this function still pass as the types are complete. Reviewers: alexfh, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26195 llvm-svn: 286008
* [clang-tidy] UnnecessaryValueParamCheck - only warn for virtual methodsFelix Berger2016-07-051-0/+13
| | | | | | | | | | | | | | Summary: As changing virtual methods could break method overrides disable applying the fix and just warn. Reviewers: alexfh, sbenza Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D21936 llvm-svn: 274552
* [clang-tidy] UnnecessaryValueParamCheck - suggest std::move() if non-const ↵Felix Berger2016-07-011-0/+44
| | | | | | | | | | | | | | | | | | | | value parameter can be moved. Summary: Make check more useful in the following two cases: The parameter is passed by non-const value, has a non-deleted move constructor and is only referenced once in the function as argument to the type's copy constructor. The parameter is passed by non-const value, has a non-deleted move assignment operator and is only referenced once in the function as argument of the the type's copy assignment operator. In this case suggest a fix to move the parameter which avoids the unnecessary copy and is closest to what the user might have intended. Reviewers: alexfh, sbenza Subscribers: cfe-commits, Prazek Differential Revision: http://reviews.llvm.org/D20277 llvm-svn: 274380
* [clang-tidy] TypeTraits - Type is not expensive to copy when it has a ↵Felix Berger2016-05-141-0/+11
| | | | | | | | | | | | deleted copy constructor. Reviewers: alexfh, sbenza Subscribers: etienneb, aaron.ballman, cfe-commits Differential Revision: http://reviews.llvm.org/D20170 llvm-svn: 269581
* [clang-tidy] Add performance check to flag function parameters of expensive ↵Felix Berger2016-03-291-0/+171
to copy types that can be safely converted to const references. Reviewers: alexfh Subscribers: fowles, cfe-commits Differential Revision: http://reviews.llvm.org/D17491 llvm-svn: 264694
OpenPOWER on IntegriCloud