Skip to content

Instantly share code, notes, and snippets.

@steveire
Created May 17, 2020 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steveire/32fbf457377bc6c57bd3906cc9c8fb9c to your computer and use it in GitHub Desktop.
Save steveire/32fbf457377bc6c57bd3906cc9c8fb9c to your computer and use it in GitHub Desktop.
diff --git a/clang-tools-extra/clang-tidy/bugprone/InaccurateEraseCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/InaccurateEraseCheck.cpp
index 19e91b44b41..49b0c879e72 100644
--- a/clang-tools-extra/clang-tidy/bugprone/InaccurateEraseCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/InaccurateEraseCheck.cpp
@@ -23,24 +23,21 @@ void InaccurateEraseCheck::registerMatchers(MatchFinder *Finder) {
callee(functionDecl(hasAnyName("remove", "remove_if", "unique"))),
hasArgument(
1,
- anyOf(cxxConstructExpr(has(ignoringImplicit(
+ anyOf(
cxxMemberCallExpr(callee(cxxMethodDecl(hasName("end"))))
- .bind("end")))),
+ .bind("end"),
anything())))
.bind("alg");
const auto DeclInStd = type(hasUnqualifiedDesugaredType(
tagType(hasDeclaration(decl(isInStdNamespace())))));
Finder->addMatcher(
- traverse(
- ast_type_traits::TK_AsIs,
cxxMemberCallExpr(
on(anyOf(hasType(DeclInStd), hasType(pointsTo(DeclInStd)))),
callee(cxxMethodDecl(hasName("erase"))), argumentCountIs(1),
- hasArgument(0, has(ignoringImplicit(anyOf(
- EndCall, has(ignoringImplicit(EndCall)))))),
+ hasArgument(0, EndCall),
unless(isInTemplateInstantiation()))
- .bind("erase")),
+ .bind("erase"),
this);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment