mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
hasCReferences is used to determine that the function is externally available. If a function has @_cdecl and not used from anywhere in Swift side code, it will be emitted due to its hasCReferences. But if the attribute is not restored from sib, it won't be emitted even if it's used externally. So we need to serialize the attribute.
13 lines
351 B
Swift
13 lines
351 B
Swift
// RUN: %empty-directory(%t)
|
|
// Ensure .swift -> .ll
|
|
// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
|
|
|
|
// Ensure .swift -> .sib -> .ll
|
|
// RUN: %target-swift-frontend -emit-sib %s -o %t/cdecl_attr.sib
|
|
// RUN: %target-swift-frontend -emit-ir %t/cdecl_attr.sib | %FileCheck %s
|
|
|
|
// CHECK: define hidden {{.*}} @foo
|
|
|
|
@_cdecl("foo")
|
|
func foo() {}
|