Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions clang/include/clang/Basic/DiagnosticFrontendKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ def err_fe_expected_clang_command : Error<
"expected a clang compiler command">;
def err_fe_remap_missing_to_file : Error<
"could not remap file '%0' to the contents of file '%1'">, DefaultFatal;
def err_fe_unable_to_load_pch : Error<
"unable to load PCH file">;
def err_fe_unable_to_load_ast_file : Error<"unable to load precompiled file">;
def err_fe_unable_to_load_plugin : Error<
"unable to load plugin '%0': '%1'">;
def err_fe_unable_to_create_target : Error<
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Serialization/ASTReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ class ASTReaderListener {
/// \returns true to continue receiving the next input file, false to stop.
virtual bool visitInputFile(StringRef FilenameAsRequested, StringRef Filename,
bool isSystem, bool isOverridden,
bool isExplicitModule) {
time_t StoredTime, bool isExplicitModule) {
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Frontend/ASTUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromASTFile(
case ASTReader::VersionMismatch:
case ASTReader::ConfigurationMismatch:
case ASTReader::HadErrors:
AST->getDiagnostics().Report(diag::err_fe_unable_to_load_pch);
AST->getDiagnostics().Report(diag::err_fe_unable_to_load_ast_file);
return nullptr;
}

Expand Down
5 changes: 4 additions & 1 deletion clang/lib/Frontend/FrontendActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ namespace {
///
/// \returns true to continue receiving the next input file, false to stop.
bool visitInputFile(StringRef FilenameAsRequested, StringRef Filename,
bool isSystem, bool isOverridden,
bool isSystem, bool isOverridden, time_t StoredTime,
bool isExplicitModule) override {

Out.indent(2) << "Input file: " << FilenameAsRequested;
Expand All @@ -820,6 +820,9 @@ namespace {

Out << "\n";

if (StoredTime > 0)
Out.indent(4) << "MTime: " << llvm::itostr(StoredTime) << "\n";

return true;
}

Expand Down
3 changes: 2 additions & 1 deletion clang/lib/Serialization/ASTReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6015,6 +6015,7 @@ bool ASTReader::readASTFileControlBlock(
case INPUT_FILE_HASH:
break;
case INPUT_FILE:
time_t StoredTime = static_cast<time_t>(Record[2]);
bool Overridden = static_cast<bool>(Record[3]);
auto [UnresolvedFilenameAsRequested, UnresolvedFilename] =
getUnresolvedInputFilenames(Record, Blob);
Expand All @@ -6030,7 +6031,7 @@ bool ASTReader::readASTFileControlBlock(
}
shouldContinue = Listener.visitInputFile(
*FilenameAsRequestedBuf, Filename, isSystemFile, Overridden,
/*IsExplicitModule=*/false);
StoredTime, /*IsExplicitModule=*/false);
break;
}
if (!shouldContinue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class PrebuiltModuleListener : public ASTReaderListener {
/// stable directory. Traversal is stopped if the current module is not
/// considered stable.
bool visitInputFile(StringRef FilenameAsRequested, StringRef Filename,
bool isSystem, bool isOverridden,
bool isSystem, bool isOverridden, time_t StoredTime,
bool isExplicitModule) override {
if (StableDirs.empty())
return false;
Expand Down
23 changes: 23 additions & 0 deletions clang/test/Modules/module-file-info-mtime.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Check that mtime from a input file of a pcm is emitted, when it was built from an implicit module invocation.

// RUN: rm -fr %t
// RUN: split-file %s %t
// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/cache -fdisable-module-hash -fimplicit-module-maps %t/client.m -fsyntax-only -I%t/BuildDir
// RUN: %clang_cc1 -module-file-info %t/cache/A.pcm | FileCheck %s

// CHECK: Module name: A
// CHECK: Module map file: {{.*}}module.modulemap
// CHECK: Input file: {{.*}}A.h
// CHECK-NEXT: MTime: {{[0-9]+}}


//--- BuildDir/A/module.modulemap
module A [system] {
umbrella "."
}

//--- BuildDir/A/A.h
typedef int local_t;

//--- client.m
#import <A/A.h>
18 changes: 9 additions & 9 deletions clang/test/Modules/module_file_info.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@
// MACROS-NEXT: -DBLARG
// MACROS-NEXT: -DWIBBLE=WOBBLE
// CHECK: Input file: {{.*}}module.modulemap
// CHECK-NEXT: Input file: {{.*}}module.private.modulemap
// CHECK-NEXT: Input file: {{.*}}DependsOnModule.h
// CHECK-NEXT: Input file: {{.*}}module.modulemap
// CHECK-NEXT: Input file: {{.*}}other.h
// CHECK-NEXT: Input file: {{.*}}not_cxx.h
// CHECK-NEXT: Input file: {{.*}}not_coroutines.h
// CHECK-NEXT: Input file: {{.*}}SubFramework.h
// CHECK-NEXT: Input file: {{.*}}Other.h
// CHECK-NEXT: Input file: {{.*}}DependsOnModulePrivate.h
// CHECK: Input file: {{.*}}module.private.modulemap
// CHECK: Input file: {{.*}}DependsOnModule.h
// CHECK: Input file: {{.*}}module.modulemap
// CHECK: Input file: {{.*}}other.h
// CHECK: Input file: {{.*}}not_cxx.h
// CHECK: Input file: {{.*}}not_coroutines.h
// CHECK: Input file: {{.*}}SubFramework.h
// CHECK: Input file: {{.*}}Other.h
// CHECK: Input file: {{.*}}DependsOnModulePrivate.h

// CHECK: Diagnostic options:
// CHECK: IgnoreWarnings: Yes
Expand Down