Skip to content

Change interfaces to accept a FileCollectorBase #34442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/swift/AST/ModuleLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <system_error>

namespace llvm {
class FileCollector;
class FileCollectorBase;
}

namespace clang {
Expand Down Expand Up @@ -81,7 +81,7 @@ class DependencyTracker {
public:
explicit DependencyTracker(
IntermoduleDepTrackingMode Mode,
std::shared_ptr<llvm::FileCollector> FileCollector = {});
std::shared_ptr<llvm::FileCollectorBase> FileCollector = {});

/// Adds a file as a dependency.
///
Expand Down
8 changes: 4 additions & 4 deletions include/swift/ClangImporter/ClangImporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

namespace llvm {
class Triple;
class FileCollector;
class FileCollectorBase;
template<typename Fn> class function_ref;
}

Expand Down Expand Up @@ -172,9 +172,9 @@ class ClangImporter final : public ClangModuleLoader {

/// Create a new clang::DependencyCollector customized to
/// ClangImporter's specific uses.
static std::shared_ptr<clang::DependencyCollector>
createDependencyCollector(IntermoduleDepTrackingMode Mode,
std::shared_ptr<llvm::FileCollector> FileCollector);
static std::shared_ptr<clang::DependencyCollector> createDependencyCollector(
IntermoduleDepTrackingMode Mode,
std::shared_ptr<llvm::FileCollectorBase> FileCollector);

/// Append visible module names to \p names. Note that names are possibly
/// duplicated, and not guaranteed to be ordered in any way.
Expand Down
4 changes: 2 additions & 2 deletions lib/AST/ModuleLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
#include "swift/ClangImporter/ClangImporter.h"

namespace llvm {
class FileCollector;
class FileCollectorBase;
}

namespace swift {

DependencyTracker::DependencyTracker(
IntermoduleDepTrackingMode Mode,
std::shared_ptr<llvm::FileCollector> FileCollector)
std::shared_ptr<llvm::FileCollectorBase> 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
Expand Down
6 changes: 3 additions & 3 deletions lib/ClangImporter/ClangImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,13 @@ class ClangImporterDependencyCollector : public clang::DependencyCollector
llvm::StringSet<> ExcludedPaths;
/// The FileCollector is used by LLDB to generate reproducers. It's not used
/// by Swift to track dependencies.
std::shared_ptr<llvm::FileCollector> FileCollector;
std::shared_ptr<llvm::FileCollectorBase> FileCollector;
const IntermoduleDepTrackingMode Mode;

public:
ClangImporterDependencyCollector(
IntermoduleDepTrackingMode Mode,
std::shared_ptr<llvm::FileCollector> FileCollector)
std::shared_ptr<llvm::FileCollectorBase> FileCollector)
: FileCollector(FileCollector), Mode(Mode) {}

void excludePath(StringRef filename) {
Expand Down Expand Up @@ -378,7 +378,7 @@ class ClangImporterDependencyCollector : public clang::DependencyCollector
std::shared_ptr<clang::DependencyCollector>
ClangImporter::createDependencyCollector(
IntermoduleDepTrackingMode Mode,
std::shared_ptr<llvm::FileCollector> FileCollector) {
std::shared_ptr<llvm::FileCollectorBase> FileCollector) {
return std::make_shared<ClangImporterDependencyCollector>(Mode,
FileCollector);
}
Expand Down