summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [clang-tools-extra] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-141-1/+1
| | | | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 llvm-svn: 368944
* [clang-tidy] misc-unused-parameters: don't comment out parameter name for C codeMatthias Gehre2019-06-211-4/+9
| | | | | | | | | | | | | | Summary: The fixit `int square(int /*num*/)` yields `error: parameter name omitted` for C code. Enable it only for C++ code. Reviewers: klimek, ilya-biryukov, lebedev.ri, aaron.ballman Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63088 llvm-svn: 364106
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [clang-tidy] Update checks to play nicely with limited traversal scope added ↵Sam McCall2018-11-151-3/+2
| | | | | | | | | | | | | | in r346847 Summary: (See D54204 for original review) Reviewers: hokein Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D54579 llvm-svn: 346961
* Port getLocEnd -> getEndLocStephen Kelly2018-08-091-2/+2
| | | | | | | | Subscribers: nemanjai, ioeric, kbarton, cfe-commits Differential Revision: https://reviews.llvm.org/D50355 llvm-svn: 339401
* Port getLocStart -> getBeginLocStephen Kelly2018-08-091-2/+2
| | | | | | | | | | Reviewers: javed.absar Subscribers: nemanjai, kbarton, ilya-biryukov, ioeric, jkorous, arphaman, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D50354 llvm-svn: 339400
* [clang-tidy] Fix http://llvm.org/PR38055Alexander Kornienko2018-07-041-2/+3
| | | | llvm-svn: 336283
* [clang-tidy] misc-unused-parameters - retain old behavior under StrictModeAlexander Kornienko2018-06-281-7/+20
| | | | | | | | | | | | | | Summary: This addresses https://bugs.llvm.org/show_bug.cgi?id=37467. Reviewers: klimek, ilya-biryukov, lebedev.ri, aaron.ballman Reviewed By: lebedev.ri, aaron.ballman Subscribers: aaron.ballman, lebedev.ri, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D46951 llvm-svn: 335863
* Do not warn on unused parameters for functions with empty bodies.Manuel Klimek2018-05-091-4/+5
| | | | | | If a function has an empty body, all parameters are trivially unused. llvm-svn: 331875
* [clang-tidy] Fixed misc-unused-parameters omitting parameters square bracketsAlexander Kornienko2017-09-151-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Bug: https://bugs.llvm.org/show_bug.cgi?id=34449 **Problem:** Clang-tidy check misc-unused-parameters comments out parameter name omitting following characters (e.g. square brackets) what results in its complete removal. Compilation errors might occur after clang-tidy fix as well. **Patch description:** Changed removal range. The range should end after parameter name, not after whole parameter declarator (which might be followed by e.g. square brackets). Reviewers: alexfh Reviewed By: alexfh Subscribers: JDevlieghere, xazax.hun, cfe-commits Tags: #clang-tools-extra Patch by Pawel Maciocha! Differential Revision: https://reviews.llvm.org/D37846 llvm-svn: 313355
* [clang-tidy] fixed misc-unused-parameters omitting parameters default valueAlexander Kornienko2017-09-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Bug: https://bugs.llvm.org/show_bug.cgi?id=34450 **Problem:** Clang-tidy check misc-unused-parameters omits parameter default value what results in its complete removal. Compilation errors might occur after clang-tidy fix. **Patch description:** Changed removal range. The range should end after parameter declarator, not after whole parameter declaration (which might contain a default value). Reviewers: alexfh, xazax.hun Reviewed By: alexfh Subscribers: JDevlieghere, cfe-commits Tags: #clang-tools-extra Patch by Pawel Maciocha! Differential Revision: https://reviews.llvm.org/D37566 llvm-svn: 313150
* [clang-tidy] Optimize misc-unused-parameters. NFCIAlexander Kornienko2017-05-171-15/+67
| | | | | | | | | Don't traverse AST each time we need to find references to a certain function. Traverse the AST once using RAV and cache the index of function references. The speed up on a particular large file was about 1000x. llvm-svn: 303230
* [clang-tools-extra] Format sources with clang-format. NFC.Mandeep Singh Grang2016-11-081-2/+1
| | | | | | | | | | | | | | | | 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] Cleaning namespaces to be more consistant across checkers.Etienne Bergeron2016-05-021-0/+3
| | | | | | | | | | | | | | 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] Remove unnecessary getName() on Decls and Types feeding into a ↵Benjamin Kramer2016-04-071-2/+1
| | | | | | | | | | 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] Don't delete unused parameter in class override method in ↵Haojian Wu2016-04-011-10/+12
| | | | | | | | | | | | | | anonymous namespace. Summary: Fixes PR26740. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D17926 llvm-svn: 265117
* clang-tidy: [misc-unused-parameters] Ignore template instantiations.Daniel Jasper2016-02-031-1/+2
| | | | | | | | | No functional changes intended as we should already do the corresponding fixes when visiting the primary template. There are existing tests that verify that we do change unused parameters of templated functions. llvm-svn: 259640
* Fix bug in suggested fix that truncated variable names to 1 character.Samuel Benzaquen2015-11-111-30/+35
| | | | | | | | | | | | | | Summary: Fix bug in suggested fix that truncated variable names to 1 character. Also, rework the suggested fix to try to remove unnecessary whitespace. Reviewers: alexfh, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13899 llvm-svn: 252773
* misc-unused-parameter: Ignore lambda static invokers.Daniel Jasper2015-09-221-0/+3
| | | | llvm-svn: 248252
* misc-unused-parameters: Fix crasher with C forward declarations thatDaniel Jasper2015-08-141-1/+2
| | | | | | can leave out the parameter list. llvm-svn: 245048
* misc-unused-parameters: Don't touch K&R style functions.Daniel Jasper2015-08-101-1/+2
| | | | | | We couldn't calculate the removal ranges properly at this point. llvm-svn: 244454
* misc-unused-parameters: Only remove parameters in the main source file.Daniel Jasper2015-07-281-1/+3
| | | | | | | In headers, they might always be pulled in to different TUs, even if they are declared static or nested in an unnamed namespace. llvm-svn: 243414
* misc-unused-parameters: Properly handle static class members.Daniel Jasper2015-07-281-3/+4
| | | | | | Not sure why I wrote what I wrote before. llvm-svn: 243403
* misc-unused-parameters: Don't warn on ParmVarDecls in the return type.Daniel Jasper2015-07-271-16/+18
| | | | | | | | | As there don't seem to be a good way of formulating a matcher that finds all pairs of functions and their ParmVarDecls, just match on functionDecls and iterate over their parameters. This should also be more efficient as some checks are only performed once per function. llvm-svn: 243267
* misc-unused-parameters: Fix bug where the check was looking atDaniel Jasper2015-07-231-2/+4
| | | | | | ParmVarDecls of function types. llvm-svn: 243026
* misc-unused-parameters: Fix handling of parameters in template functions.Daniel Jasper2015-07-221-2/+2
| | | | | | | | | | | | | The parameters of the function templates were being marked as incorrectly be marked as unused. Added a test for this and changed the check to use the same isReferenced() || !getDeclName() logic as Sema::DiagnoseUnusedParameters. Patch Scott Wallace, thank you! llvm-svn: 242912
* Extend misc-unused-parameters to delete parameters of local functions.Daniel Jasper2015-07-201-3/+65
| | | | | | Also see: llvm.org/PR24180. llvm-svn: 242659
* Initial version of clang-tidy check to find and fix unused parameters.Daniel Jasper2015-07-201-0/+43
Also see: llvm.org/PR24180. llvm-svn: 242654
OpenPOWER on IntegriCloud