mirror of
https://github.com/apple/swift.git
synced 2026-06-20 15:42:51 +02:00
454237a083
When building the `OSLog` module, look for a variable named
`osLogStringSectionName`. It must have a string literal as its
initializer, which provides the section name where the log strings
should be emitted. The `OSLog` module should contain something like
this:
let osLogStringSectionName = "__TEXT,__logit"
When not present, the compiler will default to
`__TEXT,__oslogstring,cstring_literals`, which was previously the
hardcoded section name. Now, OSLog can customize the name.
Implements rdar://171571056
29 lines
1.0 KiB
Swift
29 lines
1.0 KiB
Swift
// RUN: %empty-directory(%t/src)
|
|
// RUN: split-file %s %t/src
|
|
|
|
// RUN: %target-swift-frontend -typecheck -module-name OSLog %t/src/missing.swift 2>&1 | %FileCheck %s
|
|
// RUN: %target-swift-frontend -typecheck -verify -module-name OSLog %t/src/noinit.swift
|
|
// RUN: %target-swift-frontend -typecheck -verify -module-name OSLog %t/src/badinit.swift
|
|
// RUN: %target-swift-frontend -typecheck -verify -module-name OSLog %t/src/goodinit.swift
|
|
|
|
//--- missing.swift
|
|
|
|
// CHECK: global variable 'osLogStringSectionName' is missing from the OSLog module; defaulting to '__TEXT,__oslogstring,cstring_literals'
|
|
|
|
//--- noinit.swift
|
|
|
|
// expected-error@+1{{global variable 'osLogStringSectionName' requires a string literal initializer}}
|
|
var osLogStringSectionName: String {
|
|
"hello"
|
|
}
|
|
|
|
//--- badinit.swift
|
|
|
|
func getSection() -> String { "hello" }
|
|
|
|
// expected-error@+1{{global variable 'osLogStringSectionName' requires a string literal initializer}}
|
|
let osLogStringSectionName: String = getSection()
|
|
|
|
//--- goodinit.swift
|
|
let osLogStringSectionName = "hello"
|