summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/performance
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang-tidy] Do not trigger unnecessary-value-param check on methods marked ↵Felix Berger2016-12-021-1/+2
| | | | | | | | | | | | | | | | | 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-3/+15
| | | | | | | | | | | | | | | | | | | 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-tools-extra] Format sources with clang-format. NFC.Mandeep Singh Grang2016-11-085-22/+22
| | | | | | | | | | | | | | | | Summary: Ran clang-format on all .c/.cpp/.h files in clang-tools-extra. Excluded the test, unittests, clang-reorder-fields, include-fixer, modularize and pptrace directories. Reviewers: klimek, alexfh Subscribers: nemanjai Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D26329 llvm-svn: 286221
* [clang-tidy] Don't warn implicit variables in ↵Haojian Wu2016-11-081-0/+1
| | | | | | | | | | | | | | | | | | | peformance-unnecessary-copy-initialization. Summary: This will prevent the check warning the variables which have been implicitly added by compiler, like the following case (in for-range loop): the variable '__end' is copy-constructed from a const reference... Reviewers: alexfh Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25911 llvm-svn: 286186
* [ClangTidy - performance-unnecessary-value-param] Only add "const" when ↵Felix Berger2016-11-041-1/+4
| | | | | | | | | | | | 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] Inefficient string operationAlexander Kornienko2016-08-034-0/+131
| | | | | | | | Patch by Bittner Barni! Differential revision: https://reviews.llvm.org/D20196 llvm-svn: 277677
* [clang-tidy] remove trailing whitespaces and retabKirill Bobyrev2016-08-011-2/+2
| | | | llvm-svn: 277340
* [clang-tidy] UnnecessaryValueParamCheck - only warn for virtual methodsFelix Berger2016-07-051-2/+4
| | | | | | | | | | | | | | 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-012-6/+94
| | | | | | | | | | | | | | | | | | | | 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] UnnecessaryCopyInitialization - Extend to trigger on non-const ↵Felix Berger2016-05-312-11/+18
| | | | | | | | | | | | | | | | | | | | | | | | | "this" object argument if it is not modified. Summary: Also trigger the check in the following case: void foo() { ExpensiveToCopy Obj; const auto UnnecessaryCopy = Obj.constReference(); Obj.onlyUsedAsConst(); } i.e. when the object the method is called on is not const but is never modified. Reviewers: alexfh, fowles Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20010 llvm-svn: 271239
* [clang-tidy] Lift common matchers to utils namespaceEtienne Bergeron2016-05-171-3/+1
| | | | | | | | | | | | | | Summary: This patch is lifting matchers used by more than one checkers to the common namespace. Reviewers: aaron.ballman, alexfh Subscribers: aaron.ballman, cfe-commits Differential Revision: http://reviews.llvm.org/D19841 llvm-svn: 269804
* [clang-tidy] - PerformanceUnnecesaryCopyInitialization - only trigger for ↵Felix Berger2016-05-132-20/+28
| | | | | | | | | | | | | | decl stmts with single VarDecl. Summary: This fixes bug: https://llvm.org/bugs/show_bug.cgi?id=27325 Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19865 llvm-svn: 269389
* [clang-tidy] Lift parsing of sequence of names functions to utils.Etienne Bergeron2016-05-101-18/+4
| | | | | | | | | | | | | | | | Summary: Lift some common code used by multiple checkers. This function is also used by checkers that are coming. It is quite common for a checker to parse a list of names. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19846 llvm-svn: 269065
* [clang-tidy] Cleanup namespace in utils folder.Etienne Bergeron2016-05-033-13/+14
| | | | | | | | | | | | | | Summary: This is a step forward cleaning up the namespaces in clang-tidy/utils. There is no behavior change. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19819 llvm-svn: 268356
* [clang-tidy] Cleaning namespaces to be more consistant across checkers.Etienne Bergeron2016-05-022-5/+4
| | | | | | | | | | | | | | Summary: The goal of the patch is to bring checkers in their appropriate namespace. This path doesn't change any behavior. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19811 llvm-svn: 268264
* [clang-tidy] fix a crash with -fdelayed-template-parsing in ↵Etienne Bergeron2016-04-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | | UnnecessaryValueParamCheck. Summary: This is the same kind of bug than [[ http://reviews.llvm.org/D18238 | D18238 ]]. Fix crashes caused by deferencing null pointer when declarations parsing may be delayed. The body of the declarations may be null. The crashes were observed with a Windows build of clang-tidy and the following command-line. ``` command-line switches: -fms-compatibility-version=19 -fms-compatibility ``` Reviewers: alexfh Subscribers: kimgr, LegalizeAdulthood, cfe-commits Differential Revision: http://reviews.llvm.org/D18852 llvm-svn: 265681
* [clang-tidy] Remove unnecessary getName() on Decls and Types feeding into a ↵Benjamin Kramer2016-04-072-12/+7
| | | | | | | | | | DiagnosticBuilder Going through a string removes some of the smarts of the diagnosic printer and makes the code more complicated. This change has some cosmetic impact on the output but that's mostly minor. llvm-svn: 265680
* [clang-tidy] Add performance check to flag function parameters of expensive ↵Felix Berger2016-03-294-0/+127
| | | | | | | | | | | | 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
* Add check for unneeded copies of localsHaojian Wu2016-03-232-29/+88
| | | | | | | | | | | | | | Summary: Extends the UnnecessaryCopyInitialization to detect copies of local variables and parameters that are unneeded. Patch by Matt Kulukundis! Reviewers: alexfh, hokein Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18149 llvm-svn: 264146
* [clang-tidy] Extend UnnecessaryCopyInitialization check to trigger on ↵Felix Berger2016-03-053-122/+47
| | | | | | | | | | | | | | | | non-const copies that can be safely converted to const references. Summary: Move code shared between UnnecessaryCopyInitialization and ForRangeCopyCheck into utilities files. Add more test cases for UnnecessaryCopyInitialization and disable fixes inside of macros. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D17488 llvm-svn: 262781
* [clang-tidy] Only invoke ForRangeCopyCheck on expensive-to-copy types.Felix Berger2016-02-151-3/+6
| | | | | | | | | | | | | | Summary: Fix oversight not checking the value of the Optional<bool> returned by isExpensiveToCopy(). Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D17064 llvm-svn: 260870
* [clang-tidy] Add check performance-faster-string-findSamuel Benzaquen2016-02-124-0/+175
| | | | | | | | | | | | | | Summary: Add check performance-faster-string-find. It replaces single character string literals to character literals in calls to string::find and friends. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D16152 llvm-svn: 260712
* [clang-tidy] Don't use delegating constructors, since they are not supported ↵Alexander Kornienko2016-01-291-3/+4
| | | | | | by MSVC 2013 llvm-svn: 259214
* [clang-tidy] ForRangeCopyCheck that warns on and fixes unnecessary copies of ↵Alexander Kornienko2016-01-294-0/+230
| | | | | | | | | | loop variables. Patch by Felix Berger! Differential revision: http://reviews.llvm.org/D13849 llvm-svn: 259199
* [clang-tidy] Fix minor style issues. NFCAlexander Kornienko2016-01-291-7/+7
| | | | llvm-svn: 259198
* [clang-tidy] Fix style issues. NFCAlexander Kornienko2016-01-291-10/+6
| | | | llvm-svn: 259196
* [clang-tidy] Move implicit-cast-in-loop check to upstream.Alexander Kornienko2016-01-294-0/+147
| | | | | | | | | | | | | | Summary: This is implemented originally by Alex Pilkiewicz (pilki@google.com). Reviewers: alexfh Subscribers: cfe-commits Patch by Haojian Wu! Differential Revision: http://reviews.llvm.org/D16721 llvm-svn: 259195
* Remove autoconf supportChris Bieneman2016-01-261-12/+0
| | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "Now I am become Death, the destroyer of worlds." -J. Robert Oppenheimer Reviewers: chandlerc, grosbach, bob.wilson, echristo Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D16475 llvm-svn: 258864
* [clang-tidy] Don't use delegating constructorsAlexander Kornienko2015-12-301-1/+2
| | | | llvm-svn: 256637
* [clang-tidy] Use hasLocalStorage() to identify unnecessary copy ↵Alexander Kornienko2015-12-301-2/+1
| | | | | | | | | | | | | | initializations to exclude static local variables. Summary: Since local static variables can outlive other local variables exclude them from the unnecessary copy initialization check. Reviewers: alexfh Patch by Felix Berger! Differential Revision: http://reviews.llvm.org/D15822 llvm-svn: 256636
* [clang-tidy] Add the missing MakefileAlexander Kornienko2015-12-301-0/+12
| | | | llvm-svn: 256634
* [clang-tidy] Add UnnecessaryCopyInitialization check to new "performance" ↵Alexander Kornienko2015-12-304-0/+164
module in ClangTidy Summary: The patch adds a new ClangTidy check that detects when expensive-to-copy types are unnecessarily copy initialized from a const reference that has the same or are larger scope than the copy. It currently only detects this when the copied variable is const qualified. But this will be extended to non const variables if they are only used in a const fashion. Reviewers: alexfh Subscribers: cfe-commits Patch by Felix Berger! Differential Revision: http://reviews.llvm.org/D15623 llvm-svn: 256632
OpenPOWER on IntegriCloud