[dsymutil] Don't print timestamp warning if we have no timestamp

If we have no timestamp (0), don't print the corresponding warning. The
binary holder already successfully ignores these cases, but the warning
for swift interface files was lacking it.

rdar://86036385

Differential revision: https://reviews.llvm.org/D117333
This commit is contained in:
Jonas Devlieghere 2022-01-19 21:50:51 -08:00
parent 6f2ee1ca5e
commit 10ea731699
2 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,5 @@
RUN: dsymutil -oso-prepend-path %p/.. %p/../Inputs/swift-ast.macho.x86_64 -o %T/swift-ast.dSYM -verbose -no-swiftmodule-timestamp | FileCheck %s --check-prefix=DSYMUTIL
RUN: dsymutil -oso-prepend-path %p/.. %p/../Inputs/swift-ast.macho.x86_64 -o %T/swift-ast.dSYM -verbose | FileCheck %s --check-prefix=DSYMUTIL
RUN: llvm-readobj --sections --section-data %T/swift-ast.dSYM/Contents/Resources/DWARF/swift-ast.macho.x86_64 | FileCheck %s --check-prefix=READOBJ
RUN: llvm-dwarfdump --show-section-sizes %T/swift-ast.dSYM/Contents/Resources/DWARF/swift-ast.macho.x86_64 | FileCheck %s --check-prefix=DWARFDUMP
@ -11,6 +12,7 @@ Compiled with:
DSYMUTIL: filename:{{.*}}swift-ast.swiftmodule
DSYMUTIL-NOT: The file was not recognized as a valid object file
DSYMUTIL-NOT: timestamp mismatch
DSYMUTIL: DEBUG MAP OBJECT:{{.*}}swift-ast.swiftmodule
READOBJ: Name:{{.*}}__swift_ast
@ -19,8 +21,5 @@ READOBJ-NEXT: |.|
DWARFDUMP: __swift_ast
RUN: dsymutil -oso-prepend-path %p/.. %p/../Inputs/swift-ast.macho.x86_64 -no-output -verbose 2>&1 | FileCheck %s --check-prefix=TIMESTAMP
TIMESTAMP: warning: {{.*}}/swift-ast.swiftmodule: timestamp mismatch between swift interface file ({{.*}}) and debug map ({{.*}})
RUN: dsymutil -s %T/swift-ast.dSYM/Contents/Resources/DWARF/swift-ast.macho.x86_64 | FileCheck %s --check-prefix=NAST
NAST-NOT: N_AST

View File

@ -414,7 +414,8 @@ bool DwarfLinkerForBinary::link(const DebugMap &Map) {
auto ModificationTime =
std::chrono::time_point_cast<std::chrono::seconds>(
Stat.getLastModificationTime());
if (ModificationTime != Obj->getTimestamp()) {
if (Obj->getTimestamp() != sys::TimePoint<>() &&
ModificationTime != Obj->getTimestamp()) {
// Not using the helper here as we can easily stream TimePoint<>.
WithColor::warning()
<< File << ": timestamp mismatch between swift interface file ("