Skip to content

Commit 22c2866

Browse files
committed
[Sema] Fix UB in TypeChecker::computeCaptures()
The function would attempt to walk the body of bodiless members (e.g. stored property accessors). This change simply skips walking the body in such cases.
1 parent 1446015 commit 22c2866

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: lib/Sema/TypeCheckCaptures.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,8 @@ void TypeChecker::computeCaptures(AnyFunctionRef AFR) {
719719
DynamicSelfCaptureLoc,
720720
DynamicSelf,
721721
AFR);
722-
AFR.getBody()->walk(finder);
722+
if (AFR.getBody())
723+
AFR.getBody()->walk(finder);
723724

724725
unsigned inoutCount = 0;
725726
for (auto C : Captures) {

0 commit comments

Comments
 (0)