Skip to content

Commit 6badca6

Browse files
xedinrjmccall
authored andcommitted
[PackExpansionMatcher] Adjust ParamPackMatcher to account for labels
First step in preparation to unify different matchers which is effectively no-op because function parameters do not have labels. - Common prefix/suffix should account for presence of labels - Labeled parameters cannot appear in the region absorbed by a pack expansion type.
1 parent a4edc3e commit 6badca6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/AST/PackExpansionMatcher.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ bool ParamPackMatcher::match() {
142142
auto lhsParam = lhsParams[lhsIdx];
143143
auto rhsParam = rhsParams[rhsIdx];
144144

145+
if (lhsParam.getLabel() != rhsParam.getLabel())
146+
break;
147+
145148
// FIXME: Check flags
146149

147150
auto lhsType = lhsParam.getPlainType();
@@ -170,6 +173,9 @@ bool ParamPackMatcher::match() {
170173

171174
// FIXME: Check flags
172175

176+
if (lhsParam.getLabel() != rhsParam.getLabel())
177+
break;
178+
173179
auto lhsType = lhsParam.getPlainType();
174180
auto rhsType = rhsParam.getPlainType();
175181

@@ -203,6 +209,9 @@ bool ParamPackMatcher::match() {
203209

204210
SmallVector<Type, 2> rhsTypes;
205211
for (auto rhsParam : rhsParams) {
212+
if (rhsParam.hasLabel())
213+
return true;
214+
206215
// FIXME: Check rhs flags
207216
rhsTypes.push_back(rhsParam.getPlainType());
208217
}
@@ -224,6 +233,9 @@ bool ParamPackMatcher::match() {
224233

225234
SmallVector<Type, 2> lhsTypes;
226235
for (auto lhsParam : lhsParams) {
236+
if (lhsParam.hasLabel())
237+
return true;
238+
227239
// FIXME: Check lhs flags
228240
lhsTypes.push_back(lhsParam.getPlainType());
229241
}

0 commit comments

Comments
 (0)