summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/misc
Commit message (Collapse)AuthorAgeFilesLines
* Using an early return as it is more clear; NFC.Aaron Ballman2015-08-311-24/+24
| | | | llvm-svn: 246444
* [clang-tidy] Move misc-use-override and readability-shrink-to-fit to ↵Alexander Kornienko2015-08-314-232/+0
| | | | | | | | | "modernize/" These checks are focusing on migrating the code from C++98/03 to C++11, so they belong to the modernize module. llvm-svn: 246437
* Updated to make use of the AST matcher instead of a custom matcher; NFC.Aaron Ballman2015-08-281-4/+0
| | | | llvm-svn: 246325
* Disable clang-tidy misc checkers when not compiling in C++ mode. Many of the ↵Aaron Ballman2015-08-2811-146/+200
| | | | | | checkers do not require additional testing as the tests will not compile for other languages or modes, or the checkers would never match a valid construct. llvm-svn: 246318
* [clang-tidy] Update docs for clang-tidy checks. NFCAlexander Kornienko2015-08-2719-59/+83
| | | | | | | | | | | Changes mostly address formatting and unification of the style. Use MarkDown style for inline code snippets and lists. Added some text for a few checks. The idea is to move most of the documentation out to separate rST files and have implementation files refer to the corresponding documentation files. llvm-svn: 246169
* Add a new clang-tidy check (misc-move-constructor-init) that diagnoses move ↵Aaron Ballman2015-08-204-0/+113
| | | | | | constructor initializations that call copy constructors instead of move constructors. llvm-svn: 245571
* Insert override at the same line as the end of the function declarationEhsan Akhgari2015-08-191-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The existing check converts the code pattern below: void f() { } to: void f() override { } which is fairly sub-optimal. This patch fixes this by inserting the override keyword on the same line as the function declaration if possible, so that we instead get: void f() override { } We do this by looking for the last token before the start of the body and inserting the override keyword at the end of its location. Note that we handle const, volatile and ref-qualifiers correctly. Test Plan: Includes an automated test. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D9286 llvm-svn: 245401
* [clang-tidy] Fixed typos and formatting in a comment. NFCAlexander Kornienko2015-08-181-5/+5
| | | | llvm-svn: 245310
* 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
* [clang-tidy] Improve the misc-unused-alias-decl messageAlexander Kornienko2015-08-032-3/+4
| | | | | | "this namespace alias decl is unused" -> "namespace alias decl '...' is unused" llvm-svn: 243906
* Replace callback-if with isExpansionInMainFile as suggested in postDaniel Jasper2015-08-031-6/+4
| | | | | | commit review. llvm-svn: 243871
* Add missing 'override'.Daniel Jasper2015-07-311-1/+1
| | | | llvm-svn: 243773
* 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
OpenPOWER on IntegriCloud