[Frontend] Internalize createDependencyTracker

Expand the FrontendOptions to allow the enabling
of the dependency tracker for non-system
dependencies, and switch the previous clients of
`createDependencyTracker` over to using this
option. This ensures that the dependency tracker
is now set only during `CompilerInstance::setup`.
This commit is contained in:
Hamish Knight
2020-06-29 15:26:26 -07:00
parent bddcda6333
commit 7bc5440d17
13 changed files with 80 additions and 41 deletions

View File

@@ -30,14 +30,15 @@ class FileCollector;
namespace swift {
DependencyTracker::DependencyTracker(
bool TrackSystemDeps, std::shared_ptr<llvm::FileCollector> FileCollector)
IntermoduleDepTrackingMode Mode,
std::shared_ptr<llvm::FileCollector> FileCollector)
// NB: The ClangImporter believes it's responsible for the construction of
// this instance, and it static_cast<>s the instance pointer to its own
// subclass based on that belief. If you change this to be some other
// instance, you will need to change ClangImporter's code to handle the
// difference.
: clangCollector(ClangImporter::createDependencyCollector(TrackSystemDeps,
FileCollector)) {}
: clangCollector(
ClangImporter::createDependencyCollector(Mode, FileCollector)) {}
void
DependencyTracker::addDependency(StringRef File, bool IsSystem) {