Yes sure

From: Manuel Klimek [mailto:[email protected]]
Sent: Tuesday, September 17, 2013 4:06 AM
To: Bernal, Ariel J
Cc: [email protected]
Subject: Re: [clang-tools-extra] r190803 - Fix for removing not included files 
from a compilation database.

On Mon, Sep 16, 2013 at 10:12 PM, Ariel J. Bernal 
<[email protected]<mailto:[email protected]>> wrote:
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.

I'd suggest to add a regression test ...

Cheers,
/Manuel


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()) {


_______________________________________________
cfe-commits mailing list
[email protected]<mailto:[email protected]>
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to