mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
61 lines
2.1 KiB
Swift
61 lines
2.1 KiB
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: split-file %s %t --leading-lines
|
|
|
|
/// Generate cdecl.h for an app
|
|
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) \
|
|
// RUN: %t/Lib.swift -emit-module -verify -o %t -emit-module-doc \
|
|
// RUN: -emit-clang-header-path %t/cdecl.h -package-name pkg
|
|
// RUN: %FileCheck %s --input-file %t/cdecl.h --check-prefixes PUBLIC-AND-INTERNAL,INTERNAL-ONLY
|
|
// RUN: %check-in-clang-c %t/cdecl.h
|
|
|
|
/// Generate cdecl.h for a library
|
|
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse-as-library \
|
|
// RUN: %t/Lib.swift -emit-module -verify -o %t -emit-module-doc \
|
|
// RUN: -emit-clang-header-path %t/cdecl.h -package-name pkg
|
|
// RUN: %FileCheck %s --input-file %t/cdecl.h --check-prefixes PUBLIC-AND-INTERNAL
|
|
// RUN: %FileCheck %s --input-file %t/cdecl.h --implicit-check-not INTERNAL-ONLY
|
|
// RUN: %check-in-clang-c %t/cdecl.h
|
|
|
|
//--- Lib.swift
|
|
|
|
@c private enum PrivateEnum: CInt { case A, B }
|
|
// PUBLIC-AND-INTERNAL-NOT: PrivateEnum
|
|
|
|
@c internal enum InternalEnum: CInt { case A, B }
|
|
// INTERNAL-ONLY: typedef SWIFT_ENUM(int, InternalEnum, closed) {
|
|
// INTERNAL-ONLY: InternalEnumA = 0,
|
|
// INTERNAL-ONLY: InternalEnumB = 1,
|
|
// INTERNAL-ONLY: };
|
|
|
|
@c package enum PackageEnum: CInt { case A, B }
|
|
// INTERNAL-ONLY: typedef SWIFT_ENUM(int, PackageEnum, closed) {
|
|
// INTERNAL-ONLY: PackageEnumA = 0,
|
|
// INTERNAL-ONLY: PackageEnumB = 1,
|
|
// INTERNAL-ONLY: };
|
|
|
|
@c public enum PublicEnum: CInt { case A, B }
|
|
// PUBLIC-AND-INTERNAL: typedef SWIFT_ENUM(int, PublicEnum, closed) {
|
|
// PUBLIC-AND-INTERNAL: PublicEnumA = 0,
|
|
// PUBLIC-AND-INTERNAL: PublicEnumB = 1,
|
|
// PUBLIC-AND-INTERNAL: };
|
|
|
|
/// Private documentation
|
|
@c private func a_private() {}
|
|
// PUBLIC-AND-INTERNAL-NOT: // Private documentation
|
|
// PUBLIC-AND-INTERNAL-NOT: a_private
|
|
|
|
/// Internal documentation
|
|
@c internal func b_internal() {}
|
|
// INTERNAL-ONLY: // Internal documentation
|
|
// INTERNAL-ONLY: b_internal
|
|
|
|
/// Package documentation
|
|
@c package func c_package() {}
|
|
// INTERNAL-ONLY: // Package documentation
|
|
// INTERNAL-ONLY: c_package
|
|
|
|
/// Public documentation
|
|
@c public func d_public() {}
|
|
// PUBLIC-AND-INTERNAL: // Public documentation
|
|
// PUBLIC-AND-INTERNAL: d_public
|