aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
diff options
context:
space:
mode:
authorGabor Horvath <xazax.hun@gmail.com>2015-02-10 09:14:26 +0000
committerGabor Horvath <xazax.hun@gmail.com>2015-02-10 09:14:26 +0000
commitd4637fb433bdef381dbe2f6a973d3a33e42e5907 (patch)
tree8c5ef72803c2d21444ff76a417c705d91c830468 /clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
parent256f7ecad446a65fb3b3aec8d6add902a2040dc5 (diff)
downloadllvm-d4637fb433bdef381dbe2f6a973d3a33e42e5907.zip
llvm-d4637fb433bdef381dbe2f6a973d3a33e42e5907.tar.gz
llvm-d4637fb433bdef381dbe2f6a973d3a33e42e5907.tar.bz2
[clang-tidy] Checker for inaccurate use of erase() method.
Algorithms like remove() does not actually remove any element from the container but returns an iterator to the first redundant element at the end of the container. These redundant elements must be removed using the erase() method. This check warns when not all of the elements will be removed due to using an inappropriate overload. Reviewer: alexfh Differential Revision: http://reviews.llvm.org/D7496 llvm-svn: 228679
Diffstat (limited to 'clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
index dfd5a49..a43efab 100644
--- a/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
@@ -13,6 +13,7 @@
#include "ArgumentCommentCheck.h"
#include "AssignOperatorSignatureCheck.h"
#include "BoolPointerImplicitConversion.h"
+#include "InaccurateEraseCheck.h"
#include "InefficientAlgorithmCheck.h"
#include "SwappedArgumentsCheck.h"
#include "UndelegatedConstructor.h"
@@ -31,6 +32,8 @@ public:
"misc-assign-operator-signature");
CheckFactories.registerCheck<BoolPointerImplicitConversion>(
"misc-bool-pointer-implicit-conversion");
+ CheckFactories.registerCheck<InaccurateEraseCheck>(
+ "misc-inaccurate-erase");
CheckFactories.registerCheck<InefficientAlgorithmCheck>(
"misc-inefficient-algorithm");
CheckFactories.registerCheck<SwappedArgumentsCheck>(