[clang-tools-extra] r190803 - Fix for removing not included files from a compilation database.

Ariel J. Bernal ariel.j.bernal at intel.com
Mon Sep 16 13:12:22 PDT 2013


Author: ajbernal
Date: Mon Sep 16 15:12:22 2013
New Revision: 190803

URL: http://llvm.org/viewvc/llvm-project?rev=190803&view=rev
Log:
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.

Modified:
    clang-tools-extra/trunk/clang-modernize/tool/ClangModernize.cpp

Modified: clang-tools-extra/trunk/clang-modernize/tool/ClangModernize.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-modernize/tool/ClangModernize.cpp?rev=190803&r1=190802&r2=190803&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-modernize/tool/ClangModernize.cpp (original)
+++ clang-tools-extra/trunk/clang-modernize/tool/ClangModernize.cpp Mon Sep 16 15:12:22 2013
@@ -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()) {





More information about the cfe-commits mailing list