summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/docs/clang-tidy
Commit message (Collapse)AuthorAgeFilesLines
...
* Support virtual-near-miss check.Alexander Kornienko2016-01-132-0/+18
| | | | | | | | | | | | | | Summary: Virtual function override near miss detection. Function complete. Test complete. Do not conduct Fix for now. Reviewers: alexfh Subscribers: cfe-commits Patch by Cong Liu! Differential Revision: http://reviews.llvm.org/D15823 llvm-svn: 257599
* Add documentation redirects for clang-tidy checkers that are exposed under ↵Aaron Ballman2016-01-1113-0/+73
| | | | | | multiple checker names. Updates the Python script for adding checks to properly handle these aliases. llvm-svn: 257347
* [clang-tidy] Add non-inline function definition and variable definition ↵Alexander Kornienko2016-01-082-0/+38
| | | | | | | | | | | | | | | | check in header files. Summary: The new check will find all functionand variable definitions which may violate cpp one definition rule in header file. Reviewers: aaron.ballman, alexfh Subscribers: aaron.ballman, cfe-commits Patch by Haojian Wu! Differential Revision: http://reviews.llvm.org/D15710 llvm-svn: 257178
* [clang-tidy] Fix capitalization of the message in the exampleAlexander Kornienko2015-12-291-1/+1
| | | | llvm-svn: 256559
* Renaming CERT documentation files to use the CERT rule identifiers. This is ↵Aaron Ballman2015-12-275-4/+4
| | | | | | for consistency with other checkers, where the documentation file name matches the checker name. NFC of the checkers. llvm-svn: 256474
* [clang-tidy] Added documentation for modernize-redundant-void-argAlexander Kornienko2015-12-222-0/+19
| | | | llvm-svn: 256261
* [clang-tidy] Updates to documentation: formatting, titles, etc.Alexander Kornienko2015-12-2276-9/+166
| | | | llvm-svn: 256259
* [clang-tidy] Check for suspicious string assignments.Gabor Horvath2015-12-152-0/+32
| | | | | | | | | | | It is possible to assign arbitrary integer types to strings. Sometimes it is the result of missing to_string call or apostrophes. Reviewers: alexfh Differential Revision: http://reviews.llvm.org/D15411 llvm-svn: 255630
* [clang-tidy] add check cppcoreguidelines-pro-bounds-constant-array-indexMatthias Gehre2015-12-132-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is http://reviews.llvm.org/D13746 but instead of including <array>, a stub is provided. This check flags all array subscriptions on static arrays and std::arrays that either have a non-compile-time-constant index or are out of bounds. Dynamic accesses into arrays are difficult for both tools and humans to validate as safe. array_view is a bounds-checked, safe type for accessing arrays of data. at() is another alternative that ensures single accesses are bounds-checked. If iterators are needed to access an array, use the iterators from an array_view constructed over the array. This rule is part of the "Bounds safety" profile of the C++ Core Guidelines, see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-bounds2-only-index-into-arrays-using-constant-expressions Reviewers: alexfh, sbenza, bkramer, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D15030 llvm-svn: 255470
* Add a new checker, cert-err58-cpp, that checks for static or thread_local ↵Aaron Ballman2015-12-012-1/+11
| | | | | | | | objects that use a throwing constructor. This check corresponds to the CERT secure coding rule: https://www.securecoding.cert.org/confluence/display/cplusplus/ERR58-CPP.+Constructors+of+objects+with+static+or+thread+storage+duration+must+not+throw+exceptions llvm-svn: 254415
* Revert r253401, "[clang-tidy] add check ↵NAKAMURA Takumi2015-11-182-14/+0
| | | | | | | | cppcoreguidelines-pro-bounds-constant-array-index" cppcoreguidelines-pro-bounds-constant-array-index.cpp is failing in several hosts. llvm-svn: 253428
* [clang-tidy] add check cppcoreguidelines-pro-bounds-constant-array-indexMatthias Gehre2015-11-172-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This check flags all array subscriptions on static arrays and std::arrays that either have a non-compile-time-constant index or are out of bounds. Dynamic accesses into arrays are difficult for both tools and humans to validate as safe. array_view is a bounds-checked, safe type for accessing arrays of data. at() is another alternative that ensures single accesses are bounds-checked. If iterators are needed to access an array, use the iterators from an array_view constructed over the array. This rule is part of the "Bounds safety" profile of the C++ Core Guidelines, see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-bounds2-only-index-into-arrays-using-constant-expressions Reviewers: alexfh, sbenza, bkramer, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13746 llvm-svn: 253401
* Add a new clang-tidy checker that flags throw expressions whose thrown type ↵Aaron Ballman2015-11-162-0/+10
| | | | | | | | is not nothrow copy constructible. While the compiler is free to elide copy constructor calls in some cases, it is under no obligation to do so, which makes the code a portability concern as well as a security concern. This checker corresponds to the CERT secure coding rule: https://www.securecoding.cert.org/confluence/display/cplusplus/ERR60-CPP.+Exception+objects+must+be+nothrow+copy+constructible llvm-svn: 253246
* Rewording some of this documentation to describe the check instead of try to ↵Aaron Ballman2015-11-092-10/+3
| | | | | | rationalize the behavior of the check. The links already provide sufficient rationale. llvm-svn: 252496
* [clang-tidy] add new check cppcoreguidelines-pro-type-cstyle-castMatthias Gehre2015-11-082-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This check flags all use of c-style casts that perform a static_cast downcast, const_cast, or reinterpret_cast. Use of these casts can violate type safety and cause the program to access a variable that is actually of type X to be accessed as if it were of an unrelated type Z. Note that a C-style (T)expression cast means to perform the first of the following that is possible: a const_cast, a static_cast, a static_cast followed by a const_cast, a reinterpret_cast, or a reinterpret_cast followed by a const_cast. This rule bans (T)expression only when used to perform an unsafe cast. This rule is part of the "Type safety" profile of the C++ Core Guidelines, see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type4-dont-use-c-style-texpression-casts-that-would-perform-a-static_cast-downcast-const_cast-or-reinterpret_cast. Reviewers: alexfh, sbenza, bkramer, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D14096 llvm-svn: 252425
* [clang-tidy] Add new check cppcoreguidelines-pro-bounds-array-to-pointer-decayMatthias Gehre2015-10-262-0/+10
| | | | | | | | | | | | | | | | | | | | Summary: This check flags all array to pointer decays. Pointers should not be used as arrays. array_view is a bounds-checked, safe alternative to using pointers to access arrays. This rule is part of the "Bounds safety" profile of the C++ Core Guidelines, see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-bounds3-no-array-to-pointer-decay Reviewers: alexfh, sbenza, bkramer, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13640 llvm-svn: 251358
* [clang-tidy] Add check readability-implicit-bool-castPiotr Dziwinski2015-10-252-0/+98
| | | | | | | | | | | | | | | | | | | | | Summary: This is another check that I ported to clang-tidy from colobot-lint tool. As previously discussed on cfe-dev mailing list, this is one of those checks that I think is general and useful enough for contribution to clang-tidy. This patch contains implementation of check taken from colobot-lint, but it is extended a great deal, including FixIt hints for automated refactoring, exhaustive testcases, and user documentation. Reviewers: sbenza, aaron.ballman, alexfh Subscribers: Eugene.Zelenko Differential Revision: http://reviews.llvm.org/D13635 llvm-svn: 251235
* [clang-tidy] add check cppcoreguidelines-pro-type-varargMatthias Gehre2015-10-212-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This check flags all calls to c-style vararg functions and all use of va_list, va_start and va_arg. Passing to varargs assumes the correct type will be read. This is fragile because it cannot generally be enforced to be safe in the language and so relies on programmer discipline to get it right. This rule is part of the "Type safety" profile of the C++ Core Guidelines, see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type8-avoid-reading-from-varargs-or-passing-vararg-arguments-prefer-variadic-template-parameters-instead This commits also reverts "[clang-tidy] add cert's VariadicFunctionDefCheck as cppcoreguidelines-pro-type-vararg-def" because that check makes the SFINAE use of vararg functions impossible. Reviewers: alexfh, sbenza, bkramer, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13787 llvm-svn: 250939
* Add modernize-use-default check to clang-tidy.Angel Garcia Gomez2015-10-212-0/+28
| | | | | | | | | | | | | | | | | | | Summary: Add a check that replaces empty bodies of special member functions with '= default;'. For now, it is only implemented for the default constructor and the destructor, which are the easier cases. The copy-constructor and the copy-assignment operator cases will be implemented later. I applied this check to the llvm code base and found 627 warnings (385 in llvm, 9 in compiler-rt, 220 in clang and 13 in clang-tools-extra). Applying the fixes didn't break any build or test, it only caused a -Wpedantic warning in lib/Target/Mips/MipsOptionRecord.h:33 becaused it replaced virtual ~MipsOptionRecord(){}; to virtual ~MipsOptionRecord()= default;; Reviewers: klimek Subscribers: george.burgess.iv, Eugene.Zelenko, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13871 llvm-svn: 250897
* Added check uniqueptr-delete-release to replace "delete x.release()" with "x ↵Samuel Benzaquen2015-10-192-0/+6
| | | | | | | | | | = nullptr" Reviewers: alexfh Differential Revision: http://reviews.llvm.org/D13179 llvm-svn: 250742
* [clang-tidy] add check cppcoreguidelines-pro-type-union-accessMatthias Gehre2015-10-162-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This check flags all access to members of unions. Passing unions as a whole is not flagged. Reading from a union member assumes that member was the last one written, and writing to a union member assumes another member with a nontrivial destructor had its destructor called. This is fragile because it cannot generally be enforced to be safe in the language and so relies on programmer discipline to get it right. This rule is part of the "Type safety" profile of the C++ Core Guidelines, see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type7-avoid-accessing-members-of-raw-unions-prefer-variant-instead Reviewers: alexfh, sbenza, bkramer, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13784 llvm-svn: 250537
* Updating the documentation for the ↵Aaron Ballman2015-10-131-2/+13
| | | | | | | | readability-inconsistent-declaration-parameter-name checker. Patch by Piotr Dziwinski. llvm-svn: 250194
* [clang-tidy] new check cppcoreguidelines-pro-bounds-pointer-arithmeticMatthias Gehre2015-10-122-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This check flags all usage of pointer arithmetic, because it could lead to an invalid pointer. Subtraction of two pointers is not flagged by this check. Pointers should only refer to single objects, and pointer arithmetic is fragile and easy to get wrong. array_view is a bounds-checked, safe type for accessing arrays of data. This rule is part of the "Bounds safety" profile of the C++ Core Guidelines, see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-bounds1-dont-use-pointer-arithmetic-use-array_view-instead Depends on D13313 Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13311 llvm-svn: 250116
* [clang-tidy] add check cppcoreguidelines-pro-type-static-cast-downcastMatthias Gehre2015-10-122-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This check flags all usages of static_cast, where a base class is casted to a derived class. In those cases, a fixit is provided to convert the cast to a dynamic_cast. Use of these casts can violate type safety and cause the program to access a variable that is actually of type X to be accessed as if it were of an unrelated type Z. This rule is part of the "Type safety" profile of the C++ Core Guidelines, see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-type2-dont-use-static_cast-downcasts-use-dynamic_cast-instead Depends on D13313 Reviewers: alexfh, sbenza, bkramer, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13368 llvm-svn: 250098
* Added documentation for misc-throw-by-value-catch-by-reference.Aaron Ballman2015-10-122-0/+12
| | | | | | Patch by Tobias Langner. llvm-svn: 250034
* Adding a checker (cert-err52-cpp) that detects use of setjmp or longjmp in ↵Aaron Ballman2015-10-082-0/+12
| | | | | | C++ code. Corresponds to the CERT C++ secure coding rule: https://www.securecoding.cert.org/confluence/pages/viewpage.action?pageId=1834 llvm-svn: 249727
* Add checker for the C++ Core Guidelines: cppcoreguidelines-pro-type-const-cast.Aaron Ballman2015-10-072-0/+10
| | | | | | Patch by Matthias Gehre! llvm-svn: 249540
* Improved the misc-move-constructor-init check to identify arguments that are ↵Aaron Ballman2015-10-061-0/+3
| | | | | | | | passed by value but copy assigned to class data members when the non-deleted move constructor is a better fit. Patch by Felix Berger! llvm-svn: 249429
* Add a new module for the C++ Core Guidelines, and the first checker for ↵Aaron Ballman2015-10-062-0/+10
| | | | | | | | those guidelines: cppcoreguidelines-pro-type-reinterpret-cast. Patch by Matthias Gehre! llvm-svn: 249399
* Adding a checker (cert-dcl50-cpp) that detects the definition of a C-style ↵Aaron Ballman2015-10-052-0/+14
| | | | | | variadic function in C++ code. Corresponds to the CERT C++ secure coding rule: https://www.securecoding.cert.org/confluence/display/cplusplus/DCL50-CPP.+Do+not+define+a+C-style+variadic+function llvm-svn: 249343
* Update clang-tidy documentation.Angel Garcia Gomez2015-10-013-0/+49
| | | | | | | | | | | | | | Summary: Improve modernize-use-auto documentation (https://llvm.org/bugs/show_bug.cgi?id=24962). Add documentation for modernize-make-unique. Reviewers: klimek Subscribers: cfe-commits, alexfh Differential Revision: http://reviews.llvm.org/D13346 llvm-svn: 249017
* Adding a checker (misc-non-copyable-objects) that detects situations where a ↵Aaron Ballman2015-09-302-0/+10
| | | | | | 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-292-0/+15
| | | | | | 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] Removed a stray empty line in the docs.Alexander Kornienko2015-09-281-1/+0
| | | | llvm-svn: 248699
* [clang-tidy] Updated misc-unused-raii documentation.Alexander Kornienko2015-09-251-6/+4
| | | | llvm-svn: 248594
* Replace references to "transform" with references to "check" where ↵Angel Garcia Gomez2015-09-215-54/+36
| | | | | | | | | | | | | | neccessary in the documentation. Summary: Replace references to "transform" with references to "check" where neccessary in the documentation. Reviewers: alexfh Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D13006 llvm-svn: 248153
* [clang-tidy] Fixed formatting of headings in the docs.Alexander Kornienko2015-09-214-18/+18
| | | | llvm-svn: 248151
* Update clang-tidy documentation.Angel Garcia Gomez2015-09-185-17/+646
| | | | | | | | | | Summary: Update documentation of the modernize module with clang-modernize's documentation. Subscribers: cfe-commits, klimek, alexfh Differential Revision: http://reviews.llvm.org/D12961 llvm-svn: 247987
* [clang-tidy] Added a style guide link.Alexander Kornienko2015-09-161-0/+3
| | | | llvm-svn: 247798
* [clang-tidy] updated misc-sizeof-container docs.Alexander Kornienko2015-09-141-2/+7
| | | | llvm-svn: 247580
* [clang-tidy] Add misc-sizeof-container check to find sizeof() uses on stlAlexander Kornienko2015-09-102-1/+22
| | | | | | | | | | | | | | | | 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] Add inconsistent declaration parameter name checkAlexander Kornienko2015-09-102-0/+33
| | | | | | | | | | | | | | | | | | | | This is first of series of patches, porting code from my project colobot-lint, as I mentioned recently in cfe-dev mailing list. This patch adds a new check in readability module: readability-inconsistent-declaration-parameter-name. I also added appropriate testcases and documentation. I chose readability module, as it seems it is the best place for it. I think I followed the rules of LLVM coding guideline, but I may have missed something, as I usually use other code formatting style. http://reviews.llvm.org/D12462 Patch by Piotr Dziwinski! llvm-svn: 247261
* [clang-tidy] Updated docs.Alexander Kornienko2015-09-083-1/+36
| | | | llvm-svn: 246996
* [clang-tidy] Updated the check name in the doc.Alexander Kornienko2015-09-021-2/+2
| | | | llvm-svn: 246643
* [clang-tidy] Move misc-use-override and readability-shrink-to-fit to ↵Alexander Kornienko2015-08-314-9/+15
| | | | | | | | | "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
* [clang-tidy] Move clang-tidy docs to a separate directory. Create doc files ↵Alexander Kornienko2015-08-2753-0/+1276
for checks The doc files for checks have been generated from the corresponding header files using the docs/clang-tidy/tools/dump_check_docs.py script. Committing the script as well, but the intention is to move all the user-facing docs from header files to the rST files and add links to .h files appropriately. llvm-svn: 246173
OpenPOWER on IntegriCloud