mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Dependency Scanning] Refactor primary scan operations into 'ModuleDependencyScanner' class
From being a scattered collection of 'static' methods in ScanDependencies.cpp and member methods of ASTContext. This makes 'ScanDependencies.cpp' much easier to read, and abstracts the actual scanning logic away to a place with common state which will make it easier to reason about in the future.
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "llvm/ADT/SetVector.h"
|
||||
#include "llvm/ADT/StringSet.h"
|
||||
#include "llvm/ADT/TinyPtrVector.h"
|
||||
#include "llvm/ADT/IntrusiveRefCntPtr.h"
|
||||
#include "llvm/Support/VersionTuple.h"
|
||||
#include <system_error>
|
||||
|
||||
@@ -36,10 +37,19 @@ class FileCollectorBase;
|
||||
namespace vfs {
|
||||
class OutputBackend;
|
||||
}
|
||||
namespace cas {
|
||||
class CachingOnDiskFileSystem;
|
||||
}
|
||||
}
|
||||
|
||||
namespace clang {
|
||||
class DependencyCollector;
|
||||
namespace tooling {
|
||||
namespace dependencies {
|
||||
struct ModuleID;
|
||||
class DependencyScanningTool;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace swift {
|
||||
@@ -51,6 +61,7 @@ class ClassDecl;
|
||||
class FileUnit;
|
||||
class ModuleDecl;
|
||||
class ModuleDependencyInfo;
|
||||
struct ModuleDependencyID;
|
||||
class ModuleDependenciesCache;
|
||||
class NominalTypeDecl;
|
||||
class SourceFile;
|
||||
@@ -327,8 +338,12 @@ public:
|
||||
|
||||
/// Retrieve the dependencies for the given, named module, or \c None
|
||||
/// if no such module exists.
|
||||
virtual llvm::Optional<const ModuleDependencyInfo *>
|
||||
getModuleDependencies(StringRef moduleName, ModuleDependenciesCache &cache,
|
||||
virtual llvm::SmallVector<std::pair<ModuleDependencyID, ModuleDependencyInfo>, 1>
|
||||
getModuleDependencies(StringRef moduleName,
|
||||
StringRef moduleOutputPath,
|
||||
llvm::IntrusiveRefCntPtr<llvm::cas::CachingOnDiskFileSystem> CacheFS,
|
||||
const llvm::DenseSet<clang::tooling::dependencies::ModuleID> &alreadySeenClangModules,
|
||||
clang::tooling::dependencies::DependencyScanningTool &clangScanningTool,
|
||||
InterfaceSubContextDelegate &delegate,
|
||||
bool isTestableImport = false) = 0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user