@@ -659,6 +659,8 @@ static bool scanModuleDependencies(CompilerInstance &instance,
659
659
FEOpts.PrebuiltModuleCachePath ,
660
660
FEOpts.SerializeModuleInterfaceDependencyHashes ,
661
661
FEOpts.shouldTrackSystemDependencies ());
662
+ std::error_code EC;
663
+ llvm::raw_fd_ostream out (outputPath, EC, llvm::sys::fs::F_None);
662
664
Optional<ModuleDependencies> rootDeps;
663
665
if (isClang) {
664
666
// Loading the clang module using Clang importer.
@@ -677,6 +679,12 @@ static bool scanModuleDependencies(CompilerInstance &instance,
677
679
allModules.insert ({moduleName.str (), isClang ? ModuleDependenciesKind::Clang:
678
680
ModuleDependenciesKind::Swift});
679
681
682
+ // Output module prescan.
683
+ if (FEOpts.ImportPrescan ) {
684
+ writePrescanJSON (out, rootDeps.getValue ());
685
+ return false ;
686
+ }
687
+
680
688
// Explore the dependencies of every module.
681
689
for (unsigned currentModuleIdx = 0 ;
682
690
currentModuleIdx < allModules.size ();
@@ -687,8 +695,6 @@ static bool scanModuleDependencies(CompilerInstance &instance,
687
695
allModules.insert (discoveredModules.begin (), discoveredModules.end ());
688
696
}
689
697
// Write out the JSON description.
690
- std::error_code EC;
691
- llvm::raw_fd_ostream out (outputPath, EC, llvm::sys::fs::F_None);
692
698
writeJSON (out, instance, cache, ASTDelegate, allModules.getArrayRef ());
693
699
return false ;
694
700
}
0 commit comments