diff options
Diffstat (limited to 'clang/lib/Basic/Module.cpp')
-rw-r--r-- | clang/lib/Basic/Module.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp index 2dd53b05d442..b6cf1624ef01 100644 --- a/clang/lib/Basic/Module.cpp +++ b/clang/lib/Basic/Module.cpp @@ -245,12 +245,10 @@ bool Module::fullModuleNameIs(ArrayRef<StringRef> nameParts) const { Module::DirectoryName Module::getUmbrellaDir() const { if (Header U = getUmbrellaHeader()) - return {"", U.Entry->getDir()}; + return {"", "", U.Entry->getDir()}; - if (auto *ME = Umbrella.dyn_cast<const DirectoryEntryRef::MapEntry *>()) - return {UmbrellaAsWritten, DirectoryEntryRef(*ME)}; - - return {"", None}; + return {UmbrellaAsWritten, UmbrellaRelativeToRootModuleDirectory, + Umbrella.dyn_cast<const DirectoryEntry *>()}; } void Module::addTopHeader(const FileEntry *File) { @@ -432,7 +430,7 @@ void Module::buildVisibleModulesCache() const { } } -void Module::print(raw_ostream &OS, unsigned Indent) const { +void Module::print(raw_ostream &OS, unsigned Indent, bool Dump) const { OS.indent(Indent); if (IsFramework) OS << "framework "; @@ -538,7 +536,7 @@ void Module::print(raw_ostream &OS, unsigned Indent) const { // the module. Regular inferred submodules are OK, as we need to look at all // those header files anyway. if (!(*MI)->IsInferred || (*MI)->IsFramework) - (*MI)->print(OS, Indent + 2); + (*MI)->print(OS, Indent + 2, Dump); for (unsigned I = 0, N = Exports.size(); I != N; ++I) { OS.indent(Indent + 2); @@ -562,6 +560,13 @@ void Module::print(raw_ostream &OS, unsigned Indent) const { OS << "\n"; } + if (Dump) { + for (Module *M : Imports) { + OS.indent(Indent + 2); + llvm::errs() << "import " << M->getFullModuleName() << "\n"; + } + } + for (unsigned I = 0, N = DirectUses.size(); I != N; ++I) { OS.indent(Indent + 2); OS << "use "; @@ -622,7 +627,7 @@ void Module::print(raw_ostream &OS, unsigned Indent) const { } LLVM_DUMP_METHOD void Module::dump() const { - print(llvm::errs()); + print(llvm::errs(), 0, true); } void VisibleModuleSet::setVisible(Module *M, SourceLocation Loc, |