@@ -45,6 +45,7 @@ struct BatchScanInput {
45
45
StringRef moduleName;
46
46
StringRef arguments;
47
47
StringRef outputPath;
48
+ bool isSwift;
48
49
};
49
50
50
51
static std::string getScalaNodeText (Node *N) {
@@ -54,7 +55,7 @@ static std::string getScalaNodeText(Node *N) {
54
55
55
56
// / Parse an entry like this, where the "platforms" key-value pair is optional:
56
57
// / {
57
- // / "module ": "Foo.pcm ",
58
+ // / "swiftModuleName ": "Foo",
58
59
// / "arguments": "-target 10.15",
59
60
// / "output": "../Foo.json"
60
61
// / },
@@ -70,8 +71,12 @@ static bool parseBatchInputEntries(ASTContext &Ctx, llvm::StringSaver &saver,
70
71
for (auto &Pair: *MN) {
71
72
auto Key = getScalaNodeText (Pair.getKey ());
72
73
auto * Value = Pair.getValue ();
73
- if (Key == " module " ) {
74
+ if (Key == " clangModuleName " ) {
74
75
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 ;
75
80
} else if (Key == " arguments" ) {
76
81
entry.arguments = saver.save (getScalaNodeText (Value));
77
82
} else if (Key == " output" ) {
@@ -85,9 +90,6 @@ static bool parseBatchInputEntries(ASTContext &Ctx, llvm::StringSaver &saver,
85
90
return true ;
86
91
if (entry.outputPath .empty ())
87
92
return true ;
88
- auto ext = llvm::sys::path::extension (entry.moduleName );
89
- if (ext != " .swiftmodule" && ext != " .pcm" )
90
- return true ;
91
93
result.emplace_back (std::move (entry));
92
94
}
93
95
return false ;
@@ -699,10 +701,8 @@ bool swift::batchScanModuleDependencies(CompilerInstance &instance,
699
701
if (!results.hasValue ())
700
702
return true ;
701
703
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 ))
706
706
return true ;
707
707
}
708
708
return false ;
0 commit comments