Files
swift-mirror/test/TBD/sib-module.swift
Daniel Rodríguez Troitiño 8a0e5129b1 [frontend] Fix TBD validation almost always done for modules
The logic to do or not the validation of TBD against IR was incorrect.
In the case of modules, the comment described what was supposed to
happen (skipping the validation if the module had SIB files), but the
code was returning if the module had or not SIB files, which would have
returned true for any module without SIB files without checking if the
compiler was build in a debug configuration or not.

This was only visible in the case of non-debug builds, and it only
appeared for us in a convoluted mix of optimized builds with
-enable-testing on some modules.
2021-12-10 12:39:41 -08:00

26 lines
884 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swiftc_driver -emit-sib -module-name mysibmodule %s -o - | %target-swiftc_driver -emit-module -module-name mysibmodule -o %t/mysibmodule.swiftmodule -
/// Since -validate-tbd-against-ir=default, TBD validation is not done since the module has a SIB file
// RUN: %target-swift-frontend -emit-sil %t/mysibmodule.swiftmodule | %FileCheck %s
// RUN: %target-swiftc_driver -emit-module -module-name mynonsibmodule -o %t/mynonsibmodule.swiftmodule %s
/// Since -validate-tbd-against-ir=default, TBD validation is done or not depending on the build configuration
// RUN: %target-swift-frontend -emit-sil %t/mynonsibmodule.swiftmodule | %FileCheck %s
public class MyClass {
var x : Int
public init(input : Int) {
x = 2 * input
}
public func do_something(input : Int) -> Int {
return x * input
}
}
// CHECK: class MyClass