Rename and move a function that checks for unbound generics.

In the short term this will also be used to determine if we can inline
generic functions.

Swift SVN r18972
This commit is contained in:
Mark Lacey
2014-06-18 02:51:23 +00:00
parent 94072c5379
commit c7d3c3cd01
3 changed files with 14 additions and 13 deletions

View File

@@ -35,18 +35,6 @@ static bool canSpecializeFunction(SILFunction *F) {
return !F->isExternalDeclaration();
}
/// \brief return true if we can specialize the function type with a specific
/// substitution list without doing partial specialization.
static bool canSpecializeFunctionWithSubList(SILFunction *F,
TypeSubstitutionMap &SubsMap) {
// Check whether any of the substitutions are dependent.
for (auto &entry : SubsMap) {
if (hasUnboundGenericTypes(entry.second->getCanonicalType()))
return false;
}
return true;
}
namespace {
class SpecializingCloner : public TypeSubstCloner<SpecializingCloner> {
@@ -306,7 +294,8 @@ GenericSpecializer::specializeApplyInstGroup(SILFunction *F, AIList &List) {
= F->getContextGenericParams()
->getSubstitutionMap(Bucket[0]->getSubstitutions());
if (!canSpecializeFunctionWithSubList(F, InterfaceSubs)) {
// We do not support partial specialization.
if (hasUnboundGenericTypes(InterfaceSubs)) {
DEBUG(llvm::dbgs() << " Can not specialize with interface subs.\n");
continue;
}