mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add support for dependency file generation with -emit-dependencies.
This performs very conservative dependency generation for each compile task within a full compilation. Any source file, swiftmodule, or Objective-C header file that is /touched/ gets added to the dependencies list, which is written out on a per-input basis at the end of compilation. This does /not/ handle dependencies for the aggregated swiftmodule, swiftdoc, generated header, or linked binary. This is just the minimum needed to get Xcode to recognize what needs to be rebuilt when a header or Swift source file changes. We can revisit this later. This finishes <rdar://problem/14899639> for now. Swift SVN r18045
This commit is contained in:
@@ -20,7 +20,6 @@
|
||||
#include "swift/AST/Identifier.h"
|
||||
#include "swift/Basic/LLVM.h"
|
||||
#include "swift/Basic/SourceLoc.h"
|
||||
#include "llvm/ADT/IntrusiveRefCntPtr.h"
|
||||
|
||||
namespace swift {
|
||||
|
||||
@@ -29,10 +28,28 @@ class NominalTypeDecl;
|
||||
|
||||
enum class KnownProtocolKind : uint8_t;
|
||||
|
||||
class DependencyTracker {
|
||||
virtual void anchor();
|
||||
protected:
|
||||
DependencyTracker() = default;
|
||||
public:
|
||||
virtual ~DependencyTracker() = default;
|
||||
virtual void addDependency(StringRef file) {}
|
||||
};
|
||||
|
||||
/// \brief Abstract interface that loads named modules into the AST.
|
||||
class ModuleLoader {
|
||||
DependencyTracker * const dependencyTracker;
|
||||
virtual void anchor();
|
||||
|
||||
protected:
|
||||
ModuleLoader(DependencyTracker *tracker) : dependencyTracker(tracker) {}
|
||||
|
||||
void addDependency(StringRef file) {
|
||||
if (dependencyTracker)
|
||||
dependencyTracker->addDependency(file);
|
||||
}
|
||||
|
||||
public:
|
||||
virtual ~ModuleLoader() = default;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user