mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
In addition to capturing more detailed preprocessor info, the DetailedPreprocessorRecord option sets the clang module format to 'raw' rather than the default 'object'. Sourcekitd doesn't link the code generation libs, which it looks like the default 'object' format requires, so it sets this option to true. The subinvocation generated when loading a module from a .swiftinterface file still used the default prior to this change though, so it would end up crashing sourcekitd. This change sets the DetailedProccessorRecord option if the DetailedRecord option is set on the preprocessor options of parent context's clang module loader. This fixes interface generation crashing for modules that only have a .swiftinterface file. rdar://problem/43906499
35 lines
1.8 KiB
Swift
35 lines
1.8 KiB
Swift
import swift_mod_syn
|
|
|
|
func f(s : inout [Int]) {
|
|
s.sort()
|
|
}
|
|
|
|
// RUN: %empty-directory(%t.mod)
|
|
// RUN: %swift -emit-module -o %t.mod/swift_mod.swiftmodule %S/Inputs/swift_mod.swift -parse-as-library
|
|
// RUN: %sourcekitd-test -req=interface-gen -module swift_mod -- -I %t.mod > %t.response
|
|
// RUN: diff -u %s.response %t.response
|
|
|
|
// RUN: %sourcekitd-test -req=module-groups -module swift_mod -- -I %t.mod | %FileCheck -check-prefix=GROUP-EMPTY %s
|
|
// GROUP-EMPTY: <GROUPS>
|
|
// GROUP-EMPTY-NEXT: <\GROUPS>
|
|
|
|
// RUN: %swift -emit-module -o %t.mod/swift_mod_syn.swiftmodule %S/Inputs/swift_mod_syn.swift -parse-as-library
|
|
// RUN: %sourcekitd-test -req=interface-gen-open -module swift_mod_syn -- -I %t.mod == -req=cursor -pos=4:7 %s -- %s -I %t.mod | %FileCheck -check-prefix=SYNTHESIZED-USR1 %s
|
|
// SYNTHESIZED-USR1: s:SMsSkRzSL7ElementSTRpzrlE4sortyyF::SYNTHESIZED::s:Sa
|
|
|
|
// RUN: %sourcekitd-test -req=interface-gen-open -module Swift -synthesized-extension \
|
|
// RUN: == -req=find-usr -usr "s:SMsSkRzSL7ElementSTRpzrlE4sortyyF::SYNTHESIZED::s:Sa" | %FileCheck -check-prefix=SYNTHESIZED-USR2 %s
|
|
// SYNTHESIZED-USR2-NOT: USR NOT FOUND
|
|
|
|
// RUN: %sourcekitd-test -req=interface-gen-open -module Swift \
|
|
// RUN: == -req=find-usr -usr "s:SMsSkRzSL7ElementSTRpzrlE4sortyyF::SYNTHESIZED::s:Sa::SYNTHESIZED::USRDOESNOTEXIST" | %FileCheck -check-prefix=SYNTHESIZED-USR3 %s
|
|
// SYNTHESIZED-USR3-NOT: USR NOT FOUND
|
|
|
|
|
|
// Test we can generate the interface of a module loaded via a .swiftinterface file correctly
|
|
|
|
// RUN: %empty-directory(%t.mod)
|
|
// RUN: %swift -emit-module -o /dev/null -emit-parseable-module-interface-path %t.mod/swift_mod.swiftinterface %S/Inputs/swift_mod.swift -parse-as-library
|
|
// RUN: %sourcekitd-test -req=interface-gen -module swift_mod -- -I %t.mod -enable-parseable-module-interface -module-cache-path %t/mcp > %t.response
|
|
// RUN: diff -u %s.from_swiftinterface.response %t.response
|