[ConstraintSystem] Add a helper to determine whether locator is for argument to C/ObjC imported decl

This commit is contained in:
Pavel Yaskevich
2021-06-16 12:13:52 -07:00
parent 3a41f7af5f
commit 4f97ef0e75
2 changed files with 20 additions and 0 deletions

View File

@@ -4999,6 +4999,22 @@ bool constraints::isArgumentOfReferenceEqualityOperator(
isOperatorArgument(locator, "!==");
}
bool ConstraintSystem::isArgumentOfImportedDecl(
ConstraintLocatorBuilder locator) {
auto last = locator.last();
if (!(last && last->is<LocatorPathElt::ApplyArgToParam>()))
return false;
auto *application = getCalleeLocator(getConstraintLocator(locator));
auto overload = findSelectedOverloadFor(application);
if (!(overload && overload->choice.isDecl()))
return false;
auto *choice = overload->choice.getDecl();
return choice->hasClangNode();
}
ConversionEphemeralness
ConstraintSystem::isConversionEphemeral(ConversionRestrictionKind conversion,
ConstraintLocatorBuilder locator) {