Fix a bug in the deserialization of IMPORTS section and allow for
imported modules to also be printed with -module-file-info.
rdar://problem/
43867753
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341902
91177308-0d34-0410-b5e6-
96231b3b80d8
/// 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(
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
};
}
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;
}
// CHECK: Module name: DependsOnModule
// CHECK: Module map file: {{.*}}DependsOnModule.framework{{[/\\]}}module.map
+// CHECK: Imports module 'Module': {{.*}}Module.pcm
// CHECK: Language options:
// CHECK: C99: Yes