本文整理汇总了C++中SILGenFunction::emitAddressorAccessor方法的典型用法代码示例。如果您正苦于以下问题:C++ SILGenFunction::emitAddressorAccessor方法的具体用法?C++ SILGenFunction::emitAddressorAccessor怎么用?C++ SILGenFunction::emitAddressorAccessor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SILGenFunction
的用法示例。
在下文中一共展示了SILGenFunction::emitAddressorAccessor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: emitUsingAddressor
/// Emit a materializeForSet operation that calls a mutable addressor.
///
/// If it's not an unsafe addressor, this uses a callback function to
/// write the l-value back.
SILValue MaterializeForSetEmitter::emitUsingAddressor(SILGenFunction &SGF,
SILLocation loc,
ManagedValue self,
RValue &&indices,
SILValue callbackBuffer,
SILFunction *&callback) {
bool isDirect = (TheAccessSemantics != AccessSemantics::Ordinary);
// Call the mutable addressor.
auto addressor = SGF.getAddressorDeclRef(WitnessStorage,
AccessKind::ReadWrite,
isDirect);
std::pair<ManagedValue, ManagedValue> result;
{
FormalEvaluationScope Scope(SGF);
SILType addressType = WitnessStorageType.getAddressType();
ArgumentSource baseRV =
SGF.prepareAccessorBaseArg(loc, self, SubstSelfType, addressor);
result = SGF.emitAddressorAccessor(loc, addressor, WitnessSubs,
std::move(baseRV), IsSuper, isDirect,
std::move(indices), addressType);
}
SILValue address = result.first.getUnmanagedValue();
AddressorKind addressorKind =
WitnessStorage->getMutableAddressor()->getAddressorKind();
ManagedValue owner = result.second;
if (!owner) {
assert(addressorKind == AddressorKind::Unsafe);
} else {
SILValue allocatedCallbackBuffer =
SGF.B.createAllocValueBuffer(loc, owner.getType(), callbackBuffer);
SGF.B.emitStoreValueOperation(loc, owner.forward(SGF),
allocatedCallbackBuffer,
StoreOwnershipQualifier::Init);
callback = createAddressorCallback(SGF.F, owner.getType(), addressorKind);
}
return address;
}