[IDE][DocSupport] Fix DocInfo missing decls when generated for clang submodules.

Out handling of clang submodules was handled differently between DocInfo and
InterfaceGen. For InterfaceGen submodules were mapped back to their top-level
clang modules (or their Swift overlay if it had one) before being passed
into printSubmoduleInterface, along with the dot separated name of the submodule.

For DocInfo, they were not, and only the rightmost component of their name was
passed. The call to retrieve the decls from a ModuleDecl doesn't work if the
ModuleDecl wraps a clang submodule, so we were missing these decls.

InterfaceGen for submodules also shouldn't have been mapping the module back to
the overlay of top-level clang module, as that meant we ended up printing
import decls from the Swift overlay in the submodule's interface.

Resolves rdar://problem/57338105
This commit is contained in:
Nathan Hawes
2020-05-06 09:28:00 -07:00
parent 5239668b29
commit 34098a75f5
9 changed files with 545 additions and 236 deletions

View File

@@ -983,8 +983,9 @@ static bool getModuleInterfaceInfo(ASTContext &Ctx, StringRef ModuleName,
SmallString<128> Text;
llvm::raw_svector_ostream OS(Text);
AnnotatingPrinter Printer(OS);
printModuleInterface(M, None, TraversalOptions, Printer, Options,
true);
printModuleInterface(M, None, TraversalOptions, Printer, Options, true);
Info.Text = std::string(OS.str());
Info.TopEntities = std::move(Printer.TopEntities);
Info.References = std::move(Printer.References);