mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Eliminate non-deterministic behavior when removing duplicate declarations after module lookup.
Big thanks to JoeP for pointing this out! No specific test case here. Swift SVN r19177
This commit is contained in:
@@ -234,9 +234,13 @@ static void lookupInModule(Module *module, Module::AccessPathTy accessPath,
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(decls.begin() + initialCount, decls.end());
|
||||
auto afterUnique = std::unique(decls.begin() + initialCount, decls.end());
|
||||
decls.erase(afterUnique, decls.end());
|
||||
// Remove duplicated declarations.
|
||||
llvm::SmallPtrSet<ValueDecl *, 4> knownDecls;
|
||||
decls.erase(std::remove_if(decls.begin() + initialCount, decls.end(),
|
||||
[&](ValueDecl *d) -> bool {
|
||||
return !knownDecls.insert(d);
|
||||
}),
|
||||
decls.end());
|
||||
|
||||
auto &cachedValues = cache[{accessPath, module}];
|
||||
cachedValues.insert(cachedValues.end(),
|
||||
|
||||
Reference in New Issue
Block a user