Files
swift-mirror/test/IRGen/section_asm.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

50 lines
1.6 KiB
Swift

// RUN: %target-swift-frontend -enable-experimental-feature CompileTimeValuesPreview -primary-file %S/section.swift -S -parse-as-library | %FileCheck --check-prefix CHECK%target-os-binfmt-elf %s
// REQUIRES: swift_in_compiler
// REQUIRES: swift_feature_CompileTimeValuesPreview
// UNSUPPORTED: CPU=wasm32
// CHECK: .section{{.*}}__TEXT,__mysection
// CHECK-NOT: .section
// CHECK: $s7section3fooyyF:
// CHECK: .section{{.*}}__TEXT,__mysection
// CHECK-NOT: .section
// CHECK: $s7section8MyStructV3fooyyF:
// CHECK: .section{{.*}}__DATA,__mysection
// CHECK-NOT: .section
// CHECK: $s7section2g0Sivp:
// CHECK-NOT: .section
// CHECK: $s7section2g1Si_Sitvp:
// CHECK-NOT: .section
// CHECK: $s7section2g2Sbvp:
// CHECK-NOT: .section
// CHECK: $s7section2g3Sbvp:
// CHECK-NOT: .section
// CHECK: $s7section2g4SpySiGSgvp:
// CHECK-NOT: .section
// CHECK: $s7section2g5SpySiGSgvp:
// CHECK-NOT: .section
// CHECK: $s7section8MyStructV7static0SivpZ:
// CHECKELF: .section{{.*}}"__TEXT,__mysection","axR"
// CHECKELF-NOT: .section
// CHECKELF: $s7section3fooyyF:
// CHECKELF: .section{{.*}}"__TEXT,__mysection","axR"
// CHECKELF-NOT: .section
// CHECKELF: $s7section8MyStructV3fooyyF:
// CHECKELF: .section{{.*}}"__DATA,__mysection","awR"
// CHECKELF-NOT: .section
// CHECKELF: $s7section2g0Sivp:
// CHECKELF: $s7section2g1Si_Sitvp:
// CHECKELF: $s7section2g2Sbvp:
// CHECKELF: .section{{.*}}"__DATA,__mysection","awR"
// CHECKELF: $s7section2g3Sbvp:
// CHECKELF: .section{{.*}}"__DATA,__mysection","awR"
// CHECKELF: $s7section2g4SpySiGSgvp:
// CHECKELF: $s7section2g5SpySiGSgvp:
// CHECKELF: $s7section8MyStructV7static0SivpZ: