mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add basic reference tracking based on name lookups.
This tracks top-level qualified and unqualified lookups in the primary source file, meaning we see all top-level names used in the file. This is part of the intra-module dependency tracking work that can enable incremental rebuilds. This doesn't quite cover all of a file's dependencies. In particular, it misses cases involving extensions defined in terms of typealiases, and it doesn't yet track operator lookups. The whole scheme is also very dependent on being used to track file-level dependencies; if C is a subclass of B and B is a subclass of A, C doesn't appear to depend on A. It only works because changing A will mark B as dirty. Part of rdar://problem/15353101 Swift SVN r22925
This commit is contained in:
@@ -269,7 +269,9 @@ class CompilerInstance {
|
||||
DiagnosticEngine Diagnostics{SourceMgr};
|
||||
std::unique_ptr<ASTContext> Context;
|
||||
std::unique_ptr<SILModule> TheSILModule;
|
||||
|
||||
DependencyTracker *DepTracker = nullptr;
|
||||
ReferencedNameTracker *NameTracker = nullptr;
|
||||
|
||||
Module *MainModule = nullptr;
|
||||
SerializedModuleLoader *SML = nullptr;
|
||||
@@ -293,6 +295,7 @@ class CompilerInstance {
|
||||
SourceFile *PrimarySourceFile = nullptr;
|
||||
|
||||
void createSILModule();
|
||||
void setPrimarySourceFile(SourceFile *SF);
|
||||
|
||||
public:
|
||||
SourceManager &getSourceMgr() { return SourceMgr; }
|
||||
@@ -316,6 +319,14 @@ public:
|
||||
return DepTracker;
|
||||
}
|
||||
|
||||
void setReferencedNameTracker(ReferencedNameTracker *tracker) {
|
||||
assert(!PrimarySourceFile && "must be called before performSema()");
|
||||
NameTracker = tracker;
|
||||
}
|
||||
ReferencedNameTracker *getReferencedNameTracker() {
|
||||
return NameTracker;
|
||||
}
|
||||
|
||||
/// Set the SIL module for this compilation instance.
|
||||
///
|
||||
/// The CompilerInstance takes ownership of the given SILModule object.
|
||||
|
||||
@@ -97,6 +97,9 @@ public:
|
||||
/// The path to which we should output a Make-style dependencies file.
|
||||
std::string DependenciesFilePath;
|
||||
|
||||
/// The path to which we should output a Swift reference dependencies file.
|
||||
std::string ReferenceDependenciesFilePath;
|
||||
|
||||
/// Arguments which should be passed in immediate mode.
|
||||
std::vector<std::string> ImmediateArgv;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user