Files
swift-mirror/test/IRGen/lazy_metadata_with-g.swift
Erik Eckstein 11dd3e1885 tests: Make the test for lazy metadata emission a bit more complex
To verify that we don't emit metadata for unused types in non-trivial scenarios.

Test for rdar://problem/52059864
2019-07-18 14:13:40 +02:00

54 lines
1.0 KiB
Swift

// RUN: %target-swiftc_driver -parse-as-library -module-name=test -target x86_64-apple-macosx10.15 -wmo -O -g -emit-ir %s | %FileCheck %s
// REQUIRES: OS=macosx
// Check that the compiler does not emit any metadata for unused internal
// structs and enums, even with -g.
// This is also a driver issue, so we are testing with %target-swiftc_driver
// and not just with %target-swift-frontend.
// CHECK: ModuleID
// CHECK-NOT: Test
// CHECK-NOT: define
// CHECK: DICompileUnit
public protocol P {
func foo() -> Int
}
struct Teststruct1 : P {
func foo() -> Int { return 27 }
}
struct Teststruct : P {
static var testvar: some P {
switch getit().e {
case .None:
return Teststruct1()
case .View(let v):
return v
}
}
@inline(never)
static func getit() -> Teststruct2 {
return Teststruct2(e: .View(Teststruct1()))
}
func foo() -> Int { return 27 }
}
struct Teststruct2 : P {
enum Testenum {
case None
case View(Teststruct1)
}
var e: Testenum
func foo() -> Int { return 27 }
}