mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Dependency Scanning] Refactor Clang dependency bridging into a 'ModuleDependencyScanner' utility
This moves the functionality of 'bridgeClangModuleDependency' into a utility in the main scanner class because it relies on various objects whose lifetime is already tied to the scanner itself.
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
#include "swift/Basic/Assertions.h"
|
||||
#include "swift/Basic/CXXStdlibKind.h"
|
||||
#include "swift/Basic/LLVM.h"
|
||||
#include "swift/ClangImporter/ClangImporter.h"
|
||||
#include "swift/Serialization/Validation.h"
|
||||
#include "clang/CAS/CASOptions.h"
|
||||
#include "clang/Tooling/DependencyScanning/DependencyScanningService.h"
|
||||
@@ -176,18 +175,6 @@ void registerCxxInteropLibraries(
|
||||
const llvm::Triple &Target, StringRef mainModuleName, bool hasStaticCxx,
|
||||
bool hasStaticCxxStdlib, CXXStdlibKind cxxStdlibKind,
|
||||
std::function<void(const LinkLibrary &)> RegistrationCallback);
|
||||
|
||||
using RemapPathCallback = llvm::function_ref<std::string(StringRef)>;
|
||||
using LookupModuleOutputCallback =
|
||||
llvm::function_ref<std::string(const clang::tooling::dependencies::ModuleDeps &,
|
||||
clang::tooling::dependencies::ModuleOutputKind)>;
|
||||
|
||||
ModuleDependencyInfo
|
||||
bridgeClangModuleDependency(
|
||||
const ASTContext &ctx,
|
||||
const clang::tooling::dependencies::ModuleDeps &clangDependency,
|
||||
LookupModuleOutputCallback LookupModuleOutput,
|
||||
RemapPathCallback remapPath = nullptr);
|
||||
} // namespace dependencies
|
||||
|
||||
struct ScannerImportStatementInfo {
|
||||
@@ -1042,6 +1029,8 @@ using ModuleNameToDependencyMap = llvm::StringMap<ModuleDependencyInfo>;
|
||||
using ModuleDependenciesKindMap =
|
||||
std::unordered_map<ModuleDependencyKind, ModuleNameToDependencyMap,
|
||||
ModuleDependencyKindHash>;
|
||||
using BridgeClangDependencyCallback = llvm::function_ref<ModuleDependencyInfo(
|
||||
const clang::tooling::dependencies::ModuleDeps &clangModuleDep)>;
|
||||
|
||||
// MARK: SwiftDependencyScanningService
|
||||
/// A carrier of state shared among possibly multiple invocations of the
|
||||
@@ -1194,9 +1183,8 @@ public:
|
||||
/// Record dependencies for the given collection of Clang modules.
|
||||
void recordClangDependencies(
|
||||
const clang::tooling::dependencies::ModuleDepsGraph &dependencies,
|
||||
const ASTContext &ctx,
|
||||
dependencies::LookupModuleOutputCallback LookupModuleOutput,
|
||||
dependencies::RemapPathCallback remapPath = nullptr);
|
||||
DiagnosticEngine &diags,
|
||||
BridgeClangDependencyCallback bridgeClangModule);
|
||||
|
||||
/// Update stored dependencies for the given module.
|
||||
void updateDependency(ModuleDependencyID moduleID,
|
||||
|
||||
Reference in New Issue
Block a user