mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
We're using a small custom frontend tool to generate indexstore data for `.swiftinterface` files in the SDKs. We do this by treating the `.swiftinterface` file as the input of an interface compilation, but this exits early because it treats it as a `SourceFile` instead of an external `LoadedFile`. This happens even if we call `setIsSystemModule(true)` unless we skip setting the SDK path, but that causes other problems. It seems harmless to check for `SourceFile`s as well, so that a tool processing an SDK interface as a direct input still gets the right state.
22 lines
761 B
Swift
22 lines
761 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %empty-directory(%t/SDK)
|
|
// RUN: cp %s %t/SDK/FakeSystemModule.swift
|
|
|
|
// When the source file is in the SDK, consider it a system module.
|
|
//
|
|
// RUN: %target-swift-frontend -c -o %t/FakeSystemModule.o -index-store-path %t/idx -sdk %t/SDK %t/SDK/FakeSystemModule.swift
|
|
// RUN: c-index-test core -print-unit %t/idx | %FileCheck %s
|
|
//
|
|
// CHECK: FakeSystemModule.o-{{[A-Z0-9]*}}
|
|
// CHECK: --------
|
|
// CHECK: is-system: 1
|
|
|
|
// RUN: %target-swift-frontend -c -o %t/FakeSystemModule.o -index-store-path %t/idx %t/SDK/FakeSystemModule.swift
|
|
// RUN: c-index-test core -print-unit %t/idx | %FileCheck %s -check-prefix NO-SDK
|
|
//
|
|
// NO-SDK: FakeSystemModule.o-{{[A-Z0-9]*}}
|
|
// NO-SDK: --------
|
|
// NO-SDK: is-system: 0
|
|
|
|
func someFunc() {}
|