Fix for removing not included files from a compilation database.

remove_if doesn't alter the container properties. Need to use erase to remove
the elements past the new end.

llvm-svn: 190803
This commit is contained in:
Ariel J. Bernal 2013-09-16 20:12:22 +00:00
parent 6e2dd7b553
commit defd1a93c9
1 changed files with 3 additions and 1 deletions

View File

@ -360,7 +360,9 @@ int main(int argc, const char **argv) {
// Use source paths from the compilation database.
// We only transform files that are explicitly included.
Sources = Compilations->getAllFiles();
std::remove_if(Sources.begin(), Sources.end(), isFileNotIncludedPredicate);
std::vector<std::string>::iterator E = std::remove_if(
Sources.begin(), Sources.end(), isFileNotIncludedPredicate);
Sources.erase(E, Sources.end());
}
if (Sources.empty()) {