Skip to content

Commit bee1d94

Browse files
committed
SIL: fix a crash when constructing a debug location in mandatory inlining
There was one case which was not handled and that's inlining of a compiler intrinsic. In this case there is a different location type on the function call. rdar://problem/49651421
1 parent c2107ab commit bee1d94

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

include/swift/SIL/SILLocation.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,8 @@ class MandatoryInlinedLocation : public SILLocation {
687687
: SILLocation(D, MandatoryInlinedKind, F) {}
688688
MandatoryInlinedLocation(SourceLoc L, unsigned F)
689689
: SILLocation(L, MandatoryInlinedKind, F) {}
690+
MandatoryInlinedLocation(DebugLoc L, unsigned F)
691+
: SILLocation(L, MandatoryInlinedKind, F) {}
690692
};
691693

692694
/// Used on the instruction performing auto-generated cleanup such as

lib/SIL/SILLocation.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ MandatoryInlinedLocation::getMandatoryInlinedLocation(SILLocation L) {
217217
if (L.isInTopLevel())
218218
return MandatoryInlinedLocation::getModuleLocation(L.getSpecialFlags());
219219

220+
if (L.isDebugInfoLoc())
221+
return MandatoryInlinedLocation(L.getDebugInfoLoc(), L.getSpecialFlags());
222+
220223
llvm_unreachable("Cannot construct Inlined loc from the given location.");
221224
}
222225

0 commit comments

Comments
 (0)