Skip to content

Commit e156da9

Browse files
committed
SIL: make sure to not crash if a function doesn't have a DebugScope
Change an assert to a bail-out condition. I found that it _can_ happen to have a function without a debug scope. In such a case even printing the SIL crashed. Be a bit more tolerant.
1 parent 9279a2c commit e156da9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

include/swift/SIL/SILFunction.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,9 @@ class SILFunction
10951095

10961096
/// Get the source location of the function.
10971097
SILLocation getLocation() const {
1098-
assert(DebugScope && "no scope/location");
1098+
if (!DebugScope) {
1099+
return SILLocation::invalid();
1100+
}
10991101
return getDebugScope()->Loc;
11001102
}
11011103

0 commit comments

Comments
 (0)