[cfe-commits] r165905 - /cfe/trunk/include/clang/AST/DeclBase.h

Benjamin Kramer benny.kra at googlemail.com
Sun Oct 14 04:50:50 PDT 2012


Author: d0k
Date: Sun Oct 14 06:50:50 2012
New Revision: 165905

URL: http://llvm.org/viewvc/llvm-project?rev=165905&view=rev
Log:
Simplify code. No functionality change.

Modified:
    cfe/trunk/include/clang/AST/DeclBase.h

Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=165905&r1=165904&r2=165905&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Sun Oct 14 06:50:50 2012
@@ -430,16 +430,10 @@
   void dropAttr() {
     if (!HasAttrs) return;
 
-    AttrVec &Attrs = getAttrs();
-    for (unsigned i = 0, e = Attrs.size(); i != e; /* in loop */) {
-      if (isa<T>(Attrs[i])) {
-        Attrs.erase(Attrs.begin() + i);
-        --e;
-      }
-      else
-        ++i;
-    }
-    if (Attrs.empty())
+    AttrVec &Vec = getAttrs();
+    Vec.erase(std::remove_if(Vec.begin(), Vec.end(), isa<T, Attr*>), Vec.end());
+
+    if (Vec.empty())
       HasAttrs = false;
   }
 





More information about the cfe-commits mailing list