本文整理汇总了C++中ApplySite::getFunction方法的典型用法代码示例。如果您正苦于以下问题:C++ ApplySite::getFunction方法的具体用法?C++ ApplySite::getFunction怎么用?C++ ApplySite::getFunction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApplySite
的用法示例。
在下文中一共展示了ApplySite::getFunction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: canDevirtualizeWitnessMethod
static bool canDevirtualizeWitnessMethod(ApplySite AI) {
SILFunction *F;
SILWitnessTable *WT;
auto *WMI = cast<WitnessMethodInst>(AI.getCallee());
std::tie(F, WT) =
AI.getModule().lookUpFunctionInWitnessTable(WMI->getConformance(),
WMI->getMember());
if (!F)
return false;
if (AI.getFunction()->isSerialized()) {
// function_ref inside fragile function cannot reference a private or
// hidden symbol.
if (!F->hasValidLinkageForFragileRef())
return false;
}
return true;
}
示例2: tryDevirtualizeWitnessMethod
/// In the cases where we can statically determine the function that
/// we'll call to, replace an apply of a witness_method with an apply
/// of a function_ref, returning the new apply.
DevirtualizationResult swift::tryDevirtualizeWitnessMethod(ApplySite AI) {
SILFunction *F;
SILWitnessTable *WT;
auto *WMI = cast<WitnessMethodInst>(AI.getCallee());
std::tie(F, WT) =
AI.getModule().lookUpFunctionInWitnessTable(WMI->getConformance(),
WMI->getMember());
if (!F)
return std::make_pair(nullptr, FullApplySite());
if (AI.getFunction()->isFragile()) {
// function_ref inside fragile function cannot reference a private or
// hidden symbol.
if (!F->hasValidLinkageForFragileRef())
return std::make_pair(nullptr, FullApplySite());
}
auto Result = devirtualizeWitnessMethod(AI, F, WMI->getConformance());
return std::make_pair(Result.getInstruction(), Result);
}