]> granicus.if.org Git - clang/commitdiff
[CUDA] Use the multi-element remove function in EraseUnwantedCUDAMatches.
authorJustin Lebar <jlebar@google.com>
Tue, 12 Jul 2016 23:23:13 +0000 (23:23 +0000)
committerJustin Lebar <jlebar@google.com>
Tue, 12 Jul 2016 23:23:13 +0000 (23:23 +0000)
Summary:
Bug pointed out by Benjamin Kramer in r264008.  I think the bug is
benign because by the time this is called, we should only have at most
two overloads to consider (either a host and a device overload, or a
host+device overload, but not all three).

Reviewers: tra

Subscribers: cfe-commits, bkramer

Differential Revision: http://reviews.llvm.org/D21914

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275233 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaCUDA.cpp

index 7e201f4dae672f8baae9040437440bb159eff2bc..90af6d5a927ff40ccc803c85dd22773c74730415 100644 (file)
@@ -163,8 +163,10 @@ static void EraseUnwantedCUDAMatchesImpl(
       [&](const T &M1, const T &M2) { return GetCFP(M1) < GetCFP(M2); }));
 
   // Erase all functions with lower priority.
-  Matches.erase(llvm::remove_if(
-      Matches, [&](const T &Match) { return GetCFP(Match) < BestCFP; }));
+  Matches.erase(
+      llvm::remove_if(Matches,
+                      [&](const T &Match) { return GetCFP(Match) < BestCFP; }),
+      Matches.end());
 }
 
 void Sema::EraseUnwantedCUDAMatches(const FunctionDecl *Caller,