PR19601: std::remove_if does not really remove the elements.

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.

llvm-svn: 207696
This commit is contained in:
Arnaud A. de Grandmaison 2014-04-30 19:59:22 +00:00
parent a1fbf3459f
commit e1265143e2
1 changed files with 3 additions and 2 deletions

View 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));