+ Vec.erase(std::remove_if(Vec.begin(), Vec.end(), isa<T, Attr*>), Vec.end());
Nice use of isa<> ;) -- Sean Silva On Sun, Oct 14, 2012 at 7:50 AM, Benjamin Kramer <[email protected]> wrote: > 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; > } > > > > _______________________________________________ > cfe-commits mailing list > [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
