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

Bernal, Ariel J ariel.j.bernal at intel.com
Tue Sep 17 07:44:07 PDT 2013


Yes sure

From: Manuel Klimek [mailto:klimek at google.com]
Sent: Tuesday, September 17, 2013 4:06 AM
To: Bernal, Ariel J
Cc: cfe-commits at cs.uiuc.edu
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 <ariel.j.bernal at intel.com<mailto:ariel.j.bernal at intel.com>> 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
cfe-commits at cs.uiuc.edu<mailto:cfe-commits at cs.uiuc.edu>
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130917/f8196ccf/attachment.html>


More information about the cfe-commits mailing list