mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Previously, TBDGen skipped emitting lazy initializers for globals that appeared in any file with an entry point. This breaks, however on files that have an NSApplicationMain/UIApplicationMain class in them, where the entry point is synthesized but top-level globals are not locally scoped. This change re-uses SILGen's check and only skips variable declarations that appear at top level in a script mode file. Resolves rdar://43549749
15 lines
646 B
Swift
15 lines
646 B
Swift
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-ir -o /dev/null -validate-tbd-against-ir=all -parse-as-library -verify -enable-testing %s
|
|
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-ir -o /dev/null -validate-tbd-against-ir=all -parse-as-library -verify %s
|
|
|
|
// REQUIRES: objc_interop
|
|
import AppKit
|
|
|
|
// Globals in non-script mode files that still have entry points
|
|
// (via NSApplicationMain) _do_ have lazy initializers. Ensure the symbols are
|
|
// present in the TBD.
|
|
let globalConstantWithLazyInitializer: String = "hello, world"
|
|
|
|
@NSApplicationMain
|
|
class MyDelegate: NSObject, NSApplicationDelegate {
|
|
}
|