[llvm] r348283 - [dsymutil] Ensure we're comparing time stamps with the same precision.
Jonas Devlieghere via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 4 09:15:24 PST 2018
Author: jdevlieghere
Date: Tue Dec 4 09:15:23 2018
New Revision: 348283
URL: http://llvm.org/viewvc/llvm-project?rev=348283&view=rev
Log:
[dsymutil] Ensure we're comparing time stamps with the same precision.
After TimePoint's precision was increased in LLVM we started seeing
failures because the modification times didn't match. This adds a time
cast to ensure that we're comparing TimePoints with the same amount of
precision.
Modified:
llvm/trunk/tools/dsymutil/DwarfLinker.cpp
Modified: llvm/trunk/tools/dsymutil/DwarfLinker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DwarfLinker.cpp?rev=348283&r1=348282&r2=348283&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/DwarfLinker.cpp (original)
+++ llvm/trunk/tools/dsymutil/DwarfLinker.cpp Tue Dec 4 09:15:23 2018
@@ -2417,15 +2417,20 @@ bool DwarfLinker::link(const DebugMap &M
warn(Err.message());
continue;
}
- if (!Options.NoTimestamp &&
- Stat.getLastModificationTime() !=
- sys::TimePoint<>(LinkContext.DMO.getTimestamp())) {
- // Not using the helper here as we can easily stream TimePoint<>.
- WithColor::warning()
- << "Timestamp mismatch for " << File << ": "
- << Stat.getLastModificationTime() << " and "
- << sys::TimePoint<>(LinkContext.DMO.getTimestamp()) << "\n";
- continue;
+ if (!Options.NoTimestamp) {
+ // The modification can have sub-second precision so we need to cast
+ // away the extra precision that's not present in the debug map.
+ auto ModificationTime =
+ std::chrono::time_point_cast<std::chrono::seconds>(
+ Stat.getLastModificationTime());
+ if (ModificationTime != LinkContext.DMO.getTimestamp()) {
+ // Not using the helper here as we can easily stream TimePoint<>.
+ WithColor::warning()
+ << "Timestamp mismatch for " << File << ": "
+ << Stat.getLastModificationTime() << " and "
+ << sys::TimePoint<>(LinkContext.DMO.getTimestamp()) << "\n";
+ continue;
+ }
}
// Copy the module into the .swift_ast section.
More information about the llvm-commits
mailing list