summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/misc/CMakeLists.txt
Commit message (Collapse)AuthorAgeFilesLines
...
* Adding a checker (misc-non-copyable-objects) that detects situations where a ↵Aaron Ballman2015-09-301-0/+1
| | | | | | non-copyable C type is being dereferenced, such as FILE or pthread_mutex_t. Corresponds to the CERT C++ secure coding rule: https://www.securecoding.cert.org/confluence/display/c/FIO38-C.+Do+not+copy+a+FILE+object llvm-svn: 248907
* Adding a checker (misc-new-delete-overloads) that detects mismatched ↵Aaron Ballman2015-09-291-0/+1
| | | | | | overloads of operator new and operator delete. Corresponds to the CERT C++ secure coding rule: https://www.securecoding.cert.org/confluence/display/cplusplus/DCL54-CPP.+Overload+allocation+and+deallocation+functions+as+a+pair+in+the+same+scope llvm-svn: 248791
* [clang-tidy] Add misc-sizeof-container check to find sizeof() uses on stlAlexander Kornienko2015-09-101-0/+1
| | | | | | | | | | | | | | | | containers. Summary: sizeof(some_std_string) is likely to be an error. This check finds this pattern and suggests using .size() instead. Reviewers: djasper, klimek, aaron.ballman Subscribers: aaron.ballman, cfe-commits Differential Revision: http://reviews.llvm.org/D12759 llvm-svn: 247297
* [clang-tidy] Move misc-use-override and readability-shrink-to-fit to ↵Alexander Kornienko2015-08-311-1/+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
* Add a new clang-tidy check (misc-move-constructor-init) that diagnoses move ↵Aaron Ballman2015-08-201-0/+1
| | | | | | constructor initializations that call copy constructors instead of move constructors. llvm-svn: 245571
* Add misc-unused-alias-decls check that currently finds unused namespaceDaniel Jasper2015-07-311-0/+1
| | | | | | | alias declarations. In the future, we might want to reuse it to also fine unsed using declarations and such. llvm-svn: 243754
* Initial version of clang-tidy check to find and fix unused parameters.Daniel Jasper2015-07-201-0/+1
| | | | | | Also see: llvm.org/PR24180. llvm-svn: 242654
* clang-tidy: Add checker that warn when macro argument with side effects is ↵Daniel Marjamaki2015-06-171-0/+1
| | | | | | repeated in the macro llvm-svn: 239909
* clang-tidy: Add checker that warns about missing parentheses in macrosDaniel Marjamaki2015-06-161-0/+1
| | | | | | | * calculations in the replacement list should be inside parentheses * macro arguments should be inside parentheses llvm-svn: 239820
* [clang-tidy] Renamed misc-noexcept-move-ctors to misc-noexcept-move-constructorAlexander Kornienko2015-05-271-1/+1
| | | | llvm-svn: 238326
* Add a clang-tidy check for move constructors/assignment ops without noexcept.Alexander Kornienko2015-05-221-0/+1
| | | | | | | | | | | | | | | | | | 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] Refactor: Rename clang-tidy misc check files and classes to ↵Alexander Kornienko2015-03-091-4/+4
| | | | | | | | | | | | | 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] Assert related checkersAlexander Kornienko2015-03-021-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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] Checker for inaccurate use of erase() method.Gabor Horvath2015-02-101-0/+1
| | | | | | | | | | | | | | 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-091-0/+1
| | | | | | | | | | | | 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-071-0/+1
| | | | | | | | | | | | | | | | | 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
* [clang-tidy] Add clang-tidy check for unique_ptr's reset+release -> moveAlexander Kornienko2014-12-051-0/+1
| | | | | | | | | | | 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] Bring order to check registration.Alexander Kornienko2014-10-261-2/+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-151-3/+2
| | | | | | | | | | | | | | | | | | | 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] Add check misc-braces-around-statements.Alexander Kornienko2014-10-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-151-0/+1
| | | | | | | | | | | | | | | | 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
* [clang-tidy] Add a checker for code that looks like a delegate constructors ↵Benjamin Kramer2014-07-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | but doesn't delegate. Summary: class Foo { Foo() { Foo(42); // oops } Foo(int); }; This is valid code but it does nothing and we can't emit a warning in clang because there might be side effects. The checker emits a warning for this pattern and also for base class initializers written in this style. There is some overlap with the unused-rtti checker but they follow different goals and fire in different places most of the time. Reviewers: alexfh, djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4667 llvm-svn: 214397
* Reapply r213647 with a fix.Benjamin Kramer2014-07-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | ASTMatchers currently have problems mixing bound TypeLoc nodes with Decl/Stmt nodes. That should be fixed soon but for this checker there we only need the TypeLoc to generate a fixit so postpone the potentially heavyweight AST walking until after we know that we're going to emit a warning. This is covered by existing test cases. Original message: [clang-tidy] Add a check for RAII temporaries. This tries to find code similar that immediately destroys an object that looks like it's trying to follow RAII. { scoped_lock(&global_mutex); critical_section(); } This checker will have false positives if someone uses this pattern to legitimately invoke a destructor immediately (or the statement is at the end of a scope anyway). To reduce the number we ignore this pattern in macros (this is heavily used by gtest) and ignore objects with no user-defined destructor. llvm-svn: 213738
* Revert r213647; the added test triggers an assertion.Richard Smith2014-07-231-1/+0
| | | | llvm-svn: 213722
* [clang-tidy] Add a check for RAII temporaries.Benjamin Kramer2014-07-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This tries to find code similar that immediately destroys an object that looks like it's trying to follow RAII. { scoped_lock(&global_mutex); critical_section(); } This checker will have false positives if someone uses this pattern to legitimately invoke a destructor immediately (or the statement is at the end of a scope anyway). To reduce the number we ignore this pattern in macros (this is heavily used by gtest) and ignore objects with no user-defined destructor. Reviewers: alexfh, djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4615 llvm-svn: 213647
* [clang-tidy] Add a checker for swapped arguments.Benjamin Kramer2014-07-141-0/+1
| | | | | | | | | This looks for swapped arguments by looking at implicit conversions of arguments void Foo(int, double); Foo(1.0, 3); // Most likely a bug llvm-svn: 212942
* [CMake] Update libdeps.NAKAMURA Takumi2014-07-141-0/+1
| | | | llvm-svn: 212920
* [clang-tidy] Add a checker for implicit bool conversion of a bool*.Benjamin Kramer2014-07-111-0/+1
| | | | | | | | | | | | | | | | | The goal is to find code like the example below, which is likely a typo where someone meant to write "if (*b)". bool *b = SomeFunction(); if (b) { // b never dereferenced } This checker naturally has a relatively high false positive rate so it applies some heuristics to avoid cases where the pointer is checked for nullptr before being written. Differential Revision: http://reviews.llvm.org/D4458 llvm-svn: 212797
* Initial version of clang-tidy check to use override instead of virual.Daniel Jasper2014-05-161-0/+1
| | | | | Review: http://reviews.llvm.org/D3688 llvm-svn: 208954
* Add clang-tidy check to remove redundant .get() calls on smart pointers.Samuel Benzaquen2014-03-271-0/+1
| | | | | | | | | | | | | | | Summary: This check finds and removes redundant .get() calls on smart pointers. Example: ptr.get()->Foo() ==> ptr->Foo() Reviewers: alexfh CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3186 llvm-svn: 204947
* Add an argument comment checker to clang-tidy.Peter Collingbourne2014-03-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This checks that parameters named in comments that appear before arguments in function and constructor calls match the parameter name used in the callee's declaration. For example: void f(int x, int y); void g() { f(/*y=*/0, /*z=*/0); } contains two violations of the policy, as the names 'x' and 'y' used in the declaration do not match names 'y' and 'z' used at the call site. I think there is significant value in being able to check/enforce this policy as a way of guarding against accidental API misuse and silent breakages caused by API changes. Although this pattern appears somewhat frequently in the LLVM codebase, this policy is not prescribed by the LLVM coding standards at the moment, so it lives under 'misc'. Differential Revision: http://llvm-reviews.chandlerc.com/D2914 llvm-svn: 204113
* Added a module for checks not related to LLVM or Google coding style.Alexander Kornienko2014-03-051-0/+11
llvm-svn: 202970
OpenPOWER on IntegriCloud