Files
swift-mirror/test/IRGen/section_bridging_header.swift
Kuba Mracek adeb40f261 SE-0492: Stabilize @_section/@_used into @section/@used
Removes the underscored prefixes from the @_section and @_used attributes, making them public as @section and @used respectively. The SymbolLinkageMarkers experimental feature has been removed as these attributes are now part of the standard language. Implemented expression syntactic checking rules per SE-0492.

Major parts:
- Renamed @_section to @section and @_used to @used
- Removed the SymbolLinkageMarkers experimental feature
- Added parsing support for the old underscored names with deprecation warnings
- Updated all tests and examples to use the new attribute names
- Added syntactic validation for @section to align with SE-0492 (reusing the legality checker by @artemcm)
- Changed @DebugDescription macro to explicitly use a tuple type instead of type inferring it, to comply with the expression syntax rules
- Added a testcase for the various allowed and disallowed syntactic forms, `test/ConstValues/SectionSyntactic.swift`.
2025-10-22 16:05:39 -07:00

25 lines
676 B
Swift

// RUN: %empty-directory(%t)
// RUN: %{python} %utils/split_file.py -o %t %s
// RUN: %target-swift-frontend -enable-experimental-feature CompileTimeValuesPreview -enforce-exclusivity=unchecked -parse-as-library -emit-sil -import-objc-header %t/bridge.h %t/file.swift -o /dev/null
// REQUIRES: swift_in_compiler
// REQUIRES: swift_feature_CompileTimeValuesPreview
// BEGIN bridge.h
struct MyStruct1 {
int x;
void (*fptr1)();
void (*fptr2)(int);
void (*fptr3)(int, char, void *);
};
// BEGIN file.swift
func foo() { }
@section("__TEXT,__mysection") var my_global1 = MyStruct1(
x: 42,
fptr1: foo,
fptr2: nil,
fptr3: { arg1, arg2, arg3 in print(arg1, arg2, arg3) }
)