summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/misc/InefficientAlgorithmCheck.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-tidy/misc/InefficientAlgorithmCheck.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/misc/InefficientAlgorithmCheck.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/clang-tools-extra/clang-tidy/misc/InefficientAlgorithmCheck.cpp b/clang-tools-extra/clang-tidy/misc/InefficientAlgorithmCheck.cpp
index 94e3785994c..d585590128f 100644
--- a/clang-tools-extra/clang-tidy/misc/InefficientAlgorithmCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/InefficientAlgorithmCheck.cpp
@@ -33,13 +33,16 @@ void InefficientAlgorithmCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus)
return;
- const std::string Algorithms =
- "^::std::(find|count|equal_range|lower_bound|upper_bound)$";
- const auto ContainerMatcher = classTemplateSpecializationDecl(
- matchesName("^::std::(unordered_)?(multi)?(set|map)$"));
+ const auto Algorithms =
+ hasAnyName("::std::find", "::std::count", "::std::equal_range",
+ "::std::lower_bound", "::std::upper_bound");
+ const auto ContainerMatcher = classTemplateSpecializationDecl(hasAnyName(
+ "::std::set", "::std::map", "::std::multiset", "::std::multimap",
+ "::std::unordered_set", "::std::unordered_map"));
+
const auto Matcher =
callExpr(
- callee(functionDecl(matchesName(Algorithms))),
+ callee(functionDecl(Algorithms)),
hasArgument(
0, cxxConstructExpr(has(cxxMemberCallExpr(
callee(cxxMethodDecl(hasName("begin"))),
OpenPOWER on IntegriCloud