In clang/lib/Tooling/CompilationDatabase.cpp:241, this really looks weird:
// 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")));
The attached patch adds the extra erase step necessary to really remove the
elements --- as the comment states. But it bothers me to see that the
current code seems to work as it is, hinting that those lines may no longer
be necessary.
Any opinion there ?
Cheers,
--
Arnaud
From ec274dc8cf5f373166a6f318c1af25c9b4b29dde Mon Sep 17 00:00:00 2001
From: "Arnaud A. de Grandmaison" <[email protected]>
Date: Tue, 29 Apr 2014 21:46:31 +0200
Subject: [PATCH] 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.
---
lib/Tooling/CompilationDatabase.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/Tooling/CompilationDatabase.cpp b/lib/Tooling/CompilationDatabase.cpp
index b513446..ec4d604 100644
--- a/lib/Tooling/CompilationDatabase.cpp
+++ b/lib/Tooling/CompilationDatabase.cpp
@@ -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));
--
1.8.3.2
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits