@@ -45,6 +45,7 @@ struct BatchScanInput {
4545 StringRef moduleName;
4646 StringRef arguments;
4747 StringRef outputPath;
48+ bool isSwift;
4849};
4950
5051static std::string getScalaNodeText (Node *N) {
@@ -54,7 +55,7 @@ static std::string getScalaNodeText(Node *N) {
5455
5556// / Parse an entry like this, where the "platforms" key-value pair is optional:
5657// / {
57- // / "module ": "Foo.pcm ",
58+ // / "swiftModuleName ": "Foo",
5859// / "arguments": "-target 10.15",
5960// / "output": "../Foo.json"
6061// / },
@@ -70,8 +71,12 @@ static bool parseBatchInputEntries(ASTContext &Ctx, llvm::StringSaver &saver,
7071 for (auto &Pair: *MN) {
7172 auto Key = getScalaNodeText (Pair.getKey ());
7273 auto * Value = Pair.getValue ();
73- if (Key == " module " ) {
74+ if (Key == " clangModuleName " ) {
7475 entry.moduleName = saver.save (getScalaNodeText (Value));
76+ entry.isSwift = false ;
77+ } else if (Key == " swiftModuleName" ) {
78+ entry.moduleName = saver.save (getScalaNodeText (Value));
79+ entry.isSwift = true ;
7580 } else if (Key == " arguments" ) {
7681 entry.arguments = saver.save (getScalaNodeText (Value));
7782 } else if (Key == " output" ) {
@@ -85,9 +90,6 @@ static bool parseBatchInputEntries(ASTContext &Ctx, llvm::StringSaver &saver,
8590 return true ;
8691 if (entry.outputPath .empty ())
8792 return true ;
88- auto ext = llvm::sys::path::extension (entry.moduleName );
89- if (ext != " .swiftmodule" && ext != " .pcm" )
90- return true ;
9193 result.emplace_back (std::move (entry));
9294 }
9395 return false ;
@@ -699,10 +701,8 @@ bool swift::batchScanModuleDependencies(CompilerInstance &instance,
699701 if (!results.hasValue ())
700702 return true ;
701703 for (auto &entry: *results) {
702- auto moduleName = llvm::sys::path::stem (entry.moduleName );
703- auto isClang = llvm::sys::path::extension (entry.moduleName ) == " .pcm" ;
704- if (scanModuleDependencies (instance, moduleName, entry.arguments , isClang,
705- entry.outputPath ))
704+ if (scanModuleDependencies (instance, entry.moduleName , entry.arguments ,
705+ !entry.isSwift , entry.outputPath ))
706706 return true ;
707707 }
708708 return false ;
0 commit comments