mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user