[CS] Allow getCalleeLocator to find key path component callees

In order to do this we need it to take a ConstraintLocator argument so
we can tell which component we want the callee for. To make it clear
that we're looking for a callee at the anchor, also rename the member
to getAnchormostCalleeLocator.
This commit is contained in:
Hamish Knight
2019-08-30 16:19:57 +01:00
parent b8b93eb7f5
commit 67ee821123
5 changed files with 86 additions and 32 deletions

View File

@@ -3023,6 +3023,8 @@ namespace {
}
case KeyPathExpr::Component::Kind::TupleElement: {
// Note: If implemented, the logic in `getAnchormostCalleeLocator`
// will need updating to return the correct callee locator for this.
llvm_unreachable("not implemented");
break;
}
@@ -3256,7 +3258,9 @@ namespace {
// Record the labels.
if (!labelsArePermanent)
info.Labels = CS.allocateCopy(info.Labels);
CS.ArgumentInfos[CS.getArgumentInfoLocator(expr)] = info;
auto *locator = CS.getConstraintLocator(expr);
CS.ArgumentInfos[CS.getArgumentInfoLocator(locator)] = info;
}
};