summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2014-08-01 22:12:21 +0000
committerBen Langmuir <blangmuir@apple.com>2014-08-01 22:12:21 +0000
commit19e6acbd51b45cf549387790fe8c51691cf30fc1 (patch)
tree8baf9973acd86941c9a6d0bd64d14b9d00b99441 /clang/lib
parentb1416837f97cd1ec212673fb90fab0fb7df6c442 (diff)
downloadbcm5719-llvm-19e6acbd51b45cf549387790fe8c51691cf30fc1.tar.gz
bcm5719-llvm-19e6acbd51b45cf549387790fe8c51691cf30fc1.zip
Add -fbuild-session-file as an alternative to -fbuild-session-timestamp
Build systems tend to traffic in files and modification times, so having them touch a file at the beginning of the build can be easier than having them update the compile command they use every time they build. llvm-svn: 214577
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Driver/Tools.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index b607f2f26d8..bcc80568d1c 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -3855,8 +3855,22 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
Args.AddLastArg(CmdArgs, options::OPT_fbuild_session_timestamp);
+ if (Arg *A = Args.getLastArg(options::OPT_fbuild_session_file)) {
+ if (Args.hasArg(options::OPT_fbuild_session_timestamp))
+ D.Diag(diag::err_drv_argument_not_allowed_with)
+ << A->getAsString(Args) << "-fbuild-session-timestamp";
+
+ llvm::sys::fs::file_status Status;
+ if (llvm::sys::fs::status(A->getValue(), Status))
+ D.Diag(diag::err_drv_no_such_file) << A->getValue();
+ auto Timestamp = Status.getLastModificationTime().toEpochTime();
+ CmdArgs.push_back(Args.MakeArgString("-fbuild-session-timestamp=" +
+ std::to_string(Timestamp)));
+ }
+
if (Args.getLastArg(options::OPT_fmodules_validate_once_per_build_session)) {
- if (!Args.getLastArg(options::OPT_fbuild_session_timestamp))
+ if (!Args.getLastArg(options::OPT_fbuild_session_timestamp,
+ options::OPT_fbuild_session_file))
D.Diag(diag::err_drv_modules_validate_once_requires_timestamp);
Args.AddLastArg(CmdArgs,
OpenPOWER on IntegriCloud