summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/docs/clang-tidy
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang-tidy] Add a close-on-exec check on inotify_init1() in Android module.Chih-Hung Hsieh2017-08-142-0/+19
| | | | | | | | | Summary: inotify_init1() is better to set IN_CLOEXEC flag to avoid file descriptor leakage. Differential Revision: https://reviews.llvm.org/D35368 llvm-svn: 310863
* [clang-tidy] Add a close-on-exec check on inotify_init() in Android module.Chih-Hung Hsieh2017-08-142-0/+18
| | | | | | | | | Summary: inotify_init() is better to be replaced by inotify_init1() with IN_CLOEXEC flag to avoid file descriptor leakage. Differential Revision: https://reviews.llvm.org/D35370 llvm-svn: 310861
* [clang-tidy] Add a close-on-exec check on dup() in Android module.Chih-Hung Hsieh2017-08-142-0/+19
| | | | | | | | | Summary: dup() is better to be replaced by fcntl() to avoid file descriptor leakage. Differential Revision: https://reviews.llvm.org/D35364 llvm-svn: 310858
* Add hicpp-exception-baseclass to the HIC++ module.Aaron Ballman2017-08-112-0/+31
| | | | | | | | This enforces that throwing an exception in C++ requires that exception to inherit from std::exception. Patch by Jonas Toth. llvm-svn: 310727
* Implement hicpp-braces-around-statements as an alias to ↵Aaron Ballman2017-08-112-0/+12
| | | | | | | | readability-braces-around-statements. Patch by Jonas Toth. llvm-svn: 310707
* [clang-tidy] Fix for buildbot.Yan Wang2017-08-102-0/+19
| | | | | | | | | Summary: Fix an issue for windows. Differential Revision: https://reviews.llvm.org/D35372 llvm-svn: 310669
* Revert "[clang-tidy] Refactor the code and add a close-on-exec check on ↵Reid Kleckner2017-08-102-19/+0
| | | | | | | | | | | | memfd_create() in Android module." This reverts commit r310630. The new code broke on Windows and was untested. On Linux, it was selecting the "int" overload of operator<<, which definitely does not print the right thing when fed a "Mode" char. llvm-svn: 310661
* [clang-tidy] Refactor the code and add a close-on-exec check on ↵Yan Wang2017-08-102-0/+19
| | | | | | | | | | | | | | | | | | | | memfd_create() in Android module. Summary: 1. Refactor the structure of the code by adding a base class for all close-on-exec checks, which implements most of the needed functions. 2. memfd_create() is better to set MFD_CLOEXEC flag to avoid file descriptor leakage. Reviewers: alexfh, aaron.ballman, hokein Reviewed By: alexfh, hokein Subscribers: Eugene.Zelenko, chh, cfe-commits, srhines, mgorny, JDevlieghere, xazax.hun Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D35372 llvm-svn: 310630
* [clang-tidy] Add integer division checkGabor Horvath2017-08-102-0/+40
| | | | | | | | Patch by: Reka Nikolett Kovacs Differential Revision: https://reviews.llvm.org/D35932 llvm-svn: 310589
* [clang-tidy] Updated docs and release notes for r310584Alexander Kornienko2017-08-101-0/+12
| | | | llvm-svn: 310587
* [clang-tidy] Fix an error in the doc.Haojian Wu2017-08-101-1/+2
| | | | llvm-svn: 310578
* [clang-tidy] add forwarders in the aliased checks from hicpp moduleHaojian Wu2017-08-1013-24/+48
| | | | | | | | | | | | | | | | Summary: Adds redirections notes and the actual redirections in the documentation for hicpp Patch by: Jonas Toth Reviewers: aaron.ballman, hokein, alexfh Reviewed By: aaron.ballman, hokein Subscribers: JDevlieghere, xazax.hun Differential Revision: https://reviews.llvm.org/D36355 llvm-svn: 310577
* [clang-tidy] Minor documentation improvementGabor Horvath2017-08-101-0/+1
| | | | | | Patch by: Lilla Barancsuk llvm-svn: 310559
* [clang-tidy] Add missing doc in ↵Haojian Wu2017-08-102-0/+10
| | | | | | cppcoreguidelines-c-copy-assignment-signature check. llvm-svn: 310558
* [clang-tidy] Add new readability non-idiomatic static access checkGabor Horvath2017-08-082-0/+31
| | | | | | | | Patch by: Lilla Barancsuk Differential Revision: https://reviews.llvm.org/D35937 llvm-svn: 310371
* [clang-tidy] 'implicit cast' -> 'implicit conversion'Alexander Kornienko2017-08-085-142/+167
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch renames checks, check options and changes messages to use correct term "implicit conversion" instead of "implicit cast" (which has been in use in Clang AST since ~10 years, but it's still technically incorrect w.r.t. C++ standard). * performance-implicit-cast-in-loop -> performance-implicit-conversion-in-loop * readability-implicit-bool-cast -> readability-implicit-bool-conversion - readability-implicit-bool-cast.AllowConditionalIntegerCasts -> readability-implicit-bool-conversion.AllowIntegerConditions - readability-implicit-bool-cast.AllowConditionalPointerCasts -> readability-implicit-bool-conversion.AllowPointerConditions Reviewers: hokein, jdennett Reviewed By: hokein Subscribers: mgorny, JDevlieghere, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D36456 llvm-svn: 310366
* [clang-tidy] Add missing documents for "IgnoreMacros" option.Haojian Wu2017-08-044-0/+29
| | | | llvm-svn: 310051
* [clang-tidy] Ignore macros in make-unique check.Haojian Wu2017-08-041-0/+5
| | | | | | | | | | | | | | | | Summary: The check doesn't fully support smart-ptr usages inside macros, which may cause incorrect fixes, or even crashes, ignore them for now. Reviewers: alexfh Reviewed By: alexfh Subscribers: JDevlieghere, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D36264 llvm-svn: 310050
* [clang-tidy] Minor documentation fix. NFC.Gabor Horvath2017-07-141-1/+1
| | | | llvm-svn: 308022
* [clang-tidy] Add bugprone-undefined-memory-manipulation checkGabor Horvath2017-07-142-0/+8
| | | | | | | | Patch by: Reka Nikolett Kovacs Differential Revision: https://reviews.llvm.org/D35051 llvm-svn: 308021
* [clang-tidy] Add bugprone-suspicious-memset-usage checkGabor Horvath2017-07-144-11/+56
| | | | | | | | | | | | | | | | | | Created new module bugprone and placed the check in that. Finds memset() calls with potential mistakes in their arguments. Replaces and extends the existing google-runtime-memset-zero-length check. Cases covered: * Fill value is a character '0'. Integer 0 might have been intended. * Fill value is out of char range and gets truncated. * Byte count is zero. Potentially swapped with the fill value argument. Patch by: Reka Nikolett Kovacs Differential Revision: https://reviews.llvm.org/D32700 llvm-svn: 308020
* [clang-tidy] Add a new Android check "android-cloexec-socket"Yan Wang2017-07-122-0/+19
| | | | | | | | | | | | | | | | Summary: socket() is better to include SOCK_CLOEXEC in its type argument to avoid the file descriptor leakage. Reviewers: chh, Eugene.Zelenko, alexfh, hokein, aaron.ballman Reviewed By: chh, alexfh Subscribers: srhines, mgorny, JDevlieghere, xazax.hun, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D34913 llvm-svn: 307818
* [clang-tidy] Add new modernize use unary assert checkGabor Horvath2017-07-122-0/+26
| | | | | | | | Patch by: Lilla Barancsuk Differential Revision: https://reviews.llvm.org/D35257 llvm-svn: 307791
* [clang-tidy] Add "MakeSmartPtrFunction" option to ↵Haojian Wu2017-07-052-0/+36
| | | | | | | | | | | | | | modernize-make-shared/unique checks. Reviewers: alexfh, aaron.ballman Reviewed By: alexfh Subscribers: JDevlieghere, Eugene.Zelenko, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D34206 llvm-svn: 307130
* Fix some typos in the docSylvestre Ledru2017-06-292-9/+9
| | | | llvm-svn: 306750
* [clang-tidy] Rename android-file-open-flag and fix a bugYan Wang2017-06-292-4/+4
| | | | | | | | | | | | | | | | | | Summary: 1. Rename android-file-open-flag to android-cloexec-open. 2. Handle a case when the function is passed as an argument of a function-like macro. Reviewers: chh Reviewed By: chh Subscribers: srhines, mgorny, JDevlieghere, xazax.hun, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D34633 llvm-svn: 306728
* [clang-tidy] Add docs to toctreeYan Wang2017-06-291-0/+2
| | | | | | | | | | | | | | Summary: Add .rst files to toctree. Fix buildbot error. Reviewers: chh Reviewed By: chh Subscribers: srhines, JDevlieghere, xazax.hun Differential Revision: https://reviews.llvm.org/D34825 llvm-svn: 306719
* [clang-tidy][Part3] Add a new module Android and three new checks.Yan Wang2017-06-291-0/+18
| | | | | | | | | | | | | | | | Summary: -- fopen() should include "e" in their mode string. [android-fopen-mode] Reviewers: chh, alexfh, aaron.ballman, hokein Reviewed By: hokein Subscribers: JDevlieghere, srhines, mgorny, xazax.hun Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D33747 llvm-svn: 306709
* [clang-tidy][Part2] Add a new module Android and three new checksYan Wang2017-06-291-0/+16
| | | | | | | | | | | | | | | | Summary: -- creat() should be replaced by open(). [android-creat-usage] Reviewers: chh, alexfh, aaron.ballman, hokein Reviewed By: hokein Subscribers: JDevlieghere, srhines, mgorny, xazax.hun Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D33745 llvm-svn: 306708
* [clang-tidy] follow-up on misc-definitions-in-header check.Haojian Wu2017-06-291-0/+2
| | | | | | | | | | | | | | | | | Summary: A follow-up on D34449: * add `-std=c++11` to `.hpp` file by default. * add constexpr function to test and doc. Reviewers: alexfh Reviewed By: alexfh Subscribers: JDevlieghere, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D34771 llvm-svn: 306650
* [clang-tidy] Enable inline variable definitions in headersGabor Horvath2017-06-281-0/+8
| | | | | | Differential Revision: https://reviews.llvm.org/D34449 llvm-svn: 306538
* Remove the script dump_check_docs.py. It was a one-shot migration script.Sylvestre Ledru2017-06-261-79/+0
| | | | | | Sign off from Alexander Kornienko by email llvm-svn: 306263
* [clang-tidy][Part1] Add a new module Android and three new checks.Yan Wang2017-06-233-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: A common source of security bugs is code that opens a file descriptors without using the O_CLOEXEC flag. (Without that flag, an opened sensitive file would remain open across a fork+exec to a lower-privileged SELinux domain, leaking that sensitive data.). Add a new Android module and one checks in clang-tidy. -- open(), openat(), and open64() should include O_CLOEXEC in their flags argument. [android-file-open-flag] Links to part2 and part3: https://reviews.llvm.org/D33745 https://reviews.llvm.org/D33747 Reviewers: chh, alexfh, aaron.ballman, hokein Reviewed By: alexfh, hokein Subscribers: jbcoe, joerg, malcolm.parsons, Eugene.Zelenko, srhines, mgorny, xazax.hun, cfe-commits, krytarowski Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D33304 llvm-svn: 306165
* [clang-tidy] readability-function-size: add NestingThreshold param.Roman Lebedev2017-06-091-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Finds compound statements which create next nesting level after `NestingThreshold` and emits a warning. Do note that it warns about each compound statement that breaches the threshold, but not any of it's sub-statements, to have readable warnings. I was able to find only one coding style referencing nesting: - https://www.kernel.org/doc/html/v4.10/process/coding-style.html#indentation > In short, 8-char indents make things easier to read, and have the added benefit of warning you when you’re nesting your functions too deep. This seems too basic, i'm not sure what else to test. Are more tests needed? Reviewers: alexfh, aaron.ballman, sbenza Reviewed By: alexfh, aaron.ballman Subscribers: xazax.hun Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D32942 llvm-svn: 305082
* [clang-tidy] New checker to replace dynamic exception specificationsAlexander Kornienko2017-06-082-0/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: New checker to replace dynamic exception specifications This is an alternative to D18575 which relied on reparsing the decl to find the location of dynamic exception specifications, but couldn't deal with preprocessor conditionals correctly without reparsing the entire file. This approach uses D20428 to find dynamic exception specification locations and handles all cases correctly. Reviewers: aaron.ballman, alexfh Reviewed By: aaron.ballman, alexfh Subscribers: xazax.hun, mgehre, malcolm.parsons, mgorny, JDevlieghere, cfe-commits, Eugene.Zelenko, etienneb Patch by Don Hinton! Differential Revision: https://reviews.llvm.org/D20693 llvm-svn: 304977
* [clang-tidy] check for __func__/__FUNCTION__ in lambdasAlexander Kornienko2017-06-022-0/+28
| | | | | | | | | | | | Add a clang-tidy check for using func__/FUNCTION__ inside lambdas. This evaluates to the string operator(), which is almost never useful and almost certainly not what the author intended. Patch by Bryce Liu! Differential Revision: https://reviews.llvm.org/D33497 llvm-svn: 304570
* [Documentation] Mention hicpp check group in Clang-tidy main document.Eugene Zelenko2017-05-251-2/+3
| | | | llvm-svn: 303884
* [clang-tidy] Add "emplace_back" detection in inefficient-vector-operation.Haojian Wu2017-05-161-3/+3
| | | | | | | | | | | | | | Reviewers: alexfh, aaron.ballman Reviewed By: alexfh Subscribers: cfe-commits, Prazek, malcolm.parsons, xazax.hun Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D33209 llvm-svn: 303157
* [clang-tidy] modernize-use-emplace: Remove unnecessary make_tuple callsJakub Kuderski2017-05-161-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch makes modernize-use-emplace remove unnecessary make_ calls from push_back calls and turn them into emplace_back -- the same way make_pair calls are handled. Custom make_ calls can be removed for custom tuple-like types -- two new options that control that are `TupleTypes` and `TupleMakeFunctions`. By default, the check removes calls to `std::make_pair` and `std::make_tuple`. Eq. ``` std::vector<std::tuple<int, char, bool>> v; v.push_back(std::make_tuple(1, 'A', true)); // --> v.emplace_back(1, 'A', true); ``` Reviewers: alexfh, aaron.ballman, Prazek, hokein Reviewed By: Prazek Subscribers: JDevlieghere, xazax.hun, JonasToth, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D32690 llvm-svn: 303145
* Revert "[clang-tidy] modernize-use-emplace: Remove unnecessary make_tuple calls"Jakub Kuderski2017-05-161-34/+0
| | | | | | This reverts commit r303139. The commit made docs build emit a warning. llvm-svn: 303140
* [clang-tidy] modernize-use-emplace: Remove unnecessary make_tuple callsJakub Kuderski2017-05-161-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch makes modernize-use-emplace remove unnecessary make_ calls from push_back calls and turn them into emplace_back -- the same way make_pair calls are handled. Custom make_ calls can be removed for custom tuple-like types -- two new options that control that are `TupleTypes` and `TupleMakeFunctions`. By default, the check removes calls to `std::make_pair` and `std::make_tuple`. Eq. ``` std::vector<std::tuple<int, char, bool>> v; v.push_back(std::make_tuple(1, 'A', true)); // --> v.emplace_back(1, 'A', true); ``` Reviewers: alexfh, aaron.ballman, Prazek, hokein Reviewed By: Prazek Subscribers: JDevlieghere, xazax.hun, JonasToth, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D32690 llvm-svn: 303139
* [clang-tidy] Add new cert-dcl21-cpp check Gabor Horvath2017-05-102-0/+13
| | | | | | | | | This check flags postfix operator++/-- declarations, where the return type is not a const object. Differential Revision: https://reviews.llvm.org/D32743 llvm-svn: 302637
* clang-tidy: add IgnoreMacros option to modernize-use-default-member-initMiklos Vajna2017-05-081-0/+5
| | | | | | | | | | | | | | | | | | | Summary: And also enable it by default to be consistent with e.g. modernize-use-using. This helps e.g. when running this check on cppunit client code where the macro is provided by the system, so there is no easy way to modify it. Reviewers: alexfh, malcolm.parsons Reviewed By: malcolm.parsons Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D32945 llvm-svn: 302429
* [clang-tidy] modernize-use-emplace: remove unnecessary make_pair callsJakub Kuderski2017-04-281-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When there is a push_back with a call to make_pair, turn it into emplace_back and remove the unnecessary make_pair call. Eg. ``` std::vector<std::pair<int, int>> v; v.push_back(std::make_pair(1, 2)); // --> v.emplace_back(1, 2); ``` make_pair doesn't get removed when explicit template parameters are provided, because of potential problems with type conversions. Reviewers: Prazek, aaron.ballman, hokein, alexfh Reviewed By: Prazek, alexfh Subscribers: JDevlieghere, JonasToth, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D32395 llvm-svn: 301651
* [clang-tidy] Support detecting for-range loop in ↵Haojian Wu2017-04-261-4/+33
| | | | | | | | | | | | | | | | | | inefficient-vector-operation check. Summary: Also add an option "VectorLikeClasses" allowing user specify customized vectors. Reviewers: alexfh, aaron.ballman Reviewed By: alexfh Subscribers: Eugene.Zelenko, cfe-commits Differential Revision: https://reviews.llvm.org/D32436 llvm-svn: 301440
* [clang-tidy] New check: modernize-replace-random-shuffle.Mads Ravn2017-04-242-0/+29
| | | | | | | | | | | | | | | | | | | | | | This check will find occurrences of ``std::random_shuffle`` and replace it with ``std::shuffle``. In C++17 ``std::random_shuffle`` will no longer be available and thus we need to replace it. Example of case that it fixes ``` std::vector<int> v; // First example std::random_shuffle(vec.begin(), vec.end()); ``` Reviewers: hokein, aaron.ballman, alexfh, malcolm.parsons, mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D30158 llvm-svn: 301167
* [clang-tidy] Add a clang-tidy check for possible inefficient vector operationsHaojian Wu2017-04-182-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The "performance-inefficient-vector-operation" check finds vector oprations in for-loop statements which may cause multiple memory reallocations. This is the first version, only detects typical for-loop: ``` std::vector<int> v; for (int i = 0; i < n; ++i) { v.push_back(i); } // or for (int i = 0; i < v2.size(); ++i) { v.push_back(v2[i]); } ``` We can extend it to handle more cases like for-range loop in the future. Reviewers: alexfh, aaron.ballman Reviewed By: aaron.ballman Subscribers: zaks.anna, Eugene.Zelenko, mgorny, cfe-commits, djasper Differential Revision: https://reviews.llvm.org/D31757 llvm-svn: 300534
* Add the definition of P in the clang tidy exampleSylvestre Ledru2017-04-111-0/+2
| | | | llvm-svn: 299961
* Add more examples to clang tidy checkersSylvestre Ledru2017-04-117-0/+81
| | | | | | | | | | | | | | Reviewers: alexfh Reviewed By: alexfh Subscribers: cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D31860 llvm-svn: 299920
* [clang-tidy] Update docs and help messageAlexander Kornienko2017-04-061-4/+4
| | | | llvm-svn: 299651
OpenPOWER on IntegriCloud