diff --git a/include/swift/AST/ImportCache.h b/include/swift/AST/ImportCache.h index 5334b5ddddd36..665c98bcb6589 100644 --- a/include/swift/AST/ImportCache.h +++ b/include/swift/AST/ImportCache.h @@ -98,6 +98,8 @@ class ImportSet final : return {getTrailingObjects(), NumTopLevelImports + NumTransitiveImports}; } + + SWIFT_DEBUG_DUMP; }; class alignas(ImportedModule) ImportCache { diff --git a/lib/AST/ASTDumper.cpp b/lib/AST/ASTDumper.cpp index 6dd6fd036f012..47ccd014a6405 100644 --- a/lib/AST/ASTDumper.cpp +++ b/lib/AST/ASTDumper.cpp @@ -1320,9 +1320,11 @@ std::string ValueDecl::printRef() const { } void ValueDecl::dumpRef(raw_ostream &os) const { - // Print the context. - printContext(os, getDeclContext()); - os << "."; + if (!isa(this)) { + // Print the context. + printContext(os, getDeclContext()); + os << "."; + } // Print name. getName().printPretty(os); diff --git a/lib/AST/ImportCache.cpp b/lib/AST/ImportCache.cpp index e824d99111f4e..a43f575df7416 100644 --- a/lib/AST/ImportCache.cpp +++ b/lib/AST/ImportCache.cpp @@ -63,6 +63,24 @@ void ImportSet::Profile( } } +void ImportSet::dump() const { + llvm::errs() << "HasHeaderImportModule: " << HasHeaderImportModule << "\n"; + + llvm::errs() << "TopLevelImports:"; + for (auto import : getTopLevelImports()) { + llvm::errs() << "\n- "; + simple_display(llvm::errs(), import); + } + llvm::errs() << "\n"; + + llvm::errs() << "TransitiveImports:"; + for (auto import : getTransitiveImports()) { + llvm::errs() << "\n- "; + simple_display(llvm::errs(), import); + } + llvm::errs() << "\n"; +} + static void collectExports(ImportedModule next, SmallVectorImpl &stack) { SmallVector exports;