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.
This commit is contained in:
Erik Eckstein
2024-11-27 18:02:01 +01:00
parent 9279a2c0d6
commit e156da9167

View File

@@ -1095,7 +1095,9 @@ public:
/// Get the source location of the function.
SILLocation getLocation() const {
assert(DebugScope && "no scope/location");
if (!DebugScope) {
return SILLocation::invalid();
}
return getDebugScope()->Loc;
}