[PATCH] D21914: [CUDA] Use the multi-element remove function in EraseUnwantedCUDAMatches.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 30 17:23:31 PDT 2016

jlebar created this revision.
jlebar added a reviewer: tra.
jlebar added subscribers: bkramer, cfe-commits.

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).



Index: lib/Sema/SemaCUDA.cpp
--- lib/Sema/SemaCUDA.cpp
+++ lib/Sema/SemaCUDA.cpp
@@ -163,8 +163,10 @@
       [&](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,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21914.62446.patch
Type: text/x-patch
Size: 628 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160701/3e75b116/attachment.bin>

More information about the cfe-commits mailing list