mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Passing the frontend flag -Rmodule-loading makes the compiler emit remarks with the path of every module loaded. The path for Swift modules is either the swiftinterface file for modules built with library evolution or the binary swiftmodule otherwise. The path for clangmodules is always in the cache which could be improved as it may be less useful. Here's an extract of the output for a simple SwiftUI app: <unknown>:0: remark: loaded module from /Users/xymus/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/2VJP7CNCGWRF0/SwiftShims-18ZF6992O9H75.pcm <unknown>:0: remark: loaded module from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.2.sdk/usr/lib/swift/Swift.swiftmodule/x86_64-apple-ios-simulator.swiftinterface <unknown>:0: remark: loaded module from /Users/xymus/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/2VJP7CNCGWRF0/os-1HVC6DNXVU37C.pcm <unknown>:0: remark: loaded module from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.2.sdk/usr/lib/swift/os.swiftmodule/x86_64-apple-ios-simulator.swiftinterface <unknown>:0: remark: loaded module from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.2.sdk/System/Library/Frameworks/SwiftUI.framework/Modules/SwiftUI.swiftmodule/x86_64-apple-ios-simulator.swiftinterface
15 lines
709 B
Swift
15 lines
709 B
Swift
/// Test the -Rmodule-loading flag.
|
|
// RUN: %empty-directory(%t)
|
|
|
|
/// Create a simple module and interface.
|
|
// RUN: echo 'public func publicFunction() {}' > %t/TestModule.swift
|
|
// RUN: %target-swift-frontend -typecheck %t/TestModule.swift -emit-module-interface-path %t/TestModule.swiftinterface -swift-version 5
|
|
|
|
/// Use -Rmodule-loading in a client and look for the diagnostics output.
|
|
// RUN: %target-swift-frontend -typecheck %s -I %t -Rmodule-loading 2>&1 | %FileCheck %s
|
|
|
|
import TestModule
|
|
// CHECK: remark: loaded module from {{.*}}SwiftShims-{{.*}}.pcm
|
|
// CHECK: remark: loaded module from {{.*}}Swift.swiftmodule{{.*}}.swiftmodule
|
|
// CHECK: remark: loaded module from {{.*}}TestModule.swiftinterface
|