]> granicus.if.org Git - clang/commitdiff
PR19601: std::remove_if does not really remove the elements.
authorArnaud A. de Grandmaison <arnaud.adegm@gmail.com>
Wed, 30 Apr 2014 19:59:22 +0000 (19:59 +0000)
committerArnaud A. de Grandmaison <arnaud.adegm@gmail.com>
Wed, 30 Apr 2014 19:59:22 +0000 (19:59 +0000)
It moves them at the end of the range instead, so an extra erase is needed.

It is strange that this code works without the erase. On the other hand, removing the remove_if will make fail some tests.

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

lib/Tooling/CompilationDatabase.cpp

index b513446a543ddc98959e67ef1f5ed2908e2f2f84..ec4d604825c80c49b8a38e374e8bfb3fb9a45a2f 100644 (file)
@@ -238,8 +238,9 @@ static bool stripPositionalArgs(std::vector<const char *> Args,
 
   // Remove -no-integrated-as; it's not used for syntax checking,
   // and it confuses targets which don't support this option.
-  std::remove_if(Args.begin(), Args.end(),
-                 MatchesAny(std::string("-no-integrated-as")));
+  Args.erase(std::remove_if(Args.begin(), Args.end(),
+                            MatchesAny(std::string("-no-integrated-as"))),
+             Args.end());
 
   const std::unique_ptr<driver::Compilation> Compilation(
       NewDriver->BuildCompilation(Args));