summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang-tidy] Remove target specification hicpp-signed-bitwiseJonas Toth2017-10-031-1/+1
| | | | | | | | | | | This patch removes the targetspecification of a testcase, that broke for ARM. The underlying problem was fixed which makes it unnecessary to specify the target architecture (problem was the signedness of `char`). Committing without review was accepted in https://reviews.llvm.org/D38399 by aaron.ballman. llvm-svn: 314811
* [clang-tidy] Fix bug 34747, streaming operators and hicpp-signed-bitwiseJonas Toth2017-10-031-0/+21
| | | | | | | | | | | | The bug happened with stream operations, that were not recognized in all cases. Even there were already existing test for streaming classes, they did not catch this bug. Adding the isolated example to the existing tests did not trigger the bug. Therefore i created a new isolated file that did expose the bug indeed. Differential: https://reviews.llvm.org/D38399 reviewed by aaron.ballman llvm-svn: 314808
* Fix up clang-tidy after clang r314037.Richard Smith2017-09-221-10/+10
| | | | llvm-svn: 314047
* [clang-tidy] Fix linkage-related compiler errors in clang-tidy testsAlexander Kornienko2017-09-202-7/+13
| | | | llvm-svn: 313752
* [clang-tidy] Fixed misc-unused-parameters omitting parameters square bracketsAlexander Kornienko2017-09-151-2/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-3/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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] Implement type-based check for `gsl::owner`Jonas Toth2017-09-121-0/+389
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This check implements the typebased semantic of `gsl::owner`. Meaning, that - only `gsl::owner` is allowed to get `delete`d - `new` expression must be assigned to `gsl::owner` - function calls that expect `gsl::owner` as argument, must get either an owner or a newly created and recognized resource (in the moment only `new`ed memory) - assignment to `gsl::owner` must be either a resource or another owner - functions returning an `gsl::owner` are considered as factories, and their result must be assigned to an `gsl::owner` - classes that have an `gsl::owner`-member must declare a non-default destructor There are some problems that occur when typededuction is in place. For example `auto Var = function_that_returns_owner();` the type of `Var` will not be an `gsl::owner`. This case is catched, and explicitly noted. But cases like fully templated functions ``` template <typename T> void f(T t) { delete t; } // ... f(gsl::owner<int*>(new int(42))); ``` Will created false positive (the deletion is problematic), since the type deduction removes the wrapping `typeAlias`. Codereview in D36354 llvm-svn: 313067
* [clang-tidy] Revert Implement type-based check for gsl::ownerJonas Toth2017-09-121-388/+0
| | | | | | This should unbreak the buildbot for visual studio 2015 for now. llvm-svn: 313059
* [clang-tidy] Implement type-based check for `gsl::owner`Jonas Toth2017-09-121-0/+388
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This check implements the typebased semantic of `gsl::owner`. Meaning, that - only `gsl::owner` is allowed to get `delete`d - `new` expression must be assigned to `gsl::owner` - function calls that expect `gsl::owner` as argument, must get either an owner or a newly created and recognized resource (in the moment only `new`ed memory) - assignment to `gsl::owner` must be either a resource or another owner - functions returning an `gsl::owner` are considered as factories, and their result must be assigned to an `gsl::owner` - classes that have an `gsl::owner`-member must declare a non-default destructor There are some problems that occur when typededuction is in place. For example `auto Var = function_that_returns_owner();` the type of `Var` will not be an `gsl::owner`. This case is catched, and explicitly noted. But cases like fully templated functions ``` template <typename T> void f(T t) { delete t; } // ... f(gsl::owner<int*>(new int(42))); ``` Will created false positive (the deletion is problematic), since the type deduction removes the wrapping `typeAlias`. Please give your comments :) llvm-svn: 313043
* [clang-tidy] SuspiciousEnumUsageCheck bugfixPeter Szecsi2017-09-121-1/+7
| | | | | | | | | | | 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
* [cppcoreguidelines] Don't rely on SmallPtrSet iteration order.Benjamin Kramer2017-08-301-0/+13
| | | | | | | The fixit emission breaks if the iteration order changes and also missed to emit fixits for some edge cases. llvm-svn: 312166
* [clang-tidy] fix buildbotJonas Toth2017-08-301-7/+7
| | | | | | Use `signed char` instead of `char`. llvm-svn: 312141
* clang-tools-extra/test/clang-tidy/hicpp-signed-bitwise.cpp: Appease *-win32 ↵NAKAMURA Takumi2017-08-301-1/+1
| | | | | | to add explicit triple. llvm-svn: 312137
* [clang-tidy] Improve hicpp-exception-baseclass to handle generic code betterJonas Toth2017-08-301-12/+149
| | | | | | | | | | | | | | | | Summary: This patch is a followup to the first revision D36583, that had problems with generic code and its diagnostic messages, which were found by @lebedev.ri Reviewers: alexfh, aaron.ballman, lebedev.ri, hokein Reviewed By: aaron.ballman, lebedev.ri Subscribers: klimek, sbenza, cfe-commits, JDevlieghere, lebedev.ri, xazax.hun Differential Revision: https://reviews.llvm.org/D37060 llvm-svn: 312134
* [clang-tidy] hicpp bitwise operations on signed integersJonas Toth2017-08-301-0/+219
| | | | | | | | | | | | | | | | Summary: This check implements the rule [[ http://www.codingstandard.com/section/5-6-shift-operators/ | 5.6. HIC++ ]] that forbidds bitwise operations on signed integer types. Reviewers: aaron.ballman, hokein, alexfh, Eugene.Zelenko Reviewed By: aaron.ballman Subscribers: cfe-commits, mgorny, JDevlieghere, xazax.hun Differential Revision: https://reviews.llvm.org/D36586 llvm-svn: 312122
* [clang-tidy] Fix 'misc-misplaced-widening-cast' assertion error.Daniel Marjamaki2017-08-291-0/+6
| | | | | | | | Reviewers: alexfh, xazax.hun, danielmarjamaki Differential Revision: http://reviews.llvm.org/D36670 llvm-svn: 311984
* [clang-tidy] A follow-up fix of braced-init-list constructors in make-unique ↵Haojian Wu2017-08-242-0/+28
| | | | | | | | | | | | | | check. Reviewers: alexfh Reviewed By: alexfh Subscribers: JDevlieghere, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D37066 llvm-svn: 311652
* [clang-tidy] bugprone-undefined-memory-manipulation: include type into the ↵Alexander Kornienko2017-08-241-36/+64
| | | | | | | | | | message Having the actual type in the message helps a lot understanding warnings in templates ;) + fix a false negative for type aliases. llvm-svn: 311651
* [clang-tidy] Add modernize-use-equals-default.IgnoreMacros optionAlexander Kornienko2017-08-173-4/+17
| | | | llvm-svn: 311136
* [clang-tidy] Ignore statements inside a template instantiation.Haojian Wu2017-08-171-0/+12
| | | | | | | | | | | | Reviewers: alexfh Reviewed By: alexfh Subscribers: JDevlieghere, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D36822 llvm-svn: 311086
* [clang-tidy] Don't generate fixes for initializer_list constructor in ↵Haojian Wu2017-08-171-7/+30
| | | | | | | | | | | | | | | | | | | | | make_unique check. Summary: The current fix will break the compilation -- because braced list is not deducible in std::make_unique (with the use of forwarding) without specifying the type explicitly. We could support it in the future. Reviewers: alexfh Reviewed By: alexfh Subscribers: JDevlieghere, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D36786 llvm-svn: 311078
* [clang-tidy] Add a close-on-exec check on epoll_create() in Android module.Chih-Hung Hsieh2017-08-161-0/+24
| | | | | | | | | | Summary: epoll_create() is better to be replaced by epoll_create1() with EPOLL_CLOEXEC flag to avoid file descriptor leakage. Differential Revision: https://reviews.llvm.org/D35367 llvm-svn: 311029
* [clang-tidy] Add a close-on-exec check on epoll_create1() in Android module.Chih-Hung Hsieh2017-08-161-0/+59
| | | | | | | | | Summary: epoll_create1() is better to set EPOLL_CLOEXEC flag to avoid file descriptor leakage. Differential Revision: https://reviews.llvm.org/D35365 llvm-svn: 311028
* [clang-tidy] Add a close-on-exec check on accept4() in Android module.Chih-Hung Hsieh2017-08-161-0/+66
| | | | | | | | | Summary: accept4() is better to set SOCK_CLOEXEC flag to avoid file descriptor leakage. Differential Revision: https://reviews.llvm.org/D35363 llvm-svn: 311027
* [clang-tidy] Add a close-on-exec check on accept() in Android module.Chih-Hung Hsieh2017-08-161-0/+28
| | | | | | | | | | Summary: accept() is better to be replaced by accept4() with SOCK_CLOEXEC flag to avoid file descriptor leakage. Differential Revision: https://reviews.llvm.org/D35362 llvm-svn: 311024
* [clang-tidy] Add a close-on-exec check on inotify_init1() in Android module.Chih-Hung Hsieh2017-08-141-0/+64
| | | | | | | | | 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-141-0/+24
| | | | | | | | | 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-141-0/+31
| | | | | | | | | Summary: dup() is better to be replaced by fcntl() to avoid file descriptor leakage. Differential Revision: https://reviews.llvm.org/D35364 llvm-svn: 310858
* Enable exceptions for this test case to speculatively fix the build bots.Aaron Ballman2017-08-111-2/+2
| | | | | | Hopefully corrects: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/15666 llvm-svn: 310732
* Add hicpp-exception-baseclass to the HIC++ module.Aaron Ballman2017-08-111-0/+42
| | | | | | | | This enforces that throwing an exception in C++ requires that exception to inherit from std::exception. Patch by Jonas Toth. llvm-svn: 310727
* [clang-tidy] Fix for buildbot.Yan Wang2017-08-101-0/+63
| | | | | | | | | 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-101-63/+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-101-0/+63
| | | | | | | | | | | | | | | | | | | | 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-101-0/+130
| | | | | | | | Patch by: Reka Nikolett Kovacs Differential Revision: https://reviews.llvm.org/D35932 llvm-svn: 310589
* [clang-tidy] Enable test for http://llvm.org/PR26228Alexander Kornienko2017-08-101-6/+7
| | | | llvm-svn: 310585
* [clang-tidy] Add modernize-use-emplace.IgnoreImplicitConstructors optionAlexander Kornienko2017-08-101-0/+123
| | | | llvm-svn: 310584
* [clang-tidy] Fix a check-fixes lineGabor Horvath2017-08-101-1/+1
| | | | llvm-svn: 310560
* [clang-tidy] Minor documentation improvementGabor Horvath2017-08-101-1/+1
| | | | | | Patch by: Lilla Barancsuk llvm-svn: 310559
* [clang-tidy] Fix another crash in make-unique check.Haojian Wu2017-08-091-0/+13
| | | | | | | | | | | | | | | | | Summary: The crash happens when calling `reset` method without any preceding operation like "->" or ".", this could happen in a subclass of the "std::unique_ptr". Reviewers: alexfh Reviewed By: alexfh Subscribers: JDevlieghere, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D36452 llvm-svn: 310496
* [clang-tidy] Add new readability non-idiomatic static access checkGabor Horvath2017-08-082-0/+255
| | | | | | | | Patch by: Lilla Barancsuk Differential Revision: https://reviews.llvm.org/D35937 llvm-svn: 310371
* [clang-tidy] 'implicit cast' -> 'implicit conversion'Alexander Kornienko2017-08-084-107/+107
| | | | | | | | | | | | | | | | | | | | | | | | | 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] Added clang-tidy test cases related to rL310095Florian Gross2017-08-044-0/+20
| | | | | | Differential Revision: https://reviews.llvm.org/D36308 llvm-svn: 310096
* [clang-tidy] Ignore macros in make-unique check.Haojian Wu2017-08-042-0/+39
| | | | | | | | | | | | | | | | 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] Support initializer-list constructor cases in ↵Haojian Wu2017-08-042-0/+93
| | | | | | | | | | | | | | modernize-make-unique. Reviewers: alexfh Reviewed By: alexfh Subscribers: malcolm.parsons, JDevlieghere, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D36016 llvm-svn: 310035
* [clang-tidy] Handle anonymous structs/unions in member init checks.Malcolm Parsons2017-08-012-0/+30
| | | | | | | | | | | | Use getAnyMember() instead of getMember() to avoid crash on anonymous structs/unions. Don't warn about initializing members of an anonymous union. Fixes PR32966. Reviewed by alexfh. llvm-svn: 309668
* [clang-tidy] Expand readability-redundant-function-ptr-dereference testAlexander Kornienko2017-07-281-0/+21
| | | | llvm-svn: 309380
* [clang-tidy] readability-redundant-declaration: ignore friends and macrosAlexander Kornienko2017-07-282-1/+49
| | | | llvm-svn: 309379
* [clang-tidy] Do not issue fixit for explicit template specializationsFelix Berger2017-07-261-0/+11
| | | | | | | | | | | | | | Summary: Do not issue fixit in UnnecessaryValueParamCheck if the function is an explicit template specialization as this could cause build breakages. Reviewers: alexfh Subscribers: JDevlieghere, xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D35718 llvm-svn: 309067
* [clang-tidy] Handle incomplete types in bugprone-undefined-memory-manipulationGabor Horvath2017-07-251-0/+7
| | | | | | | | | | check Patch by: Reka Nikolett Kovacs Differential Revision: https://reviews.llvm.org/D35790 llvm-svn: 308954
* [clang-tidy] Add modernize-use-bool-literals.IgnoreMacros optionAlexander Kornienko2017-07-172-1/+153
| | | | llvm-svn: 308181
OpenPOWER on IntegriCloud