Skip to content

Commit ae77d22

Browse files
committed
AST: Don't clone TypeReprs in GenericParamList::clone()
1 parent 80919e9 commit ae77d22

File tree

1 file changed

+1
-41
lines changed

1 file changed

+1
-41
lines changed

lib/AST/Decl.cpp

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -924,53 +924,13 @@ GenericParamList::clone(DeclContext *dc) const {
924924
GenericTypeParamDecl::InvalidDepth,
925925
param->getIndex());
926926
params.push_back(newParam);
927-
928-
SmallVector<TypeLoc, 2> inherited;
929-
for (auto loc : param->getInherited())
930-
inherited.push_back(loc.clone(ctx));
931-
newParam->setInherited(ctx.AllocateCopy(inherited));
932-
}
933-
934-
SmallVector<RequirementRepr, 2> requirements;
935-
for (auto reqt : getRequirements()) {
936-
switch (reqt.getKind()) {
937-
case RequirementReprKind::TypeConstraint: {
938-
auto first = reqt.getSubjectLoc();
939-
auto second = reqt.getConstraintLoc();
940-
reqt = RequirementRepr::getTypeConstraint(
941-
first.clone(ctx),
942-
reqt.getSeparatorLoc(),
943-
second.clone(ctx));
944-
break;
945-
}
946-
case RequirementReprKind::SameType: {
947-
auto first = reqt.getFirstTypeLoc();
948-
auto second = reqt.getSecondTypeLoc();
949-
reqt = RequirementRepr::getSameType(
950-
first.clone(ctx),
951-
reqt.getSeparatorLoc(),
952-
second.clone(ctx));
953-
break;
954-
}
955-
case RequirementReprKind::LayoutConstraint: {
956-
auto first = reqt.getSubjectLoc();
957-
auto layout = reqt.getLayoutConstraintLoc();
958-
reqt = RequirementRepr::getLayoutConstraint(
959-
first.clone(ctx),
960-
reqt.getSeparatorLoc(),
961-
layout);
962-
break;
963-
}
964-
}
965-
966-
requirements.push_back(reqt);
967927
}
968928

969929
return GenericParamList::create(ctx,
970930
getLAngleLoc(),
971931
params,
972932
getWhereLoc(),
973-
requirements,
933+
/*requirements=*/{},
974934
getRAngleLoc());
975935
}
976936

0 commit comments

Comments
 (0)