/// \brief Given a protocol \p Proto, a member method \p Member and a concrete /// class type \p ConcreteTy, search the witness tables and return the static /// function that matches the member with any specializations may be /// required. Notice that we do not scan the class hierarchy, just the concrete /// class type. std::tuple<SILFunction *, SILWitnessTable *, ArrayRef<Substitution>> SILModule::lookUpFunctionInWitnessTable(const ProtocolConformance *C, SILDeclRef Member) { // Look up the witness table associated with our protocol conformance from the // SILModule. auto Ret = lookUpWitnessTable(C); // If no witness table was found, bail. if (!Ret.first) { DEBUG(llvm::dbgs() << " Failed speculative lookup of witness for: "; if (C) C->dump(); else Member.dump()); return std::make_tuple(nullptr, nullptr, ArrayRef<Substitution>()); }
/// \brief Given a conformance \p C and a protocol requirement \p Requirement, /// search the witness table for the conformance and return the witness thunk /// for the requirement. std::pair<SILFunction *, SILWitnessTable *> SILModule::lookUpFunctionInWitnessTable(ProtocolConformanceRef C, SILDeclRef Requirement) { // Look up the witness table associated with our protocol conformance from the // SILModule. auto Ret = lookUpWitnessTable(C); // If no witness table was found, bail. if (!Ret) { DEBUG(llvm::dbgs() << " Failed speculative lookup of witness for: "; C.dump(); Requirement.dump()); return std::make_pair(nullptr, nullptr); }