[Driver] A .swift file should be rebuilt if its mtime has changed.

...not if it's newer than its output .o file. This handles cases where the
object file is generated too quickly (rdar://problem/19404140) or when you
revert to a previous version of the file, mtime intact (rdar://problem/19720146).

There's a lot of test churn here; the only real new test is the backwards
mtime update in one-way.swift.

Swift SVN r29584
This commit is contained in:
Jordan Rose
2015-06-24 00:06:58 +00:00
parent 8e071b1148
commit 2b7b78d162
31 changed files with 531 additions and 404 deletions

View File

@@ -143,8 +143,8 @@ private:
/// which will be the Executable).
llvm::opt::ArgStringList Arguments;
/// An estimate of the latest possible time this job was previously run.
llvm::sys::TimeValue MaxPreviousBuildTime = llvm::sys::TimeValue::MinTime();
/// The modification time of the main input file, if any.
llvm::sys::TimeValue InputModTime = llvm::sys::TimeValue::MaxTime();
public:
Job(const Action &Source, const Tool &Creator,
@@ -170,18 +170,12 @@ public:
CreatorAndCondition.setInt(Cond);
}
/// Updates the estimated timestamp of the previous execution of this job.
///
/// \returns true if the new time value is later than the old time value.
bool updatePreviousBuildTime(llvm::sys::TimeValue NewTime) {
if (MaxPreviousBuildTime >= NewTime)
return false;
MaxPreviousBuildTime = NewTime;
return true;
void setInputModTime(llvm::sys::TimeValue time) {
InputModTime = time;
}
llvm::sys::TimeValue getPreviousBuildTime() const {
return MaxPreviousBuildTime;
llvm::sys::TimeValue getInputModTime() const {
return InputModTime;
}
/// Print the command line for this Job to the given \p stream,