mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add flag to verify just-emitted module interfaces
The driver can now schedule jobs which typecheck just-emitted module interfaces to ensure that they can be consumed later. This can be enabled manually by passing `-verify-emitted-module-interface` to the driver.
This commit is contained in:
15
test/ModuleInterface/verify-module-interfaces.swift
Normal file
15
test/ModuleInterface/verify-module-interfaces.swift
Normal file
@@ -0,0 +1,15 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
|
||||
// Check that verification won't reject a valid interface:
|
||||
// RUN: %target-build-swift -emit-library -enable-library-evolution -emit-module-interface -emit-module -swift-version 5 -o %t/MyModule.o -verify-emitted-module-interface -module-name MyModule %s
|
||||
|
||||
// Check that verification will reject an invalid interface:
|
||||
// RUN: not %target-build-swift -emit-library -enable-library-evolution -emit-module-interface -emit-module -swift-version 5 -o %t/MyModule.o -verify-emitted-module-interface -module-name MyModule -Xfrontend -debug-emit-invalid-swiftinterface-syntax %s 2>&1 | %FileCheck %s
|
||||
|
||||
// ...but not if verification is off.
|
||||
// RUN: %target-build-swift -emit-library -enable-library-evolution -emit-module-interface -emit-module -swift-version 5 -o %t/MyModule.o -no-verify-emitted-module-interface -module-name MyModule -Xfrontend -debug-emit-invalid-swiftinterface-syntax %s
|
||||
|
||||
public struct MyStruct {}
|
||||
|
||||
// CHECK: MyModule.swiftinterface:{{[0-9]+}}:{{[0-9]+}}: error: use of unknown directive '#__debug_emit_invalid_swiftinterface_syntax__'
|
||||
// CHECK: MyModule.swiftinterface:{{[0-9]+}}:{{[0-9]+}}: error: failed to build module 'MyModule' from its module interface; it may have been damaged or it may have triggered a bug in the Swift compiler when it was produced
|
||||
Reference in New Issue
Block a user