mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Rework the IR-generation of initialization and teach the
compiler to enter properly-scoped cleanups to destroy local variables. Swift SVN r1385
This commit is contained in:
@@ -53,6 +53,7 @@ IRGenModule::IRGenModule(ASTContext &Context,
|
||||
AllocFn = nullptr;
|
||||
RetainFn = nullptr;
|
||||
ReleaseFn = nullptr;
|
||||
DeallocFn = nullptr;
|
||||
|
||||
RefCountedStructTy =
|
||||
llvm::StructType::create(getLLVMContext(), "swift.refcounted");
|
||||
@@ -109,6 +110,15 @@ llvm::Constant *IRGenModule::getReleaseFn() {
|
||||
return ReleaseFn;
|
||||
}
|
||||
|
||||
llvm::Constant *IRGenModule::getDeallocFn() {
|
||||
if (DeallocFn) return DeallocFn;
|
||||
|
||||
llvm::FunctionType *fnType =
|
||||
llvm::FunctionType::get(VoidTy, RefCountedPtrTy, false);
|
||||
DeallocFn = Module.getOrInsertFunction("swift_dealloc", fnType);
|
||||
return DeallocFn;
|
||||
}
|
||||
|
||||
void IRGenModule::unimplemented(SourceLoc Loc, StringRef Message) {
|
||||
Context.Diags.diagnose(Loc, diag::irgen_unimplemented, Message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user