From: Fariborz Jahanian Date: Thu, 23 Jun 2011 18:04:27 +0000 (+0000) Subject: Minor tweak to my last patch per Doug's comment. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d6bf0effa9cd397b7466628c17b5f4f8dc362780;p=clang Minor tweak to my last patch per Doug's comment. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133731 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp index 69724a3d5e..575b82d9af 100644 --- a/lib/AST/DeclBase.cpp +++ b/lib/AST/DeclBase.cpp @@ -575,11 +575,13 @@ template void Decl::dropAttr() { if (!HasAttrs) return; AttrVec &Attrs = getASTContext().getDeclAttrs(this); - for (unsigned i = 0, e = Attrs.size(); i != e; ++i) { + for (unsigned i = 0, e = Attrs.size(); i != e; /* in loop */) { if (isa(Attrs[i])) { Attrs.erase(Attrs.begin() + i); - --i, --e; + --e; } + else + ++i; } if (Attrs.empty()) HasAttrs = false;