<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>My hypothesis for how this was working: std::remove_if reorders elements using std::move, so we were getting lucky that -no-integrated-as wasn't the last argument and something else got moved on top of it. We'd have duplicates of the last few arguments (because they got moved earlier), but that wouldn't show -no-integrated-as.</div><div><br></div><div>Jordan</div><div><br></div><br><div><div>On Apr 30, 2014, at 14:09, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">This needs a test case. This code has already been committed, incorrectly, twice before this revision; the existing test case clearly doesn't actually cover it properly.</div><div class="gmail_ext!
 ra"><br>
<br><div class="gmail_quote">On Wed, Apr 30, 2014 at 12:59 PM, Arnaud A. de Grandmaison <span dir="ltr"><<a href="mailto:arnaud.adegm@gmail.com" target="_blank">arnaud.adegm@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: aadg<br>
Date: Wed Apr 30 14:59:22 2014<br>
New Revision: 207696<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=207696&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=207696&view=rev</a><br>
Log:<br>
PR19601: std::remove_if does not really remove the elements.<br>
<br>
It moves them at the end of the range instead, so an extra erase is needed.<br>
<br>
It is strange that this code works without the erase. On the other hand, removing the remove_if will make fail some tests.<br>
<br>
Modified:<br>
    cfe/trunk/lib/Tooling/CompilationDatabase.cpp<br>
<br>
Modified: cfe/trunk/lib/Tooling/CompilationDatabase.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/CompilationDatabase.cpp?rev=207696&r1=207695&r2=207696&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/CompilationDatabase.cpp?rev=207696&r1=207695&r2=207696&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/lib/Tooling/CompilationDatabase.cpp (original)<br>
+++ cfe/trunk/lib/Tooling/CompilationDatabase.cpp Wed Apr 30 14:59:22 2014<br>
@@ -238,8 +238,9 @@ static bool stripPositionalArgs(std::vec<br>
<br>
   // Remove -no-integrated-as; it's not used for syntax checking,<br>
   // and it confuses targets which don't support this option.<br>
-  std::remove_if(Args.begin(), Args.end(),<br>
-                 MatchesAny(std::string("-no-integrated-as")));<br>
+  Args.erase(std::remove_if(Args.begin(), Args.end(),<br>
+                            MatchesAny(std::string("-no-integrated-as"))),<br>
+             Args.end());<br>
<br>
   const std::unique_ptr<driver::Compilation> Compilation(<br>
       NewDriver->BuildCompilation(Args));<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>
_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits<br></blockquote></div><br></body></html>