mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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`.
23 lines
786 B
Swift
23 lines
786 B
Swift
// RUN: %target-swift-frontend %s -emit-ir -parse-as-library | %FileCheck %s
|
|
|
|
// REQUIRES: swift_in_compiler
|
|
|
|
@used
|
|
@section("__TEXT,__mysection")
|
|
let my_global1: Int = 42
|
|
|
|
@used
|
|
@section("__TEXT,__mysection")
|
|
let my_global2: Int = 46
|
|
|
|
@_silgen_name(raw: "section$start$__TEXT$__mysection")
|
|
var mysection_start: Int
|
|
|
|
@_silgen_name(raw: "section$end$__TEXT$__mysection")
|
|
var mysection_end: Int
|
|
|
|
// CHECK: @"$s20linker_set_low_level10my_global1Sivp" = {{.*}}constant %TSi <{ {{(i64|i32)}} 42 }>, section "__TEXT,__mysection
|
|
// CHECK: @"$s20linker_set_low_level10my_global2Sivp" = {{.*}}constant %TSi <{ {{(i64|i32)}} 46 }>, section "__TEXT,__mysection
|
|
// CHECK: @"\01section$start$__TEXT$__mysection" = {{.*}}global %TSi
|
|
// CHECK: @"\01section$end$__TEXT$__mysection" = {{.*}}global %TSi
|