33
33
#include " swift/AST/TypeMatcher.h"
34
34
#include " swift/AST/TypeRepr.h"
35
35
#include " llvm/ADT/SmallVector.h"
36
+ #include " llvm/ADT/SetVector.h"
36
37
#include " RequirementMachine.h"
37
38
#include " RewriteContext.h"
38
39
#include " RewriteSystem.h"
@@ -1014,7 +1015,7 @@ ArrayRef<ProtocolDecl *>
1014
1015
ProtocolDependenciesRequest::evaluate (Evaluator &evaluator,
1015
1016
ProtocolDecl *proto) const {
1016
1017
auto &ctx = proto->getASTContext ();
1017
- SmallVector <ProtocolDecl *, 4 > result;
1018
+ SmallSetVector <ProtocolDecl *, 4 > result;
1018
1019
1019
1020
// If we have a serialized requirement signature, deserialize it and
1020
1021
// look at conformance requirements.
@@ -1026,7 +1027,7 @@ ProtocolDependenciesRequest::evaluate(Evaluator &evaluator,
1026
1027
== RequirementMachineMode::Disabled)) {
1027
1028
for (auto req : proto->getRequirementSignature ().getRequirements ()) {
1028
1029
if (req.getKind () == RequirementKind::Conformance) {
1029
- result.push_back (req.getProtocolDecl ());
1030
+ result.insert (req.getProtocolDecl ());
1030
1031
}
1031
1032
}
1032
1033
@@ -1038,7 +1039,7 @@ ProtocolDependenciesRequest::evaluate(Evaluator &evaluator,
1038
1039
// signature. Look at the structural requirements instead.
1039
1040
for (auto req : proto->getStructuralRequirements ()) {
1040
1041
if (req.req .getKind () == RequirementKind::Conformance)
1041
- result.push_back (req.req .getProtocolDecl ());
1042
+ result.insert (req.req .getProtocolDecl ());
1042
1043
}
1043
1044
1044
1045
return ctx.AllocateCopy (result);
0 commit comments