Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/Serialization/ModuleFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
/// describe what change you made. The content of this comment isn't important;
/// it just ensures a conflict if two people change the module format.
/// Don't worry about adhering to the 80-column limit for this line.
const uint16_t SWIFTMODULE_VERSION_MINOR = 947; // @preEnumExtensibility attribute
const uint16_t SWIFTMODULE_VERSION_MINOR = 948; // @_expose kind

/// A standard hash seed used for all string hashes in a serialized module.
///
Expand Down Expand Up @@ -2526,7 +2526,7 @@ namespace decls_block {
>;

using ExposeDeclAttrLayout = BCRecordLayout<Expose_DECL_ATTR,
BCFixed<1>, // exposure kind
BCFixed<2>, // exposure kind
BCFixed<1>, // implicit flag
BCBlob // declaration name
>;
Expand Down
31 changes: 31 additions & 0 deletions test/Serialization/attr-expose.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -module-name attr_expose -emit-module -parse-as-library -o %t %s
// RUN: %target-sil-opt -enable-sil-verify-all %t/attr_expose.swiftmodule | %FileCheck %s

// @_expose
// -----------------------------------------------------------------------------

// CHECK: @_expose(Cxx)
// CHECK-NEXT: func exposeToCxx()
@_expose(Cxx)
func exposeToCxx() -> Int { return 42 }

// CHECK: @_expose(Cxx, "custom_name")
// CHECK-NEXT: func exposeToCxxWithName()
@_expose(Cxx, "custom_name")
func exposeToCxxWithName() -> Int { return 24 }

// CHECK: @_expose(!Cxx)
// CHECK-NEXT: func dontExposeToCxx()
@_expose(!Cxx)
func dontExposeToCxx() -> Int { return 13 }

// CHECK: @_expose(wasm)
// CHECK-NEXT: func exposeToWasm()
@_expose(wasm)
func exposeToWasm() -> Int { return 99 }

// CHECK: @_expose(wasm, "wasm_custom")
// CHECK-NEXT func exposeToWasmWithName()
@_expose(wasm, "wasm_custom")
func exposeToWasmWithName() -> Int { return 88 }