mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This applies the same changes from Clang CFE r349065 to the Swift frontend to unify how filenames, cmpilation directories and absolute paths in filenames and path remappings are handled.
37 lines
1.3 KiB
Swift
37 lines
1.3 KiB
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: echo "public var x = Int64()" \
|
|
// RUN: | %target-swift-frontend -module-name FooBar -emit-module -o %t -
|
|
// RUN: %target-swift-frontend %s -O -I %t -emit-ir -g -o %t.ll
|
|
// RUN: %FileCheck %s < %t.ll
|
|
// RUN: %FileCheck %s -check-prefix=TRANSPARENT-CHECK < %t.ll
|
|
|
|
// CHECK: define{{( dllexport)?}}{{( protected)?( signext)?}} i32 @main
|
|
// CHECK: call {{.*}}noinline{{.*}}, !dbg ![[CALL:.*]]
|
|
// CHECK-DAG: ![[TOPLEVEL:.*]] = !DIFile(filename: "{{.*}}inlinescopes.swift"
|
|
|
|
import FooBar
|
|
|
|
func use<T>(_ t: T) {}
|
|
|
|
@inline(never)
|
|
func noinline(_ x: Int64) -> Int64 { return x }
|
|
|
|
@_transparent
|
|
func transparent(_ x: Int64) -> Int64 { return noinline(x) }
|
|
|
|
|
|
@inline(__always)
|
|
func inlined(_ x: Int64) -> Int64 {
|
|
// CHECK-DAG: ![[CALL]] = !DILocation(line: [[@LINE+2]], column: {{.*}}, scope: ![[SCOPE:.*]], inlinedAt: ![[INLINED:.*]])
|
|
// CHECK-DAG: ![[SCOPE:.*]] = distinct !DILexicalBlock(
|
|
let result = transparent(x)
|
|
// TRANSPARENT-CHECK-NOT: !DISubprogram(name: "transparent"
|
|
return result
|
|
}
|
|
// CHECK-DAG: !DIGlobalVariable(name: "y",{{.*}} file: ![[TOPLEVEL]],{{.*}} line: [[@LINE+1]]
|
|
let y = inlined(x)
|
|
use(y)
|
|
|
|
// Check if the inlined and removed function still has the correct linkage name.
|
|
// CHECK-DAG: !DISubprogram(name: "inlined", linkageName: "$s4main7inlinedys5Int64VADF"
|