r203042 - Switch to an idiomatic C++ erase/remove for this loop, and fix a bug in the
Richard Smith
richard-llvm at metafoo.co.uk
Wed Mar 5 16:33:24 PST 2014
Author: rsmith
Date: Wed Mar 5 18:33:23 2014
New Revision: 203042
URL: http://llvm.org/viewvc/llvm-project?rev=203042&view=rev
Log:
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).
Modified:
cfe/trunk/lib/Serialization/ASTReader.cpp
Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=203042&r1=203041&r2=203042&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Wed Mar 5 18:33:23 2014
@@ -1684,9 +1684,11 @@ void ASTReader::removeOverriddenMacros(I
}
// 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());
}
}
More information about the cfe-commits
mailing list