mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Replace the dynamic initialization of trivial globals with statically initialized globals, even in -Onone. This is required to be able to use global variables in performance-annotated functions. Also, it's a small performance improvement for -Onone.
34 lines
1.1 KiB
Swift
34 lines
1.1 KiB
Swift
// RUN: %empty-directory(%t)
|
|
|
|
// RUN: %target-swift-frontend -emit-module -enable-library-evolution \
|
|
// RUN: -emit-module-path=%t/lib.swiftmodule -module-name=lib \
|
|
// RUN: -validate-tbd-against-ir=none \
|
|
// RUN: %S/Inputs/force_public_metadata_accessors.swift
|
|
// RUN: %target-swift-frontend -parse-as-library -enable-library-evolution \
|
|
// RUN: -force-public-linkage \
|
|
// RUN: -validate-tbd-against-ir=none -emit-ir %s -I %t | %FileCheck %s
|
|
|
|
import lib
|
|
|
|
private enum FixedContainer {
|
|
case a(S)
|
|
}
|
|
|
|
fileprivate var c = FixedContainer.a(S())
|
|
public func use() -> Int {
|
|
switch (c) {
|
|
case let .a(s):
|
|
return s.a
|
|
}
|
|
}
|
|
|
|
// FIXME: From within LLDB, this would be a forward declaration.
|
|
// Unfortunately this is difficult to reproduce from source alone.
|
|
// Really this should be a check for a non-internal "declare".
|
|
// CHECK: define{{.*}} swiftcc %swift.metadata_response @"$s31force_public_metadata_accessors14FixedContainer{{.*}}LLOMa"
|
|
|
|
// CHECK: define {{.*}} @"$s31force_public_metadata_accessors3useSiyF"()
|
|
// CHECK-NOT: define
|
|
// CHECK: call {{.*}} %swift.metadata_response @"$s31force_public_metadata_accessors14FixedContainer{{.*}}LLOMa"
|
|
|