[dsymutil] Compare object modification times using second precision
authorJonas Devlieghere <jonas@devlieghere.com>
Thu, 21 Jan 2021 02:38:56 +0000 (18:38 -0800)
committerJonas Devlieghere <jonas@devlieghere.com>
Thu, 21 Jan 2021 02:45:30 +0000 (18:45 -0800)
The modification time in the debug map is expressed using second
precision, while the modification time returned by the filesystem could
be more precise. Avoid spurious warnings about timestamp mismatches by
truncating the modification time reported by the system to seconds.

llvm/tools/dsymutil/BinaryHolder.cpp

index b401d51..f835213 100644 (file)
@@ -100,7 +100,8 @@ Error BinaryHolder::ObjectEntry::load(IntrusiveRefCntPtr<vfs::FileSystem> VFS,
     llvm::ErrorOr<vfs::Status> Stat = VFS->status(Filename);
     if (!Stat)
       return errorCodeToError(Stat.getError());
-    if (Timestamp != Stat->getLastModificationTime())
+    if (Timestamp != std::chrono::time_point_cast<std::chrono::seconds>(
+                         Stat->getLastModificationTime()))
       WithColor::warning() << Filename
                            << ": timestamp mismatch between object file ("
                            << Stat->getLastModificationTime()
@@ -192,7 +193,8 @@ BinaryHolder::ArchiveEntry::getObjectEntry(StringRef Filename,
             return ModTimeOrErr.takeError();
 
           if (Timestamp != sys::TimePoint<>() &&
-              Timestamp != ModTimeOrErr.get()) {
+              Timestamp != std::chrono::time_point_cast<std::chrono::seconds>(
+                               ModTimeOrErr.get())) {
             if (Verbose)
               WithColor::warning()
                   << *NameOrErr