Skip to content

Commit 0e55f81

Browse files
Merge pull request #66580 from adrian-prantl/110333983
Make source locations for standard library calls explicit
2 parents d2681c5 + 4f032cd commit 0e55f81

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

lib/SILGen/SILGenApply.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6821,6 +6821,10 @@ RValue SILGenFunction::emitApplyOfLibraryIntrinsic(SILLocation loc,
68216821
SubstitutionMap subMap,
68226822
ArrayRef<ManagedValue> args,
68236823
SGFContext ctx) {
6824+
// Calls into library intrinsics are implicitly generated by the compiler.
6825+
// Marking them as explicit creates a backtrace pointing back to the user code
6826+
// that the intrinsic call was generated from.
6827+
loc.markExplicit();
68246828
auto callee = Callee::forDirect(*this, declRef, subMap, loc);
68256829

68266830
auto origFormalType = callee.getOrigFormalType();

test/DebugInfo/iuo_assertloc.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: %target-swift-frontend %s -emit-sil -parse-as-library -g -o - | %FileCheck %s --check-prefix=CHECK-SIL
2+
// RUN: %target-swift-frontend %s -emit-ir -parse-as-library -g -o - | %FileCheck %s --check-prefix=CHECK-IR
3+
4+
public func f(_ a: Int!) -> Int {
5+
// CHECK-IR: call {{.*}}assertionFailure{{.*}}, !dbg ![[LOC:[0-9]+]]
6+
// CHECK-IR: ![[LOC]] = !DILocation(line: [[@LINE+1]], column: 11
7+
return (a // CHECK-SIL: apply {{.*}}:[[@LINE]]:11
8+
+
9+
1)
10+
}

0 commit comments

Comments
 (0)