summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/Serialization/ASTReader.h2
-rw-r--r--clang/lib/Frontend/FrontendActions.cpp11
-rw-r--r--clang/lib/Serialization/ASTReader.cpp6
-rw-r--r--clang/test/Modules/module_file_info.m1
4 files changed, 16 insertions, 4 deletions
diff --git a/clang/include/clang/Serialization/ASTReader.h b/clang/include/clang/Serialization/ASTReader.h
index 1efadc74352..98f8f5af486 100644
--- a/clang/include/clang/Serialization/ASTReader.h
+++ b/clang/include/clang/Serialization/ASTReader.h
@@ -232,7 +232,7 @@ public:
/// If needsImportVisitation returns \c true, this is called for each
/// AST file imported by this AST file.
- virtual void visitImport(StringRef Filename) {}
+ virtual void visitImport(StringRef ModuleName, StringRef Filename) {}
/// Indicates that a particular module file extension has been read.
virtual void readModuleFileExtension(
diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp
index 342081eba67..40008bf3cdd 100644
--- a/clang/lib/Frontend/FrontendActions.cpp
+++ b/clang/lib/Frontend/FrontendActions.cpp
@@ -601,6 +601,17 @@ namespace {
return true;
}
+
+ /// Returns true if this \c ASTReaderListener wants to receive the
+ /// imports of the AST file via \c visitImport, false otherwise.
+ bool needsImportVisitation() const override { return true; }
+
+ /// If needsImportVisitation returns \c true, this is called for each
+ /// AST file imported by this AST file.
+ void visitImport(StringRef ModuleName, StringRef Filename) override {
+ Out.indent(2) << "Imports module '" << ModuleName
+ << "': " << Filename.str() << "\n";
+ }
#undef DUMP_BOOLEAN
};
}
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index a9acf4e2f4f..b60e5f14a67 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -4868,11 +4868,11 @@ bool ASTReader::readASTFileControlBlock(
unsigned Idx = 0, N = Record.size();
while (Idx < N) {
// Read information about the AST file.
- Idx += 5; // ImportLoc, Size, ModTime, Signature
- SkipString(Record, Idx); // Module name; FIXME: pass to listener?
+ Idx += 1+1+1+1+5; // Kind, ImportLoc, Size, ModTime, Signature
+ std::string ModuleName = ReadString(Record, Idx);
std::string Filename = ReadString(Record, Idx);
ResolveImportedPath(Filename, ModuleDir);
- Listener.visitImport(Filename);
+ Listener.visitImport(ModuleName, Filename);
}
break;
}
diff --git a/clang/test/Modules/module_file_info.m b/clang/test/Modules/module_file_info.m
index 05d401b9450..64ed2be2d85 100644
--- a/clang/test/Modules/module_file_info.m
+++ b/clang/test/Modules/module_file_info.m
@@ -16,6 +16,7 @@
// CHECK: Module name: DependsOnModule
// CHECK: Module map file: {{.*}}DependsOnModule.framework{{[/\\]}}module.map
+// CHECK: Imports module 'Module': {{.*}}Module.pcm
// CHECK: Language options:
// CHECK: C99: Yes
OpenPOWER on IntegriCloud