From 9c31a56df691380423cfe7ecbd56970f9c41468b Mon Sep 17 00:00:00 2001 From: Samuel Benzaquen Date: Mon, 21 Mar 2016 18:00:43 +0000 Subject: [clang-tidy] Fix check broken in rL263822. Add names missing from rL263822 and add tests to prevent future omissions. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@263963 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/clang-tidy/misc-inefficient-algorithm.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test') diff --git a/test/clang-tidy/misc-inefficient-algorithm.cpp b/test/clang-tidy/misc-inefficient-algorithm.cpp index df962c91..75ca7d64 100644 --- a/test/clang-tidy/misc-inefficient-algorithm.cpp +++ b/test/clang-tidy/misc-inefficient-algorithm.cpp @@ -35,7 +35,11 @@ template > struct map { iterator end() const; }; +template struct multimap : map {}; template struct unordered_set : set {}; +template struct unordered_map : map {}; +template struct unordered_multiset : set {}; +template struct unordered_multimap : map {}; template > struct multiset : set {}; @@ -114,10 +118,30 @@ int main() { // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: this STL algorithm call should be // CHECK-FIXES: {{^ }}us.find(10);{{$}} + std::unordered_multiset ums; + find(ums.begin(), ums.end(), 10); + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: this STL algorithm call should be + // CHECK-FIXES: {{^ }}ums.find(10);{{$}} + std::map intmap; find(intmap.begin(), intmap.end(), 46); // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: this STL algorithm call should be // CHECK-FIXES: {{^ }}find(intmap.begin(), intmap.end(), 46);{{$}} + + std::multimap intmmap; + find(intmmap.begin(), intmmap.end(), 46); + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: this STL algorithm call should be + // CHECK-FIXES: {{^ }}find(intmmap.begin(), intmmap.end(), 46);{{$}} + + std::unordered_map umap; + find(umap.begin(), umap.end(), 46); + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: this STL algorithm call should be + // CHECK-FIXES: {{^ }}find(umap.begin(), umap.end(), 46);{{$}} + + std::unordered_multimap ummap; + find(ummap.begin(), ummap.end(), 46); + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: this STL algorithm call should be + // CHECK-FIXES: {{^ }}find(ummap.begin(), ummap.end(), 46);{{$}} } struct Value { -- cgit v1.2.3