Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5 |
|
#
8dc7db7a |
| 25-Apr-2024 |
Bhuminjay Soni <Soni5Happy@gmail.com> |
[clang-tidy] Add clang-tidy check readability-math-missing-parentheses (#84481)
This commit closes #80850 where author suggests adding a
readability check to detect missing parentheses around mathe
[clang-tidy] Add clang-tidy check readability-math-missing-parentheses (#84481)
This commit closes #80850 where author suggests adding a
readability check to detect missing parentheses around mathematical
expressions when operators of different priorities are used.
Signed-off-by: 11happy <soni5happy@gmail.com>
show more ...
|
Revision tags: llvmorg-18.1.4, llvmorg-18.1.3 |
|
#
3365d621 |
| 01-Apr-2024 |
Congcong Cai <congcongcai0907@163.com> |
[clang-tidy] add new check readability-enum-initial-value (#86129)
Fixes: #85243.
|
Revision tags: llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2 |
|
#
c13e271a |
| 06-Feb-2024 |
Bhuminjay Soni <Soni5Happy@gmail.com> |
Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (#77816)
This pull request fixes #64914 where author suggests adding a
readability check to propose the r
Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (#77816)
This pull request fixes #64914 where author suggests adding a
readability check to propose the replacement of conditional statements
with std::min/std::max for improved code readability. Additionally,
reference is made to PyLint's similar checks:
[consider-using-min-builtin](https://pylint.pycqa.org/en/latest/user_guide/messages/refactor/consider-using-min-builtin.html)
and
[consider-using-max-builtin](https://pylint.pycqa.org/en/latest/user_guide/messages/refactor/consider-using-max-builtin.html)
show more ...
|
Revision tags: llvmorg-18.1.0-rc1, llvmorg-19-init |
|
#
7a8f5d97 |
| 20-Jan-2024 |
Félix-Antoine Constantin <60141446+felix642@users.noreply.github.com> |
[clang-tidy] Added new check to detect redundant inline keyword (#73069)
This checks find usages of the inline keywork where it is already
implicitly defined by the compiler and suggests it's remov
[clang-tidy] Added new check to detect redundant inline keyword (#73069)
This checks find usages of the inline keywork where it is already
implicitly defined by the compiler and suggests it's removal.
Fixes #72397
show more ...
|
#
1ad1f981 |
| 20-Jan-2024 |
Piotr Zegar <piotr.zegar@nokia.com> |
[clang-tidy] Add readability-redundant-casting check (#70595)
Detects explicit type casting operations that involve the same source
and destination types, and subsequently recommend their removal.
[clang-tidy] Add readability-redundant-casting check (#70595)
Detects explicit type casting operations that involve the same source
and destination types, and subsequently recommend their removal. Covers
a range of explicit casting operations. Its primary objective is to
enhance code readability and maintainability by eliminating unnecessary
type casting.
Closes #67534
show more ...
|
#
8e21557d |
| 15-Jan-2024 |
Congcong Cai <congcongcai0907@163.com> |
[clang-tidy]Add new check readability-avoid-nested-conditional-operator (#78022)
Finds nested conditional operator.
Nested conditional operators lead code hard to understand, so they
should be spl
[clang-tidy]Add new check readability-avoid-nested-conditional-operator (#78022)
Finds nested conditional operator.
Nested conditional operators lead code hard to understand, so they
should be splited as several statement and stored in temporary varibale.
show more ...
|
#
a89141f7 |
| 05-Jan-2024 |
Danny Mösch <danny.moesch@icloud.com> |
[clang-tidy] Add check `readability-avoid-return-with-void-value` (#76249)
|
Revision tags: llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2 |
|
#
87d0aeda |
| 29-Jul-2023 |
Piotr Zegar <piotr.zegar@nokia.com> |
[clang-tidy] Add readability-reference-to-constructed-temporary check
Detects code where a temporary object is directly constructed by calling a constructor or using an initializer list and immediat
[clang-tidy] Add readability-reference-to-constructed-temporary check
Detects code where a temporary object is directly constructed by calling a constructor or using an initializer list and immediately assigned to a reference variable.
Reviewed By: xgupta
Differential Revision: https://reviews.llvm.org/D146368
show more ...
|
Revision tags: llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1 |
|
#
a0848542 |
| 31-Mar-2023 |
Piotr Zegar <piotr.zegar@nokia.com> |
[clang-tidy] Add readability-operators-representation check
Check helps enforce consistent token representation for binary, unary and overloaded operators in C++ code. The check supports both tradit
[clang-tidy] Add readability-operators-representation check
Check helps enforce consistent token representation for binary, unary and overloaded operators in C++ code. The check supports both traditional and alternative representations of operators.
Reviewed By: carlosgalvezp
Differential Revision: https://reviews.llvm.org/D144522
show more ...
|
#
52296f5e |
| 26-Mar-2023 |
Piotr Zegar <piotr.zegar@nokia.com> |
[clang-tidy] Add readability-avoid-unconditional-preprocessor-if check
Check flags always enabled or disabled code blocks in preprocessor '#if' conditions, such as '#if 0' and '#if 1' etc.
Reviewed
[clang-tidy] Add readability-avoid-unconditional-preprocessor-if check
Check flags always enabled or disabled code blocks in preprocessor '#if' conditions, such as '#if 0' and '#if 1' etc.
Reviewed By: carlosgalvezp
Differential Revision: https://reviews.llvm.org/D145617
show more ...
|
Revision tags: llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init |
|
#
7d2ea6c4 |
| 14-Jan-2023 |
Carlos Galvez <carlosgalvezp@gmail.com> |
[clang-tidy][NFC] Use C++17 nested namespaces in the clang-tidy folder
Fix applied by running:
run-clang-tidy.py -checks=-*,modernize-concat-nested-namespaces
Differential Revision: https://review
[clang-tidy][NFC] Use C++17 nested namespaces in the clang-tidy folder
Fix applied by running:
run-clang-tidy.py -checks=-*,modernize-concat-nested-namespaces
Differential Revision: https://reviews.llvm.org/D141770
show more ...
|
Revision tags: llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1 |
|
#
3696c70e |
| 27-Oct-2021 |
Adrian Vogelsgesang <avogelsgesang@tableau.com> |
[clang-tidy] Add `readability-container-contains` check
This commit introduces a new check `readability-container-contains` which finds usages of `container.count()` and `container.find() != contain
[clang-tidy] Add `readability-container-contains` check
This commit introduces a new check `readability-container-contains` which finds usages of `container.count()` and `container.find() != container.end()` and instead recommends the `container.contains()` method introduced in C++20.
For containers which permit multiple entries per key (`multimap`, `multiset`, ...), `contains` is more efficient than `count` because `count` has to do unnecessary additional work.
While this this performance difference does not exist for containers with only a single entry per key (`map`, `unordered_map`, ...), `contains` still conveys the intent better.
Reviewed By: xazax.hun, whisperity
Differential Revision: http://reviews.llvm.org/D112646
show more ...
|
#
d2e8fb33 |
| 02-Jan-2022 |
Richard <legalize@xmission.com> |
[clang-tidy] Add readability-duplicate-include check
Looks for duplicate includes and removes them.
Every time an include directive is processed, check a vector of filenames to see if the included
[clang-tidy] Add readability-duplicate-include check
Looks for duplicate includes and removes them.
Every time an include directive is processed, check a vector of filenames to see if the included file has already been included. If so, it issues a warning and a replacement to remove the entire line containing the duplicated include directive.
When a macro is defined or undefined, the vector of filenames is cleared. This enables including the same file multiple times, but getting different expansions based on the set of active macros at the time of inclusion. For example:
#undef NDEBUG #include "assertion.h" // ...code with assertions enabled
#define NDEBUG #include "assertion.h" // ...code with assertions disabled
Since macros are redefined between the inclusion of assertion.h, they are not flagged as redundant.
Differential Revision: https://reviews.llvm.org/D7982
show more ...
|
Revision tags: llvmorg-13.0.0, llvmorg-13.0.0-rc4 |
|
#
d249200f |
| 15-Sep-2021 |
Saleem Abdulrasool <compnerd@compnerd.org> |
Revert "Re-Revert "clang-tidy: introduce readability-containter-data-pointer check""
This reverts commit 626586fc253c6f032aedb325dba6b1ff3f11875e.
Tweak the test for Windows. Windows defaults to d
Revert "Re-Revert "clang-tidy: introduce readability-containter-data-pointer check""
This reverts commit 626586fc253c6f032aedb325dba6b1ff3f11875e.
Tweak the test for Windows. Windows defaults to delayed template parsing, which resulted in the main template definition not registering the test on Windows. Process the file with the additional `-fno-delayed-template-parsing` flag to change the default beahviour. Additionally, add an extra check for the fix it and use a more robust test to ensure that the value is always evaluated.
Differential Revision: https://reviews.llvm.org/D108893
show more ...
|
#
626586fc |
| 15-Sep-2021 |
Nico Weber <thakis@chromium.org> |
Re-Revert "clang-tidy: introduce readability-containter-data-pointer check"
This reverts commit 49992c04148e5327bef9bd2dff53a0d46004b4b4. The test is still failing on Windows, see comments on https:
Re-Revert "clang-tidy: introduce readability-containter-data-pointer check"
This reverts commit 49992c04148e5327bef9bd2dff53a0d46004b4b4. The test is still failing on Windows, see comments on https://reviews.llvm.org/D108893
show more ...
|
#
49992c04 |
| 14-Sep-2021 |
Saleem Abdulrasool <compnerd@compnerd.org> |
Revert "Revert "clang-tidy: introduce readability-containter-data-pointer check""
This reverts commit 76dc8ac36d07cebe8cfe8fe757323562bb36df94.
Restore the change. The test had an incorrect negati
Revert "Revert "clang-tidy: introduce readability-containter-data-pointer check""
This reverts commit 76dc8ac36d07cebe8cfe8fe757323562bb36df94.
Restore the change. The test had an incorrect negative from testing. The test is expected to trigger a failure as mentioned in the review comments. This corrects the test and should resolve the failure.
show more ...
|
#
76dc8ac3 |
| 14-Sep-2021 |
Nico Weber <thakis@chromium.org> |
Revert "clang-tidy: introduce readability-containter-data-pointer check"
This reverts commit d0d9e6f0849b2e76e980e2edf365302f47f4e35f. Breaks tests, see e.g. https://lab.llvm.org/buildbot/#/builders
Revert "clang-tidy: introduce readability-containter-data-pointer check"
This reverts commit d0d9e6f0849b2e76e980e2edf365302f47f4e35f. Breaks tests, see e.g. https://lab.llvm.org/buildbot/#/builders/188/builds/3326
show more ...
|
Revision tags: llvmorg-13.0.0-rc3 |
|
#
d0d9e6f0 |
| 29-Aug-2021 |
Saleem Abdulrasool <compnerd@compnerd.org> |
clang-tidy: introduce readability-containter-data-pointer check
This introduces a new check, readability-containter-data-pointer. This check is meant to catch the cases where the user may be trying
clang-tidy: introduce readability-containter-data-pointer check
This introduces a new check, readability-containter-data-pointer. This check is meant to catch the cases where the user may be trying to materialize the data pointer by taking the address of the 0-th member of a container. With C++11 or newer, the `data` member should be used for this. This provides the following benefits:
- `.data()` is easier to read than `&[0]` - it avoids an unnecessary re-materialization of the pointer * this doesn't matter in the case of optimized code, but in the case of unoptimized code, this will be visible - it avoids a potential invalid memory de-reference caused by the indexing when the container is empty (in debug mode, clang will normally optimize away the re-materialization in optimized builds).
The small potential behavioural change raises the question of where the check should belong. A reasoning of defense in depth applies here, and this does an unchecked conversion, with the assumption that users can use the static analyzer to catch cases where we can statically identify an invalid memory de-reference. For the cases where the static analysis is unable to prove the size of the container, UBSan can be used to track the invalid access.
Special thanks to Aaron Ballmann for the discussion on whether this check would be useful and where to place it.
This also partially resolves PR26817!
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D108893
show more ...
|
Revision tags: llvmorg-13.0.0-rc2 |
|
#
d2c5cbc3 |
| 12-Aug-2021 |
Florin Iucha <florin@signbit.net> |
Add a check for enforcing minimum length for variable names
Add a check for enforcing minimum length for variable names. A default minimum length of three characters is applied to regular variables
Add a check for enforcing minimum length for variable names
Add a check for enforcing minimum length for variable names. A default minimum length of three characters is applied to regular variables (including function parameters). Loop counters and exception variables have a minimum of two characters. Additionally, the 'i', 'j' and 'k' are accepted as legacy values.
All three sizes, as well as the list of accepted legacy loop counter names are configurable.
show more ...
|
Revision tags: llvmorg-13.0.0-rc1, llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2, llvmorg-12.0.1-rc1, llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4, llvmorg-12.0.0-rc3, llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1, llvmorg-11.0.1, llvmorg-11.0.1-rc2, llvmorg-11.0.1-rc1, llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3, llvmorg-11.0.0-rc2, llvmorg-11.0.0-rc1, llvmorg-12-init, llvmorg-10.0.1, llvmorg-10.0.1-rc4, llvmorg-10.0.1-rc3, llvmorg-10.0.1-rc2, llvmorg-10.0.1-rc1, llvmorg-10.0.0, llvmorg-10.0.0-rc6, llvmorg-10.0.0-rc5, llvmorg-10.0.0-rc4, llvmorg-10.0.0-rc3, llvmorg-10.0.0-rc2, llvmorg-10.0.0-rc1, llvmorg-11-init, llvmorg-9.0.1, llvmorg-9.0.1-rc3, llvmorg-9.0.1-rc2, llvmorg-9.0.1-rc1, llvmorg-9.0.0, llvmorg-9.0.0-rc6, llvmorg-9.0.0-rc5, llvmorg-9.0.0-rc4, llvmorg-9.0.0-rc3, llvmorg-9.0.0-rc2, llvmorg-9.0.0-rc1, llvmorg-10-init, llvmorg-8.0.1, llvmorg-8.0.1-rc4, llvmorg-8.0.1-rc3, llvmorg-8.0.1-rc2, llvmorg-8.0.1-rc1, llvmorg-8.0.0, llvmorg-8.0.0-rc5, llvmorg-8.0.0-rc4, llvmorg-8.0.0-rc3, llvmorg-7.1.0, llvmorg-7.1.0-rc1, llvmorg-8.0.0-rc2, llvmorg-8.0.0-rc1, llvmorg-7.0.1, llvmorg-7.0.1-rc3, llvmorg-7.0.1-rc2, llvmorg-7.0.1-rc1, llvmorg-7.0.0, llvmorg-7.0.0-rc3, llvmorg-7.0.0-rc2, llvmorg-7.0.0-rc1, llvmorg-6.0.1, llvmorg-6.0.1-rc3, llvmorg-6.0.1-rc2, llvmorg-6.0.1-rc1, llvmorg-5.0.2, llvmorg-5.0.2-rc2, llvmorg-5.0.2-rc1, llvmorg-6.0.0, llvmorg-6.0.0-rc3, llvmorg-6.0.0-rc2, llvmorg-6.0.0-rc1, llvmorg-5.0.1, llvmorg-5.0.1-rc3, llvmorg-5.0.1-rc2, llvmorg-5.0.1-rc1 |
|
#
73e4b5cf |
| 05-Sep-2017 |
Whisperity <whisperity@gmail.com> |
[clang-tidy] Add 'readability-suspicious-call-argument' check
Finds function calls where the call arguments might be provided in an incorrect order, based on the comparison (via string metrics) of t
[clang-tidy] Add 'readability-suspicious-call-argument' check
Finds function calls where the call arguments might be provided in an incorrect order, based on the comparison (via string metrics) of the parameter names and the argument names against each other.
A diagnostic is emitted if an argument name is similar to a *different* parameter than the one currently passed to, and it is sufficiently dissimilar to the one it **is** passed to currently.
False-positive warnings from this check are useful to indicate bad naming convention issues, even if a swap isn't necessary. This check does not generate FixIts.
Originally implemented by @varjujan as his Master's Thesis work. The check was subsequently taken over by @barancsuk who added type conformity checks to silence false positive matches. The work by @whisperity involved driving the check's review and fixing some more bugs in the process.
Reviewed By: aaron.ballman, alexfh
Differential Revision: http://reviews.llvm.org/D20689
Co-authored-by: János Varjú <varjujanos2@gmail.com> Co-authored-by: Lilla Barancsuk <barancsuklilla@gmail.com>
show more ...
|
#
9a5af541 |
| 16-Mar-2021 |
Nathan James <n.james93@hotmail.co.uk> |
[clang-tidy] Remove readability-deleted-default
The deprecation notice was cherrypicked to the release branch in https://github.com/llvm/llvm-project/commit/f8b32989241cca87a8690c8cc404f06ce1f90e4c
[clang-tidy] Remove readability-deleted-default
The deprecation notice was cherrypicked to the release branch in https://github.com/llvm/llvm-project/commit/f8b32989241cca87a8690c8cc404f06ce1f90e4c so its safe to remove this for the 13.X release cycle.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D98612
show more ...
|
Revision tags: llvmorg-5.0.0, llvmorg-5.0.0-rc5, llvmorg-5.0.0-rc4, llvmorg-5.0.0-rc3 |
|
#
ace64403 |
| 17-Aug-2017 |
Roman Lebedev <lebedev.ri@gmail.com> |
[clang-tidy] Implement readability-function-cognitive-complexity check
Currently, there is basically just one clang-tidy check to impose some sanity limits on functions - `clang-tidy-readability-fun
[clang-tidy] Implement readability-function-cognitive-complexity check
Currently, there is basically just one clang-tidy check to impose some sanity limits on functions - `clang-tidy-readability-function-size`. It is nice, allows to limit line count, total number of statements, number of branches, number of function parameters (not counting implicit `this`), nesting level.
However, those are simple generic metrics. It is still trivially possible to write a function, which does not violate any of these metrics, yet is still rather unreadable.
Thus, some additional, slightly more complicated metric is needed. There is a well-known [[ https://en.wikipedia.org/wiki/Cyclomatic_complexity | Cyclomatic complexity]], but certainly has its downsides. And there is a [[ https://www.sonarsource.com/docs/CognitiveComplexity.pdf | COGNITIVE COMPLEXITY by SonarSource ]], which is available for opensource on https://sonarcloud.io/.
This check checks function Cognitive Complexity metric, and flags the functions with Cognitive Complexity exceeding the configured limit. The default limit is `25`, same as in 'upstream'.
The metric is implemented as per [[ https://www.sonarsource.com/docs/CognitiveComplexity.pdf | COGNITIVE COMPLEXITY by SonarSource ]] specification version 1.2 (19 April 2017), with two notable exceptions: * `preprocessor conditionals` (`#ifdef`, `#if`, `#elif`, `#else`, `#endif`) are not accounted for. Could be done. Currently, upstream does not account for them either. * `each method in a recursion cycle` is not accounted for. It can't be fully implemented, because cross-translational-unit analysis would be needed, which is not possible in clang-tidy. Thus, at least right now, i completely avoided implementing it.
There are some further possible improvements: * Are GNU statement expressions (`BinaryConditionalOperator`) really free? They should probably cause nesting level increase, and complexity level increase when they are nested within eachother. * Microsoft SEH support * ???
Reviewed By: aaron.ballman, JonasToth, lattner
Differential Revision: https://reviews.llvm.org/D36836
show more ...
|
#
add51e15 |
| 02-Oct-2019 |
Matthias Gehre <gehre.matthias@gmail.com> |
[clang-tidy] add new check readability-use-anyofallof
Summary: Finds range-based for loops that can be replaced by a call to ``std::any_of`` or ``std::all_of``. In C++ 20 mode, suggests ``std::range
[clang-tidy] add new check readability-use-anyofallof
Summary: Finds range-based for loops that can be replaced by a call to ``std::any_of`` or ``std::all_of``. In C++ 20 mode, suggests ``std::ranges::any_of`` or ``std::ranges::all_of``. For now, no fixits are produced.
Reviewers: aaron.ballman, alexfh, hokein
Subscribers: mgorny, xazax.hun, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D77572
show more ...
|
#
36fcbb83 |
| 14-Jan-2020 |
Nathan James <n.james93@hotmail.co.uk> |
Added readability-qualified-auto check
Adds a check that detects any auto variables that are deduced to a pointer or a const pointer then adds in the const and asterisk according. Will also check au
Added readability-qualified-auto check
Adds a check that detects any auto variables that are deduced to a pointer or a const pointer then adds in the const and asterisk according. Will also check auto L value references that could be written as const. This relates to the coding standard https://llvm.org/docs/CodingStandards.html#beware-unnecessary-copies-with-auto
show more ...
|
#
24130d66 |
| 22-Sep-2019 |
Matthias Gehre <gehre.matthias@gmail.com> |
[clang-tidy] Add readability-make-member-function-const
Summary: Finds non-static member functions that can be made ``const`` because the functions don't use ``this`` in a non-const way.
The check
[clang-tidy] Add readability-make-member-function-const
Summary: Finds non-static member functions that can be made ``const`` because the functions don't use ``this`` in a non-const way.
The check conservatively tries to preserve logical costness in favor of physical costness. See readability-make-member-function-const.rst for more details.
Reviewers: aaron.ballman, gribozavr, hokein, alexfh
Subscribers: mgorny, xazax.hun, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D68074
show more ...
|