Files
swift-mirror/test/Index/Store/unit-system-source-file.swift
Tony Allevato 67d9eecd50 [AST] Make IsNonUserModuleRequest consider SourceFile inputs as well.
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.
2024-09-17 09:44:42 -04:00

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() {}