本文整理汇总了C++中IRGenModule::isResilient方法的典型用法代码示例。如果您正苦于以下问题:C++ IRGenModule::isResilient方法的具体用法?C++ IRGenModule::isResilient怎么用?C++ IRGenModule::isResilient使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRGenModule
的用法示例。
在下文中一共展示了IRGenModule::isResilient方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: noteStartOfImmediateMembers
void noteStartOfImmediateMembers(ClassDecl *forClass) {
// If our superclass is resilient to us, or the class itself is resilient
// to us, we will access metadata members relative to a base offset.
if (forClass == Target) {
Layout.StartOfImmediateMembers = getNextOffset();
if (Layout.HasResilientSuperclass ||
IGM.isResilient(forClass, ResilienceExpansion::Maximal)) {
assert(!DynamicOffsetBase);
DynamicOffsetBase = NextOffset;
}
}
}
示例2: builder
/// Perform structure layout on the given types.
StructLayout::StructLayout(IRGenModule &IGM, CanType astTy,
LayoutKind layoutKind,
LayoutStrategy strategy,
ArrayRef<const TypeInfo *> types,
llvm::StructType *typeToFill) {
ASTTy = astTy;
Elements.reserve(types.size());
// Fill in the Elements array.
for (auto type : types)
Elements.push_back(ElementLayout::getIncomplete(*type, *type));
assert(typeToFill == nullptr || typeToFill->isOpaque());
StructLayoutBuilder builder(IGM);
// Add the heap header if necessary.
if (requiresHeapHeader(layoutKind)) {
builder.addHeapHeader();
}
bool nonEmpty = builder.addFields(Elements, strategy);
// Special-case: there's nothing to store.
// In this case, produce an opaque type; this tends to cause lovely
// assertions.
if (!nonEmpty) {
assert(!builder.empty() == requiresHeapHeader(layoutKind));
MinimumAlign = Alignment(1);
MinimumSize = Size(0);
SpareBits.clear();
IsFixedLayout = true;
IsKnownPOD = IsPOD;
IsKnownBitwiseTakable = IsBitwiseTakable;
IsKnownAlwaysFixedSize = IsFixedSize;
Ty = (typeToFill ? typeToFill : IGM.OpaquePtrTy->getElementType());
} else {
MinimumAlign = builder.getAlignment();
MinimumSize = builder.getSize();
SpareBits = std::move(builder.getSpareBits());
IsFixedLayout = builder.isFixedLayout();
IsKnownPOD = builder.isPOD();
IsKnownBitwiseTakable = builder.isBitwiseTakable();
IsKnownAlwaysFixedSize = builder.isAlwaysFixedSize();
if (typeToFill) {
builder.setAsBodyOfStruct(typeToFill);
Ty = typeToFill;
} else {
Ty = builder.getAsAnonStruct();
}
}
// If the struct is not @_fixed_layout, it will have a dynamic
// layout outside of its resilience domain.
if (astTy && astTy->getAnyNominal())
if (IGM.isResilient(astTy->getAnyNominal(), ResilienceExpansion::Minimal))
IsKnownAlwaysFixedSize = IsNotFixedSize;
assert(typeToFill == nullptr || Ty == typeToFill);
if (ASTTy)
applyLayoutAttributes(IGM, ASTTy, IsFixedLayout, MinimumAlign);
}