summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-03-06 00:33:23 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-03-06 00:33:23 +0000
commitbb29e518c80d672ce9413b9dc0f086a5eb5b463b (patch)
tree7ab7afe3d42246d96ddf02098e2e81df2534c4a8
parent2a9d318e4a247340fb4c4fe1cdefe6fb225e6091 (diff)
downloadbcm5719-llvm-bb29e518c80d672ce9413b9dc0f086a5eb5b463b.tar.gz
bcm5719-llvm-bb29e518c80d672ce9413b9dc0f086a5eb5b463b.zip
Switch to an idiomatic C++ erase/remove for this loop, and fix a bug in the
process (I don't believe it's possible to write a testcase for the bug with a non-checking STL implementation). llvm-svn: 203042
-rw-r--r--clang/lib/Serialization/ASTReader.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 41c532ec274..99361d207e8 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -1684,9 +1684,11 @@ void ASTReader::removeOverriddenMacros(IdentifierInfo *II,
}
// If this macro is already in our list of conflicts, remove it from there.
- for (unsigned AI = 0, AN = Ambig.size(); AI != AN; ++AI)
- if (Ambig[AI]->getInfo()->getOwningModuleID() == OwnerID)
- Ambig.erase(Ambig.begin() + AI);
+ Ambig.erase(
+ std::remove_if(Ambig.begin(), Ambig.end(), [&](DefMacroDirective *MD) {
+ return MD->getInfo()->getOwningModuleID() == OwnerID;
+ }),
+ Ambig.end());
}
}
OpenPOWER on IntegriCloud