summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/misc
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang-tidy] rename_check.py misc-argument-comment bugprone-argument-commentAlexander Kornienko2017-11-234-366/+0
| | | | | | | | | | | | | | Summary: + manually convert the unit test to lit test. Reviewers: hokein Reviewed By: hokein Subscribers: mgorny, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D40392 llvm-svn: 318926
* [clang-tidy] rename_check.py misc-string-constructor bugprone-string-constructorAlexander Kornienko2017-11-234-177/+0
| | | | | | | | | | | | | | | | Summary: Rename misc-string-constructor to bugprone-string-constructor + manually update the lenght of '==='s in the doc file. Reviewers: hokein, xazax.hun Reviewed By: hokein, xazax.hun Subscribers: mgorny, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D40388 llvm-svn: 318916
* [clang-tidy] Misc redundant expressions checker updated for macrosGabor Horvath2017-11-072-75/+215
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Redundant Expression Checker is updated to be able to detect expressions that contain macros. Also, other small details are modified to improve the current implementation. The improvements in detail are as follows: * Binary and ternary operator expressions containing two constants, with at least one of them from a macro, are detected and tested for redundancy. Macro expressions are treated somewhat differently from other expressions, because the particular values of macros can vary across builds. They can be considered correct and intentional, even if macro values equal, produce ranges that exclude each other or fully overlap, etc. * The code structure is slightly modified: typos are corrected, comments are added and some functions are renamed to improve comprehensibility, both in the checker and the test file. A few test cases are moved to another function. * The checker is now able to detect redundant CXXFunctionalCastExprs as well. A corresponding test case is added. Patch by: Lilla Barancsuk! Differential Revision: https://reviews.llvm.org/D38688 llvm-svn: 317570
* [clang-tidy] Use a more efficient map for the virtual near miss check.Benjamin Kramer2017-10-101-3/+3
| | | | | | DenseMap performs better here. No functionality change intended. llvm-svn: 315277
* Fix up clang-tidy after clang r314037.Richard Smith2017-09-221-1/+4
| | | | llvm-svn: 314047
* [clang-tidy] Fixed misc-unused-parameters omitting parameters square bracketsAlexander Kornienko2017-09-151-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Bug: https://bugs.llvm.org/show_bug.cgi?id=34449 **Problem:** Clang-tidy check misc-unused-parameters comments out parameter name omitting following characters (e.g. square brackets) what results in its complete removal. Compilation errors might occur after clang-tidy fix as well. **Patch description:** Changed removal range. The range should end after parameter name, not after whole parameter declarator (which might be followed by e.g. square brackets). Reviewers: alexfh Reviewed By: alexfh Subscribers: JDevlieghere, xazax.hun, cfe-commits Tags: #clang-tools-extra Patch by Pawel Maciocha! Differential Revision: https://reviews.llvm.org/D37846 llvm-svn: 313355
* [clang-tidy] fixed misc-unused-parameters omitting parameters default valueAlexander Kornienko2017-09-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Bug: https://bugs.llvm.org/show_bug.cgi?id=34450 **Problem:** Clang-tidy check misc-unused-parameters omits parameter default value what results in its complete removal. Compilation errors might occur after clang-tidy fix. **Patch description:** Changed removal range. The range should end after parameter declarator, not after whole parameter declaration (which might contain a default value). Reviewers: alexfh, xazax.hun Reviewed By: alexfh Subscribers: JDevlieghere, cfe-commits Tags: #clang-tools-extra Patch by Pawel Maciocha! Differential Revision: https://reviews.llvm.org/D37566 llvm-svn: 313150
* [clang-tidy] SuspiciousEnumUsageCheck bugfixPeter Szecsi2017-09-121-2/+4
| | | | | | | | | | | iThere is a reported bug on the checker not handling the some APSInt values correctly: https://bugs.llvm.org/show_bug.cgi?id=34400 This patch aims to fix it. Differential Revision: https://reviews.llvm.org/D37572 llvm-svn: 313016
* [clang-tidy] Fix 'misc-misplaced-widening-cast' assertion error.Daniel Marjamaki2017-08-291-0/+4
| | | | | | | | Reviewers: alexfh, xazax.hun, danielmarjamaki Differential Revision: http://reviews.llvm.org/D36670 llvm-svn: 311984
* [clang-tidy] Don't compute the edit distance if it's over the threshold.Benjamin Kramer2017-08-091-2/+2
| | | | | | No functional change intended. llvm-svn: 310532
* Adapt clang-tidy checks to changing semantics of hasDeclaration.Manuel Klimek2017-08-023-23/+33
| | | | | | Differential Revision: https://reviews.llvm.org/D36154 llvm-svn: 309810
* [clang-tidy] Unify the way IncludeStyle and HeaderFileExtesions options are usedAlexander Kornienko2017-07-202-3/+3
| | | | llvm-svn: 308605
* [NFC] Update function call names as changed in MacroInfo that should refer ↵Faisal Vali2017-07-172-3/+3
| | | | | | | | | | to Parameters (as opposed to Arguments). This syncs them up with clang commit r308190 Thanks! llvm-svn: 308191
* [clang-tidy] Enable inline variable definitions in headersGabor Horvath2017-06-281-0/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D34449 llvm-svn: 306538
* Revert "[clang-tidy] When" -fno-exceptions is used", this warning is better ↵Alexander Kornienko2017-06-091-1/+1
| | | | | | | | | | to be suppressed." This reverts commit r304949. https://reviews.llvm.org/D34002#775830 llvm-svn: 305057
* [clang-tidy] When" -fno-exceptions is used", this warning is better to be ↵Yan Wang2017-06-071-1/+1
| | | | | | | | | | | | | | | | | | suppressed. Summary: "misc-noexcept-move-constructor" is better not to be issued when "-fno-exceptions" is set. Reviewers: chh, alexfh, aaron.ballman Reviewed By: aaron.ballman Subscribers: aaron.ballman, cfe-commits, xazax.hun Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D34002 llvm-svn: 304949
* [clang-tidy] Make misc-inaccurate-erase work with real C++11 containers.Alexander Kornienko2017-06-071-14/+16
| | | | | | | | The check failed to match iterator->const_iterator conversion that is happening at least when using the libstdc++'s vector. We might want to make it match even more flexible patterns, if we see more false negatives. llvm-svn: 304879
* [clang-tidy] misc-inaccurate-erase: support call by pointerAlexander Kornienko2017-06-061-3/+8
| | | | | | + replace matchesName calls with more efficient alternatives. llvm-svn: 304811
* [clang-tidy] Make misc-static-assert accept assert(!"msg")Florian Gross2017-06-031-1/+3
| | | | | | | | Added negated string literals to the set of IsAlwaysFalse expressions to avoid flagging of assert(!"msg"). Differential Revision: http://reviews.llvm.org/D33827 llvm-svn: 304657
* [clang-tidy] Add `const` to operator() to fix a warning.Alexander Kornienko2017-06-021-1/+1
| | | | llvm-svn: 304583
* [clang-tidy] check for __func__/__FUNCTION__ in lambdasAlexander Kornienko2017-06-024-0/+154
| | | | | | | | | | | | 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
* [clang-tidy] Use getLocalOrGlobal for the StrictMode optionAlexander Kornienko2017-05-291-1/+2
| | | | llvm-svn: 304154
* [clang-tidy] Do not dereference a null BaseTypeChih-Hung Hsieh2017-05-231-0/+2
| | | | | | | | | Check BaseType before dereference. Simplified test case is derived from Android Open Source code. Differential Revision: https://reviews.llvm.org/D33430 llvm-svn: 303645
* [clang-tidy] misc-move-const-arg shouldn't complain on std::move(lambda)Alexander Kornienko2017-05-221-0/+6
| | | | llvm-svn: 303554
* [clang-tidy] Optimize misc-unused-parameters. NFCIAlexander Kornienko2017-05-172-17/+72
| | | | | | | | | Don't traverse AST each time we need to find references to a certain function. Traverse the AST once using RAV and cache the index of function references. The speed up on a particular large file was about 1000x. llvm-svn: 303230
* Change EOL style to LF. NFCAlexander Kornienko2017-05-091-146/+146
| | | | llvm-svn: 302534
* [clang-tidy] Fix misc-move-const-arg for move-only types.Alexander Kornienko2017-05-051-0/+6
| | | | | | | | | | | | | | Summary: Fix misc-move-const-arg false positives on move-only types. Reviewers: sbenza Reviewed By: sbenza Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D31160 llvm-svn: 302261
* [clang-tidy] misc-misplaced-widening-cast: Disable checking of implicit ↵Gabor Horvath2017-04-191-1/+1
| | | | | | | | | | widening casts by default. Patch by Ádám Balogh! Differential Revision: https://reviews.llvm.org/D32164 llvm-svn: 300699
* Silence -Wlogical-op-parentheses warning NFCNirav Dave2017-04-141-1/+1
| | | | llvm-svn: 300324
* [clang-tidy] Fixes to misc-forwarding-reference-overload check.Gabor Horvath2017-04-141-2/+3
| | | | | | | | | * Style fixes to tests * Make it work consistently on all platforms Patch by András Leitereg! llvm-svn: 300320
* [clang-tidy] Check for forwarding reference overload in constructors.Gabor Horvath2017-04-064-0/+191
| | | | | | | | Patch by András Leitereg! Differential Revision: https://reviews.llvm.org/D30547 llvm-svn: 299638
* [clang-tidy] Fix diag message for catch-by-valueAlexander Kornienko2017-03-231-4/+6
| | | | | | | | | | | | | | | | | | | | | | | Summary: ``` catch (std::exception ex) { } ``` Was flagged with "catch handler catches a pointer value". Reviewers: alexfh, aaron.ballman Reviewed By: aaron.ballman Subscribers: cfe-commits, JDevlieghere Patch by Florian Gross! Differential Revision: https://reviews.llvm.org/D30592 llvm-svn: 298608
* [clang-tidy] Catch trivially true statements like a != 1 || a != 3Alexander Kornienko2017-03-231-0/+5
| | | | | | | | | | | | | | | | | | | | | | Catch trivially true statements of the form a != 1 || a != 3. Statements like these are likely errors. They are particularly easy to miss when handling enums: enum State { RUNNING, STOPPED, STARTING, ENDING } ... if (state != RUNNING || state != STARTING) ... Patch by Blaise Watson! Differential revision: https://reviews.llvm.org/D29858 llvm-svn: 298607
* [Clang-tidy] Fix for misc-noexcept-move-constructor false triggers on ↵Alexander Kornienko2017-03-171-0/+4
| | | | | | | | | | | | | | | | | | | | | | | defaulted declarations Summary: There is no need for triggering warning when noexcept specifier in move constructor or move-assignment operator is neither evaluated nor uninstantiated. This fixes bug reported here: bugs.llvm.org/show_bug.cgi?id=24712 Reviewers: alexfh Reviewed By: alexfh Subscribers: JonasToth, JDevlieghere, cfe-commits Tags: #clang-tools-extra Patch by Marek Jenda! Differential Revision: https://reviews.llvm.org/D31049 llvm-svn: 298101
* [clang-tidy] misc-use-after-move: Fix failing assertionMartin Bohme2017-03-081-1/+8
| | | | | | | | | | | | | | | | | | | | | | Summary: I've added a test case that (without the fix) triggers the assertion, which happens when a move happens in an implicitly called conversion operator. This patch also fixes nondeterministic behavior in the source code location reported for the move when the move is constained in an init list; this was causing buildbot failures in the previous attempt to submit this patch (see D30569 and rL297004). Reviewers: alexfh Reviewed By: alexfh Subscribers: Eugene.Zelenko, JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D30650 llvm-svn: 297272
* Revert "[clang-tidy] misc-use-after-move: Fix failing assertion"Martin Bohme2017-03-061-1/+1
| | | | | | This reverts commit r297004; it was causing buildbots to fail. llvm-svn: 297006
* [clang-tidy] misc-use-after-move: Fix failing assertionMartin Bohme2017-03-061-1/+1
| | | | | | | | | | | | | | | | | Summary: I've added a test case that (without the fix) triggers the assertion, which happens when a move happens in an implicitly called conversion operator. Reviewers: alexfh Reviewed By: alexfh Subscribers: JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D30569 llvm-svn: 297004
* [clang-tidy] Ignore instantiated functions and static data members of ↵Haojian Wu2017-02-151-3/+4
| | | | | | | | | | | | | | classes in misc-definitions-in-headers. Reviewers: alexfh Reviewed By: alexfh Subscribers: JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D29957 llvm-svn: 295178
* [clang-tidy] Don't warn about call to unresolved operator*Malcolm Parsons2017-02-151-1/+4
| | | | | | | | | | | | | | | | | | Summary: The misc-unconventional-assign-operator check had a false positive warning when the 'operator*' in 'return *this' was unresolved. Change matcher to allow calls to unresolved operator. Fixes PR31531. Reviewers: alexfh, aaron.ballman Subscribers: JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D29393 llvm-svn: 295176
* [clang-tidy] Improve diagnostic message for misc-definitions-in-header.Haojian Wu2017-02-141-3/+5
| | | | | | | | | | | | | | | | | | | Summary: Users might get confused easily when they see the check's message on full template function speciliations. Add a note to the output message, which mentions these kind of function specializations are treated as regular functions. Reviewers: alexfh Reviewed By: alexfh Subscribers: JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D29928 llvm-svn: 295048
* [clang-tidy] Fix misc-unused-using-decls false positives in presence of ↵Alexander Kornienko2017-02-091-0/+3
| | | | | | compile errors llvm-svn: 294578
* [clang-tidy] hasErrorOccurred() -> hasUncompilableErrorOccurred()Alexander Kornienko2017-02-082-2/+2
| | | | | | | hasErrorOccurred() -> hasUncompilableErrorOccurred(), since we only care about errors that lead to invalid AST. llvm-svn: 294467
* [clang-tidy] Supresses misc-move-constructor-init warning for const fields.Alexander Kornienko2017-02-081-0/+3
| | | | | | | | Patch by CJ DiMeglio! Differential revision: https://reviews.llvm.org/D28973 llvm-svn: 294459
* [clang-tidy] misc-argument-comment - extended gmock supportAlexander Kornienko2017-02-071-22/+32
| | | | | | | It looks like direct calls to mocked methods happen in the wild. This patch add support for these as well. llvm-svn: 294293
* [clang-tidy] misc-argument-comment support for gmockAlexander Kornienko2017-02-062-47/+124
| | | | | | | | Now for real. The use case supported previously is used by approximately nobody. What's needed is support for matching argument comments in EXPECT_xxx calls to the names of parameters of the mocked methods. llvm-svn: 294193
* [clang-tidy] getPreviousNonCommentToken -> getPreviousTokenAlexander Kornienko2017-02-061-1/+1
| | | | llvm-svn: 294192
* [clang-tidy] misc-argument-comment support for gmockAlexander Kornienko2017-02-021-0/+17
| | | | llvm-svn: 293845
* [clang-tidy] misc-argument-comment: ignore comments after argumentsAlexander Kornienko2017-02-011-2/+5
| | | | llvm-svn: 293771
* [clang-tidy] Add check 'misc-string-compare'.Mads Ravn2016-12-304-0/+121
| | | | | | | | | | | | | | | | | | | I have a created a new check for clang tidy: misc-string-compare. This will check for incorrect usage of std::string::compare when used to check equality or inequality of string instead of the string equality or inequality operators. Example: ``` std::string str1, str2; if (str1.compare(str2)) { } ``` Reviewers: hokein, aaron.ballman, alexfh, malcolm.parsons Subscribers: xazax.hun, Eugene.Zelenko, cfe-commits, malcolm.parsons, Prazek, mgorny, JDevlieghere Differential Revision: https://reviews.llvm.org/D27210 llvm-svn: 290747
* [clang-tidy] Add enum misuse check.Gabor Horvath2016-12-274-0/+259
| | | | | | | | | | | The checker detects various cases when an enum is probably misused (as a bitmask). Patch by: Peter Szecsi! Differential Revision: https://reviews.llvm.org/D22507 llvm-svn: 290600
OpenPOWER on IntegriCloud