From 66cd0503b8e96dba7686819fcfb0ede28ad9c90b Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sun, 14 Oct 2012 11:50:50 +0000 Subject: [PATCH] Simplify code. No functionality change. llvm-svn: 165905 --- clang/include/clang/AST/DeclBase.h | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h index 5543068..50e2027 100644 --- a/clang/include/clang/AST/DeclBase.h +++ b/clang/include/clang/AST/DeclBase.h @@ -430,16 +430,10 @@ public: void dropAttr() { if (!HasAttrs) return; - AttrVec &Attrs = getAttrs(); - for (unsigned i = 0, e = Attrs.size(); i != e; /* in loop */) { - if (isa(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), Vec.end()); + + if (Vec.empty()) HasAttrs = false; } -- 2.7.4