本文整理汇总了C++中SGFContext::isGuaranteedPlusZeroOk方法的典型用法代码示例。如果您正苦于以下问题:C++ SGFContext::isGuaranteedPlusZeroOk方法的具体用法?C++ SGFContext::isGuaranteedPlusZeroOk怎么用?C++ SGFContext::isGuaranteedPlusZeroOk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SGFContext
的用法示例。
在下文中一共展示了SGFContext::isGuaranteedPlusZeroOk方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: manageOpaqueValue
ManagedValue SILGenFunction::manageOpaqueValue(OpaqueValueState &entry,
SILLocation loc,
SGFContext C) {
// If the opaque value is consumable, we can just return the
// value with a cleanup. There is no need to retain it separately.
if (entry.IsConsumable) {
assert(!entry.HasBeenConsumed
&& "Uniquely-referenced opaque value already consumed");
entry.HasBeenConsumed = true;
return entry.Value;
}
assert(!entry.Value.hasCleanup());
// If the context wants a +0 value, guaranteed or immediate, we can
// give it to them, because OpenExistential emission guarantees the
// value.
if (C.isGuaranteedPlusZeroOk()) {
return entry.Value;
}
// If the context wants us to initialize a buffer, copy there instead
// of making a temporary allocation.
if (auto I = C.getEmitInto()) {
if (SILValue address = I->getAddressForInPlaceInitialization()) {
entry.Value.copyInto(*this, address, loc);
I->finishInitialization(*this);
return ManagedValue::forInContext();
}
}
// Otherwise, copy the value into a temporary.
return entry.Value.copyUnmanaged(*this, loc);
}