Merge pull request #66580 from adrian-prantl/110333983

Make source locations for standard library calls explicit
This commit is contained in:
Adrian Prantl
2025-12-02 08:56:32 -08:00
committed by GitHub
2 changed files with 14 additions and 0 deletions

View File

@@ -6821,6 +6821,10 @@ RValue SILGenFunction::emitApplyOfLibraryIntrinsic(SILLocation loc,
SubstitutionMap subMap,
ArrayRef<ManagedValue> args,
SGFContext ctx) {
// Calls into library intrinsics are implicitly generated by the compiler.
// Marking them as explicit creates a backtrace pointing back to the user code
// that the intrinsic call was generated from.
loc.markExplicit();
auto callee = Callee::forDirect(*this, declRef, subMap, loc);
auto origFormalType = callee.getOrigFormalType();

View File

@@ -0,0 +1,10 @@
// RUN: %target-swift-frontend %s -emit-sil -parse-as-library -g -o - | %FileCheck %s --check-prefix=CHECK-SIL
// RUN: %target-swift-frontend %s -emit-ir -parse-as-library -g -o - | %FileCheck %s --check-prefix=CHECK-IR
public func f(_ a: Int!) -> Int {
// CHECK-IR: call {{.*}}assertionFailure{{.*}}, !dbg ![[LOC:[0-9]+]]
// CHECK-IR: ![[LOC]] = !DILocation(line: [[@LINE+1]], column: 11
return (a // CHECK-SIL: apply {{.*}}:[[@LINE]]:11
+
1)
}