Skip to content

Commit 28246a7

Browse files
committed
[SILGen] Use getTypecheckedBody
Use `getTypecheckedBody` to allow lazy type-checking when emitting function definitions.
1 parent 8fd6d7e commit 28246a7

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

lib/SILGen/SILGenConstructor.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,9 @@ void SILGenFunction::emitValueConstructor(ConstructorDecl *ctor) {
393393
emitMemberInitializers(ctor, selfDecl, nominal);
394394
}
395395

396-
emitProfilerIncrement(ctor->getBody());
396+
emitProfilerIncrement(ctor->getTypecheckedBody());
397397
// Emit the constructor body.
398-
emitStmt(ctor->getBody());
398+
emitStmt(ctor->getTypecheckedBody());
399399

400400

401401
// Build a custom epilog block, since the AST representation of the
@@ -622,7 +622,7 @@ void SILGenFunction::emitClassConstructorAllocator(ConstructorDecl *ctor) {
622622
SILValue initedSelfValue = emitApplyWithRethrow(Loc, initVal.forward(*this),
623623
initTy, subMap, args);
624624

625-
emitProfilerIncrement(ctor->getBody());
625+
emitProfilerIncrement(ctor->getTypecheckedBody());
626626

627627
// Return the initialized 'self'.
628628
B.createReturn(ImplicitReturnLocation::getImplicitReturnLoc(Loc),
@@ -632,7 +632,7 @@ void SILGenFunction::emitClassConstructorAllocator(ConstructorDecl *ctor) {
632632
void SILGenFunction::emitClassConstructorInitializer(ConstructorDecl *ctor) {
633633
MagicFunctionName = SILGenModule::getMagicFunctionName(ctor);
634634

635-
assert(ctor->getBody() && "Class constructor without a body?");
635+
assert(ctor->getTypecheckedBody() && "Class constructor without a body?");
636636

637637
// True if this constructor delegates to a peer constructor with self.init().
638638
bool isDelegating = false;
@@ -775,9 +775,9 @@ void SILGenFunction::emitClassConstructorInitializer(ConstructorDecl *ctor) {
775775
emitMemberInitializers(ctor, selfDecl, selfClassDecl);
776776
}
777777

778-
emitProfilerIncrement(ctor->getBody());
778+
emitProfilerIncrement(ctor->getTypecheckedBody());
779779
// Emit the constructor body.
780-
emitStmt(ctor->getBody());
780+
emitStmt(ctor->getTypecheckedBody());
781781

782782
// Emit the call to super.init() right before exiting from the initializer.
783783
if (NeedsBoxForSelf) {

lib/SILGen/SILGenDestructor.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ void SILGenFunction::emitDestroyingDestructor(DestructorDecl *dd) {
3535
// We won't actually emit the block until we finish with the destructor body.
3636
prepareEpilog(false, false, CleanupLocation::get(Loc));
3737

38-
emitProfilerIncrement(dd->getBody());
38+
emitProfilerIncrement(dd->getTypecheckedBody());
3939
// Emit the destructor body.
40-
emitStmt(dd->getBody());
40+
emitStmt(dd->getTypecheckedBody());
4141

4242
Optional<SILValue> maybeReturnValue;
4343
SILLocation returnLoc(Loc);
@@ -151,7 +151,7 @@ void SILGenFunction::emitDeallocatingDestructor(DestructorDecl *dd) {
151151
selfForDealloc = B.createUncheckedRefCast(loc, selfForDealloc, classTy);
152152
B.createDeallocRef(loc, selfForDealloc, false);
153153

154-
emitProfilerIncrement(dd->getBody());
154+
emitProfilerIncrement(dd->getTypecheckedBody());
155155

156156
// Return.
157157
B.createReturn(loc, emitEmptyTuple(loc));
@@ -212,9 +212,9 @@ void SILGenFunction::emitObjCDestructor(SILDeclRef dtor) {
212212
// We won't actually emit the block until we finish with the destructor body.
213213
prepareEpilog(false, false, CleanupLocation::get(loc));
214214

215-
emitProfilerIncrement(dd->getBody());
215+
emitProfilerIncrement(dd->getTypecheckedBody());
216216
// Emit the destructor body.
217-
emitStmt(dd->getBody());
217+
emitStmt(dd->getTypecheckedBody());
218218

219219
Optional<SILValue> maybeReturnValue;
220220
SILLocation returnLoc(loc);

lib/SILGen/SILGenFunction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,8 @@ void SILGenFunction::emitFunction(FuncDecl *fd) {
510510
fd->getResultInterfaceType(), fd->hasThrows(), fd->getThrowsLoc());
511511
prepareEpilog(true, fd->hasThrows(), CleanupLocation(fd));
512512

513-
emitProfilerIncrement(fd->getBody());
514-
emitStmt(fd->getBody());
513+
emitProfilerIncrement(fd->getTypecheckedBody());
514+
emitStmt(fd->getTypecheckedBody());
515515

516516
emitEpilog(fd);
517517

0 commit comments

Comments
 (0)