forked from OSchip/llvm-project
[driver] Explicitly specify `-fbuild-session-timestamp` in seconds.
Representation of the file's last modification time depends on the file system and isn't guaranteed to be in seconds. Cast to seconds explicitly and tighten the test case to check the magnitude of the calculated value, so we can catch passing milliseconds or nanoseconds. rdar://83915615 Differential Revision: https://reviews.llvm.org/D111205
This commit is contained in:
parent
5e004b03f7
commit
91e19f66e5
|
@ -3573,10 +3573,10 @@ static void RenderModulesOptions(Compilation &C, const Driver &D,
|
|||
llvm::sys::fs::file_status Status;
|
||||
if (llvm::sys::fs::status(A->getValue(), Status))
|
||||
D.Diag(diag::err_drv_no_such_file) << A->getValue();
|
||||
CmdArgs.push_back(
|
||||
Args.MakeArgString("-fbuild-session-timestamp=" +
|
||||
Twine((uint64_t)Status.getLastModificationTime()
|
||||
.time_since_epoch()
|
||||
CmdArgs.push_back(Args.MakeArgString(
|
||||
"-fbuild-session-timestamp=" +
|
||||
Twine((uint64_t)std::chrono::duration_cast<std::chrono::seconds>(
|
||||
Status.getLastModificationTime().time_since_epoch())
|
||||
.count())));
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// RUN: %clang -fbuild-session-file=%t.build-session-file -### %s 2>&1 | FileCheck -check-prefix=TIMESTAMP_ONLY %s
|
||||
|
||||
// RUN: %clang -fbuild-session-timestamp=1280703457 -### %s 2>&1 | FileCheck -check-prefix=TIMESTAMP_ONLY %s
|
||||
// TIMESTAMP_ONLY: -fbuild-session-timestamp=128
|
||||
// TIMESTAMP_ONLY: -fbuild-session-timestamp=128{{([[:digit:]]{7})[^[:digit:]]}}
|
||||
|
||||
// RUN: %clang -fbuild-session-file=%t.build-session-file -fbuild-session-timestamp=123 -### %s 2>&1 | FileCheck -check-prefix=CONFLICT %s
|
||||
// CONFLICT: error: invalid argument '-fbuild-session-file={{.*}}.build-session-file' not allowed with '-fbuild-session-timestamp'
|
||||
|
@ -21,7 +21,7 @@
|
|||
// MODULES_VALIDATE_ONCE: -fmodules-validate-once-per-build-session
|
||||
|
||||
// RUN: %clang -fbuild-session-file=%t.build-session-file -fmodules-validate-once-per-build-session -### %s 2>&1 | FileCheck -check-prefix=MODULES_VALIDATE_ONCE_FILE %s
|
||||
// MODULES_VALIDATE_ONCE_FILE: -fbuild-session-timestamp=128
|
||||
// MODULES_VALIDATE_ONCE_FILE: -fbuild-session-timestamp=128{{([[:digit:]]{7})[^[:digit:]]}}
|
||||
// MODULES_VALIDATE_ONCE_FILE: -fmodules-validate-once-per-build-session
|
||||
|
||||
// RUN: %clang -fmodules-validate-once-per-build-session -### %s 2>&1 | FileCheck -check-prefix=MODULES_VALIDATE_ONCE_ERR %s
|
||||
|
|
Loading…
Reference in New Issue