mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
IRGen: EmptyBoxType's representation cannot be nil because of a conflict with extra inhabitant assumption in indirect enums (#10326)
* IRGen: EmptyBoxType's representation cannot be nil because of a conflict with extra inhabitant assumption in indirect enums We map nil to the .None case of Optional. Instead use a singleton object. SR-5148 rdar://32618580
This commit is contained in:
committed by
GitHub
parent
6f3b8ca60f
commit
48e889b51b
@@ -209,6 +209,20 @@ llvm::Value *IRGenFunction::emitProjectBoxCall(llvm::Value *box,
|
||||
return call;
|
||||
}
|
||||
|
||||
llvm::Value *IRGenFunction::emitAllocEmptyBoxCall() {
|
||||
llvm::Attribute::AttrKind attrKinds[] = {
|
||||
llvm::Attribute::NoUnwind,
|
||||
};
|
||||
auto attrs = llvm::AttributeSet::get(IGM.LLVMContext,
|
||||
llvm::AttributeSet::FunctionIndex,
|
||||
attrKinds);
|
||||
llvm::CallInst *call =
|
||||
Builder.CreateCall(IGM.getAllocEmptyBoxFn(), {});
|
||||
call->setCallingConv(IGM.DefaultCC);
|
||||
call->setAttributes(attrs);
|
||||
return call;
|
||||
}
|
||||
|
||||
static void emitDeallocatingCall(IRGenFunction &IGF, llvm::Constant *fn,
|
||||
std::initializer_list<llvm::Value *> args) {
|
||||
auto cc = IGF.IGM.DefaultCC;
|
||||
|
||||
Reference in New Issue
Block a user