r222506 - PR21323: Fix iterator invalidation issue when looking for redeclarations of a
Richard Smith
richard-llvm at metafoo.co.uk
Thu Nov 20 21:16:13 PST 2014
Author: rsmith
Date: Thu Nov 20 23:16:13 2014
New Revision: 222506
URL: http://llvm.org/viewvc/llvm-project?rev=222506&view=rev
Log:
PR21323: Fix iterator invalidation issue when looking for redeclarations of a
special member function.
No test yet: the only testcases we have for this issue are extremely complex.
Testcase will be added once I get a reasonable reduction.
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=222506&r1=222505&r2=222506&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Thu Nov 20 23:16:13 2014
@@ -6574,9 +6574,14 @@ ASTReader::FindExternalVisibleDeclsByNam
(Kind == DeclarationName::CXXOperatorName &&
Name.getCXXOverloadedOperator() == OO_Equal)) {
auto Merged = MergedLookups.find(DC);
- if (Merged != MergedLookups.end())
- for (auto *MergedDC : Merged->second)
- LookUpInContexts(MergedDC);
+ if (Merged != MergedLookups.end()) {
+ for (unsigned I = 0; I != Merged->second.size(); ++I) {
+ LookUpInContexts(Merged->second[I]);
+ // We might have just added some more merged lookups. If so, our
+ // iterator is now invalid, so grab a fresh one before continuing.
+ Merged = MergedLookups.find(DC);
+ }
+ }
}
}
More information about the cfe-commits
mailing list