Skip to content

Commit 4f032cd

Browse files
committed
Make source locations for standard library calls explicit
1 parent 4d1d8a9 commit 4f032cd

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
@@ -5935,6 +5935,10 @@ RValue SILGenFunction::emitApplyOfLibraryIntrinsic(SILLocation loc,
59355935
SubstitutionMap subMap,
59365936
ArrayRef<ManagedValue> args,
59375937
SGFContext ctx) {
5938+
// Calls into library intrinsics are implicitly generated by the compiler.
5939+
// Marking them as explicit creates a backtrace pointing back to the user code
5940+
// that the intrinsic call was generated from.
5941+
loc.markExplicit();
59385942
auto callee = Callee::forDirect(*this, declRef, subMap, loc);
59395943

59405944
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)