aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-06-23 18:04:27 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-06-23 18:04:27 +0000
commitd6bf0effa9cd397b7466628c17b5f4f8dc362780 (patch)
treeb803ca963bead630a172b530b95791c131e40f57
parent7140b3cde03f2cdc877e1261abe209b190e0d7ee (diff)
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
-rw-r--r--lib/AST/DeclBase.cpp6
1 files changed, 4 insertions, 2 deletions
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 <typename T>
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<T>(Attrs[i])) {
Attrs.erase(Attrs.begin() + i);
- --i, --e;
+ --e;
}
+ else
+ ++i;
}
if (Attrs.empty())
HasAttrs = false;