Files
swift-mirror/test/ModuleInterface/abi-comments.swift
Doug Gregor 0aff85ced7 Emit mangled names for public symbols into the .swiftinterface
When the frontend option `-abi-comments-in-module-interface` is provided
during interface printing, the printed interface will contain
additional comments that provide the mangled names for public symbols.
This is an experiment in seeing how much information we can
meaningfully extract from a printed Swift interface for the purpose of
bridging with other languages.
2024-09-25 15:49:34 -07:00

18 lines
724 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t/ABIComments.swiftinterface -module-name ABIComments -abi-comments-in-module-interface %s
// RUN: %FileCheck %s < %t/ABIComments.swiftinterface
// CHECK: // MANGLED NAME: $s11ABIComments11intToStringySSSiF
// CHECK-NEXT: public func intToString(_ value: Swift.Int) -> Swift.String
public func intToString(_ value: Int) -> String { "\(value)" }
// CHECK: // MANGLED NAME: $s11ABIComments8MyStructVMa
// CHECK-NEXT: public struct MyStruct {
public struct MyStruct {
// CHECK: // MANGLED NAME: $s11ABIComments8MyStructV6methodSiyF
// CHECK-NEXT: public func method() -> Swift.Int
public func method() -> Int { 5 }
}