mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Don't run the objc-arc-contract pass when disable-llvm-optzns is passed. In pipeline setups where the swift-frontend is called twice; - the first time to create bitcode - the second time to generate object code from the bitcode (using disable-llvm-optzns) we don't want to run the objc-arc-contract pass twice. rdar://91908312
31 lines
1.7 KiB
Swift
31 lines
1.7 KiB
Swift
// Make sure that we run objc arc contract when emitting ir or bc with optimization enabled.
|
|
|
|
// RUN: %empty-directory(%t)
|
|
|
|
// RUN: %target-swift-frontend -import-objc-header %S/Inputs/StaticInline.h %s -emit-ir -Xllvm -disable-objc-arc-contract -parse-as-library -O | %FileCheck --check-prefix=CHECK-WITHOUT-PASS %s
|
|
// RUN: %target-swift-frontend -import-objc-header %S/Inputs/StaticInline.h %s -emit-bc -Xllvm -disable-objc-arc-contract -parse-as-library -O -o %t/test1.bc && %llvm-dis -o - %t/test1.bc | %FileCheck --check-prefix=CHECK-WITHOUT-PASS %s
|
|
// RUN: %target-swift-frontend -import-objc-header %S/Inputs/StaticInline.h %s -emit-ir -disable-llvm-optzns -parse-as-library -O | %FileCheck --check-prefix=CHECK-WITHOUT-PASS %s
|
|
// RUN: %target-swift-frontend -import-objc-header %S/Inputs/StaticInline.h %s -emit-bc -disable-llvm-optzns -parse-as-library -O -o %t/test1.bc && %llvm-dis -o - %t/test1.bc | %FileCheck --check-prefix=CHECK-WITHOUT-PASS %s
|
|
|
|
// RUN: %target-swift-frontend -import-objc-header %S/Inputs/StaticInline.h %s -emit-ir -parse-as-library -O | %FileCheck --check-prefix=CHECK-WITH-PASS %s
|
|
// RUN: %target-swift-frontend -import-objc-header %S/Inputs/StaticInline.h %s -emit-bc -parse-as-library -O -o %t/test2.bc && %llvm-dis -o - %t/test2.bc | %FileCheck --check-prefix=CHECK-WITH-PASS %s
|
|
|
|
|
|
// REQUIRES: objc_interop
|
|
// REQUIRES: asserts
|
|
|
|
// CHECK-WITHOUT-PASS: call void (...) @llvm.objc.clang.arc.use
|
|
// CHECK-WITH-PASS-NOT: call void (...) @llvm.objc.clang.arc.use
|
|
|
|
import Foundation
|
|
|
|
@inline(never)
|
|
public func foo() throws {
|
|
let x: FileManager! = nil
|
|
let y = URL(string: "http://swift.org")
|
|
let z: URL! = nil
|
|
let w: String = "foo"
|
|
var e: NSError? = nil
|
|
test(x, y, z, w, .usingNewMetadataOnly, &e)
|
|
}
|