summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang-tidy] Use proper capitalization and punctuation for diagnostic messages.Alexander Kornienko2016-01-086-10/+10
| | | | | | Use diagnostic parameters where possible instead of string concatenation. llvm-svn: 257176
* Rename the CERT namespace to cert, and update some checkers to use this ↵Aaron Ballman2016-01-049-10/+20
| | | | | | | | namespace consistently. Patch thanks to Haojian Wu! llvm-svn: 256756
* [clang-tidy] Don't use delegating constructorsAlexander Kornienko2015-12-301-1/+2
| | | | llvm-svn: 256637
* [clang-tidy] Use hasLocalStorage() to identify unnecessary copy ↵Alexander Kornienko2015-12-301-2/+1
| | | | | | | | | | | | | | initializations to exclude static local variables. Summary: Since local static variables can outlive other local variables exclude them from the unnecessary copy initialization check. Reviewers: alexfh Patch by Felix Berger! Differential Revision: http://reviews.llvm.org/D15822 llvm-svn: 256636
* [clang-tidy] Add the missing MakefileAlexander Kornienko2015-12-301-0/+12
| | | | llvm-svn: 256634
* [clang-tidy] Fix configure buildAlexander Kornienko2015-12-301-1/+2
| | | | llvm-svn: 256633
* [clang-tidy] Add UnnecessaryCopyInitialization check to new "performance" ↵Alexander Kornienko2015-12-3011-1/+241
| | | | | | | | | | | | | | | | | | | module in ClangTidy Summary: The patch adds a new ClangTidy check that detects when expensive-to-copy types are unnecessarily copy initialized from a const reference that has the same or are larger scope than the copy. It currently only detects this when the copied variable is const qualified. But this will be extended to non const variables if they are only used in a const fashion. Reviewers: alexfh Subscribers: cfe-commits Patch by Felix Berger! Differential Revision: http://reviews.llvm.org/D15623 llvm-svn: 256632
* [clang-tidy] Fix a use-after-free bug found by asanAlexander Kornienko2015-12-291-2/+3
| | | | llvm-svn: 256562
* [clang-tidy] Don't generate duplicated blank line in add_new_check.py script.Alexander Kornienko2015-12-291-2/+0
| | | | | | | | | | | | Reviewers: alexfh Subscribers: cfe-commits Patch by Haojian Wu! Differential Revision: http://reviews.llvm.org/D15803 llvm-svn: 256554
* [clang-tidy] Fix a false positive case in ContainerSizeEmpty check.Gabor Horvath2015-12-281-4/+9
| | | | llvm-svn: 256504
* [clang-tidy] Preserve comments and preprocessor directives when simplifying ↵Alexander Kornienko2015-12-282-39/+72
| | | | | | | | | | | | | | | | | | boolean expressions This changeset still emits the diagnostic that the expression could be simplified, but it doesn't generate any fix-its that would lose comments or preprocessor directives within the text that would be replaced. Fixes PR25842 Reviewers: alexfh Subscribers: xazax.hun, cfe-commits Patch by Richard Thomson! (+a naming style fix) Differential Revision: http://reviews.llvm.org/D15737 llvm-svn: 256492
* Renaming CERT documentation files to use the CERT rule identifiers. This is ↵Aaron Ballman2015-12-274-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] Updates to documentation: formatting, titles, etc.Alexander Kornienko2015-12-221-1/+3
| | | | llvm-svn: 256259
* Fix a false positive case in ContainerSizeEmpty check (PR25893).Gabor Horvath2015-12-211-0/+5
| | | | llvm-svn: 256142
* [clang-tidy] google-readability-namespace-comments: ignore stray semicolonsAlexander Kornienko2015-12-161-1/+2
| | | | llvm-svn: 255772
* [clang-tidy] Add namespace support to add_new_check.pyAlexander Kornienko2015-12-161-4/+10
| | | | | | | | | | | | | | Summary: Without namespace you can not create checks with same name in different modules Reviewers: alexfh Subscribers: cfe-commits Patch by Cong Liu! Differential Revision: http://reviews.llvm.org/D15571 llvm-svn: 255770
* [clang-tidy] Don't use diag() for debug outputAlexander Kornienko2015-12-161-11/+3
| | | | llvm-svn: 255765
* [clang-tidy] Fix a crash in misc-new-delete-overloadsAlexander Kornienko2015-12-161-42/+39
| | | | llvm-svn: 255758
* [clang-tidy] Check for suspicious string assignments.Gabor Horvath2015-12-154-0/+123
| | | | | | | | | | | 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-134-0/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [clang-tidy] Fix PR25812.Gabor Horvath2015-12-121-25/+26
| | | | llvm-svn: 255431
* Add a license clarification for use of links and titles of CERT secure ↵Aaron Ballman2015-12-101-0/+22
| | | | | | coding guidelines. llvm-svn: 255248
* [clang-tidy] Sort includes case-sensitively.Alexander Kornienko2015-12-101-4/+1
| | | | | | | | | The motivation is: 1. consistency with clang-format, vim :sort etc. 2. we don't want the tools to depend on the current locale to do the include sorting llvm-svn: 255243
* clang-tidy readability identifiers: better diagnostic locationMike Aizatsky2015-12-041-1/+1
| | | | | | | | | | | | Summary: With this change the error reported is on the identifier location itself. It was declaration location before. Reviewers: alexfh Differential Revision: http://reviews.llvm.org/D15203 llvm-svn: 254766
* Replace the custom AST matcher for nothrow functions with the canonical AST ↵Aaron Ballman2015-12-023-18/+2
| | | | | | matcher from r254516. llvm-svn: 254517
* Add a new checker, cert-err58-cpp, that checks for static or thread_local ↵Aaron Ballman2015-12-016-15/+107
| | | | | | | | 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
* [clang-tidy] google-explicit-constructor: improve the warning messageAlexander Kornienko2015-11-281-3/+5
| | | | | | Also switch some more tests to %check_clang_tidy. llvm-svn: 254216
* [clang-tidy] cppcoreguidelines-pro-bounds-pointer-arithmetic: ignore ↵Matthias Gehre2015-11-261-5/+9
| | | | | | | | | | | | | | | | generated pointer arithmetic Summary: Inside a range-based for-loop over an array, the compiler generates pointer arithmetic (end = array + size). Don't flag this. Reviewers: alexfh, sbenza, bkramer, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D14582 llvm-svn: 254182
* Fix problem with Clang-tidy parallel configure build.Eugene Zelenko2015-11-251-2/+2
| | | | | | Differential revision: http://reviews.llvm.org/D14964 llvm-svn: 254081
* [clang-tidy] Fix a typo in my latest commit.Alexander Kornienko2015-11-251-2/+2
| | | | llvm-svn: 254074
* [clang-tidy] Const std::move() argument ClangTidy checkAlexander Kornienko2015-11-254-0/+106
| | | | | | | | | | | | ClangTidy check for finding cases when std::move() is called with const or trivially copyable arguments, that doesn't lead to any move or argument but it makes copy. FixIt generates patch for removing call of std::move(). Patch by Vadym Doroshenko! (+ a couple of minor fixes) Differential Revision: http://reviews.llvm.org/D12031 llvm-svn: 254070
* [clang-tidy] code cleanup using isAssignmentOp()Daniel Marjamaki2015-11-251-5/+1
| | | | llvm-svn: 254066
* Test to ensure the function does not have an unresolved or unevaluated ↵Aaron Ballman2015-11-191-4/+6
| | | | | | exception specification before testing whether the function throws or not. Fixes PR25574. llvm-svn: 253598
* Replace a dyn_cast with isa where the result was only being used as a ↵Craig Topper2015-11-181-1/+1
| | | | | | boolean. NFC. llvm-svn: 253442
* Revert r253401, "[clang-tidy] add check ↵NAKAMURA Takumi2015-11-184-175/+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-174-0/+175
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix bug 25362 "cppcoreguidelines-pro-bounds-array-to-pointer-decay does not ↵Matthias Gehre2015-11-172-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | consider const" Summary: The current matcher is implicitCastExpr(unless(hasParent(explicitCastExpr()))) but the AST in the bug is `-CXXStaticCastExpr 0x2bb64f8 <col:21, col:55> 'void *const *' static_cast<void *const *> <NoOp> `-ImplicitCastExpr 0x2bb64e0 <col:47> 'void *const *' <NoOp> `-ImplicitCastExpr 0x2bb64c8 <col:47> 'void **' <ArrayToPointerDecay> `-DeclRefExpr 0x2bb6458 <col:47> 'void *[2]' lvalue Var 0x2bb59d0 'addrlist' 'void *[2]' i.e. an ImplicitCastExpr (const cast) between decay and explicit cast. Reviewers: alexfh, sbenza, bkramer, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D14517 llvm-svn: 253399
* Add a new clang-tidy checker that flags throw expressions whose thrown type ↵Aaron Ballman2015-11-164-0/+88
| | | | | | | | 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
* [clang-tidy] Test commit (playing with git-svn)Alexander Kornienko2015-11-162-4/+3
| | | | llvm-svn: 253203
* [clang-tidy] Remove unused #includes.Alexander Kornienko2015-11-131-2/+0
| | | | | | | | | | Summary: Testing Phab with git-svn Reviewers: alexfh Differential Revision: http://reviews.llvm.org/D14649 llvm-svn: 253036
* Fix bug in suggested fix that truncated variable names to 1 character.Samuel Benzaquen2015-11-111-30/+35
| | | | | | | | | | | | | | Summary: Fix bug in suggested fix that truncated variable names to 1 character. Also, rework the suggested fix to try to remove unnecessary whitespace. Reviewers: alexfh, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13899 llvm-svn: 252773
* [clang-tidy] misc-macro-parentheses: fix fp when using object member pointersDaniel Marjamaki2015-11-101-1/+2
| | | | | | Fixes http://llvm.org/PR25208. llvm-svn: 252608
* Add ExtraArgs and ExtraArgsBefore options to enable clang warnings via ↵Alexander Kornienko2015-11-095-4/+46
| | | | | | | | | | | | | | configuration files. Summary: This patch depends on http://reviews.llvm.org/D14191 Reviewers: djasper, klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D14192 llvm-svn: 252485
* [clang-tidy] Fix message style (capitalization, trailing period).Alexander Kornienko2015-11-091-3/+2
| | | | llvm-svn: 252471
* [clang-tidy] add new check cppcoreguidelines-pro-type-cstyle-castMatthias Gehre2015-11-084-0/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Allow the alias to be of a different type.Angel Garcia Gomez2015-11-061-12/+18
| | | | | | | | | | | | Summary: Consider a declaration an alias even if it doesn't have the same unqualified type than the container element, as long as one can be converted to the other using only implicit casts. Reviewers: klimek Subscribers: alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D14442 llvm-svn: 252315
* Use the old index identifier by default, instead of 'elem'.Angel Garcia Gomez2015-11-061-48/+1
| | | | | | | | | | | | Summary: Use the old index name in the cases where the check would come up with an invented name. Reviewers: klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D14438 llvm-svn: 252308
* Avoid naming conflicts with the old index in modernize-loop-convert.Angel Garcia Gomez2015-11-061-5/+6
| | | | | | | | | | | | Summary: The old index declaration is going to be removed anyway, so we can reuse its name if it is the best candidate for the new index. Reviewers: klimek Subscribers: cfe-commits, alexfh Differential Revision: http://reviews.llvm.org/D14437 llvm-svn: 252303
* Fix another case where loop-convert wasn't handling correctly data members.Angel Garcia Gomez2015-11-061-3/+3
| | | | | | | | | | | | | | | Summary: If the container expression was obtained from the point where "size" (which usually is a const method) is invoked, then the topmost node in this expression may be an implicit cast to const. When the container is a data member, the check was trying to obtain the member expression directly and was failing in the case mentioned above. This is solved by ignoring implicit casts. Reviewers: klimek Subscribers: cfe-commits, alexfh Differential Revision: http://reviews.llvm.org/D14378 llvm-svn: 252278
* [clang-tidy] readability-named-parameter: don't complain about implicit ↵Alexander Kornienko2015-11-061-0/+2
| | | | | | | | parameters Fixes http://llvm.org/PR24464. llvm-svn: 252248
OpenPOWER on IntegriCloud