forked from OSchip/llvm-project
[FileSystem] Ignore nanoseconds when comparing oso_mod_time
After a recent change in LLVM the TimePoint encoding become more precise, exceeding the precision of the TimePoint obtained from the DebugMap. This patch adds a flag to the GetModificationTime helper in the FileSystem to return the modification time with less precision. Thanks to Davide for bisecting this failure on the LLDB bots. llvm-svn: 347615
This commit is contained in:
parent
9cc1ffadc5
commit
2765b067d2
|
@ -56,8 +56,12 @@ public:
|
||||||
|
|
||||||
/// Returns the modification time of the given file.
|
/// Returns the modification time of the given file.
|
||||||
/// @{
|
/// @{
|
||||||
llvm::sys::TimePoint<> GetModificationTime(const FileSpec &file_spec) const;
|
llvm::sys::TimePoint<>
|
||||||
llvm::sys::TimePoint<> GetModificationTime(const llvm::Twine &path) const;
|
GetModificationTime(const FileSpec &file_spec,
|
||||||
|
bool nanosecond_precision = true) const;
|
||||||
|
llvm::sys::TimePoint<>
|
||||||
|
GetModificationTime(const llvm::Twine &path,
|
||||||
|
bool nanosecond_precision = true) const;
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
/// Returns the on-disk size of the given file in bytes.
|
/// Returns the on-disk size of the given file in bytes.
|
||||||
|
|
|
@ -64,15 +64,22 @@ Optional<FileSystem> &FileSystem::InstanceImpl() {
|
||||||
}
|
}
|
||||||
|
|
||||||
sys::TimePoint<>
|
sys::TimePoint<>
|
||||||
FileSystem::GetModificationTime(const FileSpec &file_spec) const {
|
FileSystem::GetModificationTime(const FileSpec &file_spec,
|
||||||
return GetModificationTime(file_spec.GetPath());
|
bool nanosecond_precision) const {
|
||||||
|
return GetModificationTime(file_spec.GetPath(), nanosecond_precision);
|
||||||
}
|
}
|
||||||
|
|
||||||
sys::TimePoint<> FileSystem::GetModificationTime(const Twine &path) const {
|
sys::TimePoint<>
|
||||||
|
FileSystem::GetModificationTime(const Twine &path,
|
||||||
|
bool nanosecond_precision) const {
|
||||||
ErrorOr<vfs::Status> status = m_fs->status(path);
|
ErrorOr<vfs::Status> status = m_fs->status(path);
|
||||||
if (!status)
|
if (!status)
|
||||||
return sys::TimePoint<>();
|
return sys::TimePoint<>();
|
||||||
|
if (nanosecond_precision)
|
||||||
return status->getLastModificationTime();
|
return status->getLastModificationTime();
|
||||||
|
else
|
||||||
|
return std::chrono::time_point_cast<std::chrono::seconds>(
|
||||||
|
status->getLastModificationTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t FileSystem::GetByteSize(const FileSpec &file_spec) const {
|
uint64_t FileSystem::GetByteSize(const FileSpec &file_spec) const {
|
||||||
|
|
|
@ -420,7 +420,8 @@ Module *SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo(
|
||||||
FileSpec oso_file(oso_path);
|
FileSpec oso_file(oso_path);
|
||||||
ConstString oso_object;
|
ConstString oso_object;
|
||||||
if (FileSystem::Instance().Exists(oso_file)) {
|
if (FileSystem::Instance().Exists(oso_file)) {
|
||||||
auto oso_mod_time = FileSystem::Instance().GetModificationTime(oso_file);
|
auto oso_mod_time = FileSystem::Instance().GetModificationTime(
|
||||||
|
oso_file, /*nanosecond_precision=*/false);
|
||||||
if (oso_mod_time != comp_unit_info->oso_mod_time) {
|
if (oso_mod_time != comp_unit_info->oso_mod_time) {
|
||||||
obj_file->GetModule()->ReportError(
|
obj_file->GetModule()->ReportError(
|
||||||
"debug map object file '%s' has changed (actual time is "
|
"debug map object file '%s' has changed (actual time is "
|
||||||
|
|
Loading…
Reference in New Issue