Portability: use std::make_tuple instead of relying on a libc++ extension (an

implicit constructor in std::tuple)


Swift SVN r9615
This commit is contained in:
Dmitri Hrybenko
2013-10-23 06:17:28 +00:00
parent 905078a278
commit 80d753d0ab
8 changed files with 34 additions and 30 deletions

View File

@@ -583,7 +583,8 @@ findExplicitConformance(NominalTypeDecl *nominal, ProtocolDecl *protocol,
}
if (visitedProtocols.insert(testProto))
stack.push_back({testProto, currentNominal, currentOwner});
stack.push_back(
std::make_tuple(testProto, currentNominal, currentOwner));
}
return false;
@@ -592,7 +593,7 @@ findExplicitConformance(NominalTypeDecl *nominal, ProtocolDecl *protocol,
resolver->resolveDeclSignature(nominal);
// Walk the stack of types to find a conformance.
stack.push_back({nominal, nominal, nominal});
stack.push_back(std::make_tuple(nominal, nominal, nominal));
while (!stack.empty()) {
NominalTypeDecl *current;
NominalTypeDecl *currentNominal;
@@ -604,7 +605,7 @@ findExplicitConformance(NominalTypeDecl *nominal, ProtocolDecl *protocol,
if (auto classDecl = dyn_cast<ClassDecl>(current)) {
if (auto superclassTy = classDecl->getSuperclass()) {
auto nominal = superclassTy->getAnyNominal();
stack.push_back({nominal, nominal, nominal});
stack.push_back(std::make_tuple(nominal, nominal, nominal));
}
}
@@ -625,7 +626,7 @@ findExplicitConformance(NominalTypeDecl *nominal, ProtocolDecl *protocol,
// If we didn't find the protocol, we don't conform. Cache the negative result
// and return.
if (!owningNominal) {
return { nullptr, nullptr, nullptr };
return std::make_tuple(nullptr, nullptr, nullptr);
}
// If we don't have a nominal conformance, but we do have a resolver, try
@@ -639,10 +640,11 @@ findExplicitConformance(NominalTypeDecl *nominal, ProtocolDecl *protocol,
// If we have a nominal conformance, we're done.
if (nominalConformance) {
return { owningNominal, declaresConformance, nominalConformance };
return std::make_tuple(owningNominal, declaresConformance,
nominalConformance);
}
return { nullptr, nullptr, nullptr };
return std::make_tuple(nullptr, nullptr, nullptr);
}
LookupConformanceResult Module::lookupConformance(Type type,