Skip to content

Commit 67730c1

Browse files
committed
[silgen] If SILVerifyAll is enabled verify the body of thunks in buildThunkBody.
This just ensures that all thunks are verified right when they are created. This is necessary since some thunks do not go through function post processing.
1 parent 4da795f commit 67730c1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/SILGen/SILGenPoly.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
#include "Scope.h"
9696
#include "TupleGenerators.h"
9797
#include "swift/Basic/Assertions.h"
98+
#include "swift/Basic/Defer.h"
9899
#include "swift/Basic/Generators.h"
99100
#include "swift/AST/ASTMangler.h"
100101
#include "swift/AST/ConformanceLookup.h"
@@ -5400,6 +5401,11 @@ static void buildThunkBody(SILGenFunction &SGF, SILLocation loc,
54005401
PrettyStackTraceSILFunction stackTrace("emitting reabstraction thunk in",
54015402
&SGF.F);
54025403
auto thunkType = SGF.F.getLoweredFunctionType();
5404+
SWIFT_DEFER {
5405+
// If verify all is enabled, verify thunk bodies.
5406+
if (SGF.getASTContext().SILOpts.VerifyAll)
5407+
SGF.F.verify();
5408+
};
54035409

54045410
FullExpr scope(SGF.Cleanups, CleanupLocation(loc));
54055411

0 commit comments

Comments
 (0)