-// Copyright (C) 2020-2023 Joel Rosdahl and other contributors
+// Copyright (C) 2020-2024 Joel Rosdahl and other contributors
//
// See doc/AUTHORS.adoc for a complete list of contributors.
//
Context::Context()
: actual_cwd(util::actual_cwd()),
apparent_cwd(util::apparent_cwd(actual_cwd)),
- storage(config)
+ storage(config),
#ifdef INODE_CACHE_SUPPORTED
- ,
- inode_cache(config)
+ inode_cache(config),
#endif
+ time_of_invocation(util::TimePoint::now())
{
- time_of_invocation = util::TimePoint::now();
}
void
-// Copyright (C) 2020-2023 Joel Rosdahl and other contributors
+// Copyright (C) 2020-2024 Joel Rosdahl and other contributors
//
// See doc/AUTHORS.adoc for a complete list of contributors.
//
// The original argument list.
Args orig_args;
- // Time of ccache invocation.
- util::TimePoint time_of_invocation;
-
- // Time of compilation. Used to see if include files have changed after
- // compilation.
- util::TimePoint time_of_compilation;
-
// Files included by the preprocessor and their hashes.
std::unordered_map<std::string, Hash::Digest> included_files;
mutable InodeCache inode_cache;
#endif
+ // Time of ccache invocation.
+ util::TimePoint time_of_invocation;
+
// PID of currently executing compiler that we have started, if any. 0 means
// no ongoing compilation.
pid_t compiler_pid = 0;
// starting compilation and writing the include file. See also the notes under
// "Performance" in doc/MANUAL.adoc.
if (!(ctx.config.sloppiness().contains(core::Sloppy::include_file_mtime))
- && dir_entry.mtime() >= ctx.time_of_compilation) {
+ && dir_entry.mtime() >= ctx.time_of_invocation) {
LOG("Include file {} too new", path);
return true;
}
// The same >= logic as above applies to the change time of the file.
if (!(ctx.config.sloppiness().contains(core::Sloppy::include_file_ctime))
- && dir_entry.ctime() >= ctx.time_of_compilation) {
+ && dir_entry.ctime() >= ctx.time_of_invocation) {
LOG("Include file {} ctime too new", path);
return true;
}
MTR_SCOPE("manifest", "manifest_put");
- // ctime() may be 0, so we have to check time_of_compilation against
+ // ctime() may be 0, so we have to check time_of_invocation against
// MAX(mtime, ctime).
//
// ccache only reads mtime/ctime if file_stat_matches sloppiness is enabled,
DirEntry de(path, DirEntry::LogOnError::yes);
bool cache_time =
save_timestamp
- && ctx.time_of_compilation > std::max(de.mtime(), de.ctime());
+ && ctx.time_of_invocation > std::max(de.mtime(), de.ctime());
return core::Manifest::FileStats{
de.size(),
de.is_regular_file() && cache_time ? de.mtime() : util::TimePoint(),
depend_mode_args.insert(1, depend_extra_args);
add_prefix(ctx, depend_mode_args, ctx.config.prefix_command());
- ctx.time_of_compilation = util::TimePoint::now();
result = do_execute(ctx, depend_mode_args);
}
MTR_END("execute", "compiler");
static tl::expected<Hash::Digest, Failure>
get_result_key_from_cpp(Context& ctx, Args& args, Hash& hash)
{
- ctx.time_of_compilation = util::TimePoint::now();
-
std::string preprocessed_path;
util::Bytes cpp_stderr_data;