diff options
| author | Mads Ravn <madsravn@gmail.com> | 2017-04-24 09:27:20 +0000 |
|---|---|---|
| committer | Mads Ravn <madsravn@gmail.com> | 2017-04-24 09:27:20 +0000 |
| commit | a301498783dd9c05f1067cdb8eea5ff4e9f9a059 (patch) | |
| tree | be12b3057ac97b9ce9515d798d7bcb28a2a99d97 /clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp | |
| parent | f53865daa41d0c520a2afd2618e9a00fed448528 (diff) | |
| download | bcm5719-llvm-a301498783dd9c05f1067cdb8eea5ff4e9f9a059.tar.gz bcm5719-llvm-a301498783dd9c05f1067cdb8eea5ff4e9f9a059.zip | |
[clang-tidy] New check: modernize-replace-random-shuffle.
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
Diffstat (limited to 'clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp')
| -rw-r--r-- | clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp b/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp index 0328d1876da..de027249d2d 100644 --- a/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp @@ -19,6 +19,7 @@ #include "RawStringLiteralCheck.h" #include "RedundantVoidArgCheck.h" #include "ReplaceAutoPtrCheck.h" +#include "ReplaceRandomShuffleCheck.h" #include "ReturnBracedInitListCheck.h" #include "ShrinkToFitCheck.h" #include "UseAutoCheck.h" @@ -54,6 +55,8 @@ public: "modernize-redundant-void-arg"); CheckFactories.registerCheck<ReplaceAutoPtrCheck>( "modernize-replace-auto-ptr"); + CheckFactories.registerCheck<ReplaceRandomShuffleCheck>( + "modernize-replace-random-shuffle"); CheckFactories.registerCheck<ReturnBracedInitListCheck>( "modernize-return-braced-init-list"); CheckFactories.registerCheck<ShrinkToFitCheck>("modernize-shrink-to-fit"); |

