r275233 - [CUDA] Use the multi-element remove function in EraseUnwantedCUDAMatches.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 12 16:23:13 PDT 2016


Author: jlebar
Date: Tue Jul 12 18:23:13 2016
New Revision: 275233

URL: http://llvm.org/viewvc/llvm-project?rev=275233&view=rev
Log:
[CUDA] Use the multi-element remove function in EraseUnwantedCUDAMatches.

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

Modified:
    cfe/trunk/lib/Sema/SemaCUDA.cpp

Modified: cfe/trunk/lib/Sema/SemaCUDA.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCUDA.cpp?rev=275233&r1=275232&r2=275233&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCUDA.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCUDA.cpp Tue Jul 12 18:23:13 2016
@@ -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,




More information about the cfe-commits mailing list