aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/DeclBase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/AST/DeclBase.cpp')
-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;