Skip to content

Commit be5c66d

Browse files
authored
[clang] Improve module out of date error message (#128103)
When a pcm file has a different size or modification time than it had when it was written to another module's IMPORT table Clang emits: `<pcm> is out of date and needs to be rebuilt: module file out of date` This is difficult to understand what's happening because there are a lot of reasons that a module file can be out of date. This changes the latter part of that message to: `module file has a different size or mtime than expected` Which makes it clearer what the issue is. For future work it would be nice if a more detailed explanation of the issue could be emitted as a note instead.
1 parent 4ac43b5 commit be5c66d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

clang/lib/Serialization/ModuleManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ ModuleManager::addModule(StringRef FileName, ModuleKind Type,
119119
// Note: ExpectedSize and ExpectedModTime will be 0 for MK_ImplicitModule
120120
// when using an ASTFileSignature.
121121
if (lookupModuleFile(FileName, ExpectedSize, ExpectedModTime, Entry)) {
122-
ErrorStr = "module file out of date";
122+
ErrorStr = "module file has a different size or mtime than expected";
123123
return OutOfDate;
124124
}
125125

clang/test/Modules/explicit-build.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,6 @@
199199
// RUN: -fmodule-file=%t/c.pcm \
200200
// RUN: %s -DHAVE_A -DHAVE_B -DHAVE_C 2>&1 | FileCheck --check-prefix=CHECK-MISMATCHED-B %s
201201
//
202-
// CHECK-MISMATCHED-B: fatal error: module file '{{.*}}b.pcm' is out of date and needs to be rebuilt: module file out of date
202+
// CHECK-MISMATCHED-B: fatal error: module file '{{.*}}b.pcm' is out of date and needs to be rebuilt: module file has a different size or mtime than expected
203203
// CHECK-MISMATCHED-B-NEXT: note: imported by module 'c'
204204
// CHECK-MISMATCHED-B-NOT: note:

0 commit comments

Comments
 (0)