Skip to content

Commit 2166273

Browse files
authored
Merge pull request #31640 from CodaFi/it-could-happen-to-you
Patch a Source of Iterator Invalidation
2 parents 314f044 + eff4985 commit 2166273

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/AST/Module.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2697,7 +2697,7 @@ SourceFile::getConfiguredReferencedNameTracker() const {
26972697
}
26982698

26992699
ArrayRef<OpaqueTypeDecl *> SourceFile::getOpaqueReturnTypeDecls() {
2700-
for (auto *vd : UnvalidatedDeclsWithOpaqueReturnTypes) {
2700+
for (auto *vd : UnvalidatedDeclsWithOpaqueReturnTypes.takeVector()) {
27012701
if (auto opaqueDecl = vd->getOpaqueResultTypeDecl()) {
27022702
auto inserted = ValidatedOpaqueReturnTypes.insert(
27032703
{opaqueDecl->getOpaqueReturnTypeIdentifier().str(),
@@ -2708,7 +2708,6 @@ ArrayRef<OpaqueTypeDecl *> SourceFile::getOpaqueReturnTypeDecls() {
27082708
}
27092709
}
27102710

2711-
UnvalidatedDeclsWithOpaqueReturnTypes.clear();
27122711
return OpaqueReturnTypes;
27132712
}
27142713

0 commit comments

Comments
 (0)