File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: mkdir -p %t/clang-module-cache
3
+ // RUN: mkdir -p %t/inputs
4
+ // RUN: echo "/// Some cool comments" > %t/foo.swift
5
+ // RUN: echo "public func foo() {}" >> %t/foo.swift
6
+ // RUN: %target-swift-frontend -emit-module -emit-module-path %t/inputs/Foo.swiftmodule -emit-module-doc-path %t/inputs/Foo.swiftdoc -emit-module-source-info -emit-module-source-info-path %t/inputs/Foo.swiftsourceinfo -module-cache-path %t.module-cache %t/foo.swift -module-name Foo
7
+
8
+ // RUN: echo "{" > %t/inputs/map.json
9
+ // RUN: echo "\"Foo\": {" >> %t/inputs/map.json
10
+ // RUN: echo "\"SwiftModulePath\": \"%t/inputs/Foo.swiftmodule\"," >> %t/inputs/map.json
11
+ // RUN: echo "\"SwiftDocPath\": \"%t/inputs/Foo.swiftdoc\"," >> %t/inputs/map.json
12
+ // RUN: echo "\"SwiftSourceInfoPath\": \"%t/inputs/Foo.swiftsourceinfo\"" >> %t/inputs/map.json
13
+ // RUN: echo "}" >> %t/inputs/map.json
14
+ // RUN: echo "}" >> %t/inputs/map.json
15
+
16
+ // RUN: %target-swift-ide-test -print-module-comments -module-to-print=Foo -enable-swiftsourceinfo -source-filename %s -explicit-swift-module-map-file %t/inputs/map.json | %FileCheck %s
17
+
18
+ // CHECK: foo.swift:2:13: Func/foo RawComment=[/// Some cool comments
Original file line number Diff line number Diff line change @@ -723,6 +723,10 @@ EnableSwiftSourceInfo("enable-swiftsourceinfo",
723
723
llvm::cl::cat(Category),
724
724
llvm::cl::init(false ));
725
725
726
+ static llvm::cl::opt<std::string>
727
+ ExplicitSwiftModuleMap (" explicit-swift-module-map-file" ,
728
+ llvm::cl::desc (" JSON file to include explicit Swift modules" ),
729
+ llvm::cl::cat(Category));
726
730
} // namespace options
727
731
728
732
static std::unique_ptr<llvm::MemoryBuffer>
@@ -3462,6 +3466,11 @@ int main(int argc, char *argv[]) {
3462
3466
for (auto ConfigName : options::BuildConfigs)
3463
3467
InitInvok.getLangOptions ().addCustomConditionalCompilationFlag (ConfigName);
3464
3468
3469
+ if (!options::ExplicitSwiftModuleMap.empty ()) {
3470
+ InitInvok.getSearchPathOptions ().ExplicitSwiftModuleMap =
3471
+ options::ExplicitSwiftModuleMap;
3472
+ InitInvok.getFrontendOptions ().DisableImplicitModules = true ;
3473
+ }
3465
3474
// Process the clang arguments last and allow them to override previously
3466
3475
// set options.
3467
3476
if (!CCArgs.empty ()) {
You can’t perform that action at this time.
0 commit comments