summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/misc
Commit message (Collapse)AuthorAgeFilesLines
...
* Add misc-unused-alias-decls check that currently finds unused namespaceDaniel Jasper2015-07-314-0/+102
| | | | | | | alias declarations. In the future, we might want to reuse it to also fine unsed using declarations and such. llvm-svn: 243754
* [clang-tidy] Support replacements in macro arguments in ↵Alexander Kornienko2015-07-311-11/+34
| | | | | | | | | | | | | | | | misc-inefficient-algorithm Summary: Support replacements in macro arguments in the misc-inefficient-algorithm check. Reviewers: klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D11677 llvm-svn: 243747
* 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-272-16/+23
| | | | | | | | | 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-204-0/+79
| | | | | | Also see: llvm.org/PR24180. llvm-svn: 242654
* [clang-tidy] Enhance clang-tidy misc-macro-repeated-side-effects...Daniel Marjamaki2015-07-021-18/+50
| | | | | | | | | | | Enhance clang-tidy misc-macro-repeated-side-effects to handle ? and : better. When ? is used in a macro, there are 2 possible control flow paths through the macro. These paths are tracked separately so problems can be detected properly. http://reviews.llvm.org/D10653 llvm-svn: 241245
* [clang-tidy] minor coding style tweak. make functions static.Daniel Marjamaki2015-07-011-5/+5
| | | | llvm-svn: 241160
* [clang-tidy] Fix false positives in the macro parentheses checkerDaniel Marjamaki2015-06-291-2/+11
| | | | | | | | | | | Summary: There were false positives in C++ code where macro argument was a type. Reviewers: alexfh Differential Revision: http://reviews.llvm.org/D10801 llvm-svn: 240938
* [clang-tidy] Fix false positives in misc-macro-parentheses checkerDaniel Marjamaki2015-06-231-3/+3
| | | | llvm-svn: 240399
* clang-tidy: Remove an unused private field. NFCJustin Bogner2015-06-181-5/+3
| | | | | | Clang was warning on this. llvm-svn: 239988
* clang-tidy: Add checker that warn when macro argument with side effects is ↵Daniel Marjamaki2015-06-174-0/+179
| | | | | | repeated in the macro llvm-svn: 239909
* [clang-tidy] Move user-defined matches to unnamed namespaces to prevent ODR ↵Alexander Kornienko2015-06-174-14/+15
| | | | | | violations. llvm-svn: 239904
* clang-tidy: Add checker that warns about missing parentheses in macrosDaniel Marjamaki2015-06-164-0/+238
| | | | | | | * calculations in the replacement list should be inside parentheses * macro arguments should be inside parentheses llvm-svn: 239820
* [clang-tidy] Fix for llvm.org/PR23355Szabolcs Sipos2015-05-292-6/+13
| | | | | | misc-static-assert and misc-assert-side-effect will handle __builtin_expect based asserts correctly. llvm-svn: 238548
* [clang-tidy] Renamed misc-noexcept-move-ctors to misc-noexcept-move-constructorAlexander Kornienko2015-05-274-14/+15
| | | | llvm-svn: 238326
* [clang-tidy] misc-noexcept-move-ctors should ignore implicit constructors ↵Alexander Kornienko2015-05-262-4/+5
| | | | | | and assignments. llvm-svn: 238202
* [clang-tidy] Fix for llvm.org/PR23572Szabolcs Sipos2015-05-231-1/+3
| | | | | | misc-static-assert won't report asserts whose conditions contain calls to non constexpr functions. llvm-svn: 238098
* Add a clang-tidy check for move constructors/assignment ops without noexcept.Alexander Kornienko2015-05-224-0/+106
| | | | | | | | | | | | | | | | | | Summary: Add a clang-tidy check (misc-noexcept-move-ctors) for move constructors and assignment operators not using noexcept. http://llvm.org/PR23519 Reviewers: klimek Reviewed By: klimek Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D9933 llvm-svn: 238013
* [clang-tidy] Treat all types with non-trivial destructors as RAII.Alexander Kornienko2015-05-121-3/+3
| | | | | | | This solves some false negatives at a cost of adding some false positives that can be fixed easily and (almost) automatically. llvm-svn: 237120
* [clang-tidy] Fix for llvm.org/PR23161Szabolcs Sipos2015-05-081-1/+1
| | | | | | | | | | The misc-static-assert check will not warn on the followings: assert(NULL == "shouldn't warn"); assert(__null == "shouldn't warn"); Where NULL is a macro defined as __null. llvm-svn: 236812
* [clang-tidy] Fix for llvm.org/PR23161Szabolcs Sipos2015-04-101-8/+12
| | | | | | | | The misc-static-assert check will not warn on the followings: assert("Some message" == NULL); assert(NULL == "Some message"); llvm-svn: 234596
* [clang-tidy] Ignore expressions with incompatible deleters.Samuel Benzaquen2015-04-091-3/+61
| | | | | | | | | | | | | | | Summary: Do not warn on .reset(.release()) expressions if the deleters are not compatible. Using plain assignment will probably not work. Reviewers: klimek Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D8422 llvm-svn: 234512
* Fix clang-tidy to not assume wrong source locations for defaulted members.Eli Bendersky2015-03-231-1/+6
| | | | | | | | | | Followup to http://reviews.llvm.org/D8465, which would break a test in clang-tidy. clang-tidy previously assumes that source locations of defaulted/deleted members are (incorrectly) not including the '= ...' part. Differential Revision: http://reviews.llvm.org/D8466 llvm-svn: 233032
* [clang-tidy] Fix false positives in the misc-static-assert check ↵Alexander Kornienko2015-03-151-3/+11
| | | | | | | | | | | | | | | | http://llvm.org/PR22880 The misc-static-assert check will not warn on assert(false), assert(False), assert(FALSE); where false / False / FALSE are macros expanding to the false or 0 literals. Also added corresponding test cases. http://reviews.llvm.org/D8328 Patch by Szabolcs Sipos! llvm-svn: 232306
* [clang-tidy] Fixed header guards using clang-tidy llvm-header-guard check. NFC.Alexander Kornienko2015-03-0912-36/+36
| | | | | | | | | | The patch was generated using this command: $ clang-tidy/tool/run-clang-tidy.py -header-filter=.*clang-tidy.* -fix \ -checks=-*,llvm-header-guard clang-tidy.* $ svn revert --recursive clangt-tidy/llvm/ (to revert a few buggy fixes) llvm-svn: 231669
* [clang-tidy] Refactor: Rename clang-tidy misc check files and classes to ↵Alexander Kornienko2015-03-0910-48/+48
| | | | | | | | | | | | | follow naming conventions Classes are named WhateverCheck, files are named WhateverCheck.cpp and WhateverCheck.h. http://reviews.llvm.org/D8145 Patch by Richard Thomson! llvm-svn: 231648
* [clang-tidy] Fix assertion when a dependent expression is used in an assert.Alexander Kornienko2015-03-091-1/+3
| | | | llvm-svn: 231620
* [clang-tidy] Fix diag message in clang-tidy misc-uniqueptr-reset-release if ↵Alexander Kornienko2015-03-051-3/+8
| | | | | | | | | | right side is rvalue http://reviews.llvm.org/D8071 Patch by Alexey Sokolov! llvm-svn: 231365
* [clang-tidy] Refactor: Move misc clang-tidy checks to namespace ↵Alexander Kornienko2015-03-0221-3/+44
| | | | | | | | | | | | | clang::tidy::misc clang-tidy checks are organized into modules. This refactoring moves the misc module checks into the namespace clang::tidy::misc http://reviews.llvm.org/D7996 Patch by Richard Thomson! llvm-svn: 230950
* [clang-tidy] Assert related checkersAlexander Kornienko2015-03-026-0/+349
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch contains two assert related checkers. These checkers are the part of those that is being open sourced by Ericsson (http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-December/040520.html). The checkers: AssertSideEffect: /// \brief Finds \c assert() with side effect. /// /// The conition of \c assert() is evaluated only in debug builds so a condition /// with side effect can cause different behaviour in debug / relesase builds. StaticAssert: /// \brief Replaces \c assert() with \c static_assert() if the condition is /// evaluatable at compile time. /// /// The condition of \c static_assert() is evaluated at compile time which is /// safer and more efficient. http://reviews.llvm.org/D7375 Patch by Szabolcs Sipos! llvm-svn: 230943
* [clang-tidy] Various improvements in misc-use-overrideAlexander Kornienko2015-02-271-6/+24
| | | | | | | | | | | * Better error message when more than one of 'virtual', 'override' and 'final' is present ("X is/are redundant since the function is already declared Y"). * Convert the messages to the style used in Clang diagnostics: lower case initial letter, no trailing period. * Don't run the check for files compiled in pre-C++11 mode (http://llvm.org/PR22638). llvm-svn: 230765
* [clang-tidy] Fixed a false positive case in misc-inaccurate-erase checker.Gabor Horvath2015-02-251-2/+2
| | | | llvm-svn: 230483
* [clang-tidy] Fixed two wrong fix-it cases in misc-inefficient-algorithm checker.Gabor Horvath2015-02-171-2/+19
| | | | llvm-svn: 229552
* [clang-tidy] Fixed a false positive case in misc-inefficient-algorithm checker.Gabor Horvath2015-02-121-2/+2
| | | | llvm-svn: 228945
* [clang-tidy] Checker for inaccurate use of erase() method.Gabor Horvath2015-02-104-0/+104
| | | | | | | | | | | | | | Algorithms like remove() does not actually remove any element from the container but returns an iterator to the first redundant element at the end of the container. These redundant elements must be removed using the erase() method. This check warns when not all of the elements will be removed due to using an inappropriate overload. Reviewer: alexfh Differential Revision: http://reviews.llvm.org/D7496 llvm-svn: 228679
* Verify assign operator signatures.Samuel Benzaquen2015-02-094-0/+106
| | | | | | | | | | | | Summary: Warn when the return type of assign operators is not Class&. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6667 llvm-svn: 228583
* [clang-tidy] Checker for inefficient use of algorithms on associative containersGabor Horvath2015-02-074-0/+148
| | | | | | | | | | | | | | | | | Summary: Associative containers implements some of the algorithms as methods which should be preferred to the algorithms in the algorithm header. The methods can take advantage of the order of the elements. Reviewers: alexfh Reviewed By: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D7246 llvm-svn: 228505
* [cleanup] Re-sort the #include lines with llvm/utils/sort_includes.pyChandler Carruth2015-01-141-1/+1
| | | | | | | No functionality changed, this is just a mechanical cleanup to keep the order of #include lines consistent across the project. llvm-svn: 225976
* clang-tidy: [misc-use-override] Fix 'override' insertion.Daniel Jasper2015-01-091-9/+23
| | | | | | | | | | Before: void f() __attribute__((override unused)) After: void f() override __attribute__((unused)) llvm-svn: 225519
* [clang-tidy] Add clang-tidy check for unique_ptr's reset+release -> moveAlexander Kornienko2014-12-054-0/+108
| | | | | | | | | | | Replace x.reset(y.release()); with x = std::move(y); If y is rvalue, replace with x = y; instead. http://reviews.llvm.org/D6485 Patch by Alexey Sokolov! llvm-svn: 223460
* clang-tidy: Add override before the first attribute.Daniel Jasper2014-11-251-2/+4
| | | | | | Apparently attributes aren't sorted by source location. llvm-svn: 222751
* [clang-tidy] Bring order to check registration.Alexander Kornienko2014-10-262-13/+0
| | | | | | | | | | | | | | | | Summary: Register readability checks in a separate module. Renamed the checks and test file names accordingly. Reviewers: djasper, klimek Reviewed By: klimek Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D5936 llvm-svn: 220631
* [clang-tidy] Move some of the misc checks to readability/Alexander Kornienko2014-10-158-630/+11
| | | | | | | | | | | | | | | | | | | Summary: Some of the misc checks belong to readability/. I'm moving them there without changing check names for now. As the next step, I want to register some of these checks in the google and llvm modules with suitable settings (e.g. BracesAroundStatementsCheck). I'm not sure if we want to create a "readability" module, probably not. Reviewers: djasper Reviewed By: djasper Subscribers: curdeius, cfe-commits Differential Revision: http://reviews.llvm.org/D5792 llvm-svn: 219786
* [clang-tidy] misc-braces-around-statements.ShortStatementLines optionAlexander Kornienko2014-10-132-7/+45
| | | | | | | | | | | | | | | | Add option ShortStatementLines to trigger this check only if the statement spans over at least a given number of lines. Modifications from the original patch: merged test/clang-tidy/misc-braces-around-statements-always.cpp into test/clang-tidy/misc-braces-around-statements.cpp and removed unnecessary CHECK-NOTs from the tests. http://reviews.llvm.org/D5642 Patch by Marek Kurdej! llvm-svn: 219611
* [clang-tidy] Add check misc-braces-around-statements.Alexander Kornienko2014-10-024-0/+280
| | | | | | | | | | | | | | | | | | | | | | | | | | | This check looks for if statements and loops: for, range-for, while and do-while, and verifies that the inside statements are inside braces '{}'. If not, proposes to add braces around them. Example: if (condition) action(); becomes if (condition) { action(); } This check ought to be used with the -format option, so that the braces be well-formatted. Patch by Marek Kurdej! http://reviews.llvm.org/D5395 llvm-svn: 218898
* [clang-tidy] Add a checker for long functions.Benjamin Kramer2014-09-154-0/+153
| | | | | | | | | | | | | | | | As this is very dependent on the code base it has some ways of configuration. It's possible to pick between 3 modes of operation: - Line counting: number of lines including whitespace and comments - Statement counting: number of statements within compoundStmts. - Branch counter In addition a threshold can be picked, warnings are only emitted when it is met. The thresholds can be configured via a .clang-tidy file. Differential Revision: http://reviews.llvm.org/D4986 llvm-svn: 217768
OpenPOWER on IntegriCloud