ASTPrinter: Add pre and post callbacks for printing synthesized extensions and call them.

This is necessary for jump to synthesized extensions in IDE.
This commit is contained in:
Xi Ge
2016-02-15 16:51:05 -08:00
parent d4ece4b4d0
commit d4f704bb2f
6 changed files with 72 additions and 20 deletions

View File

@@ -68,6 +68,15 @@ private:
void printModuleRef(ModuleEntity Mod, Identifier Name) override {
return OtherPrinter.printModuleRef(Mod, Name);
}
void printSynthesizedExtensionPre(const ExtensionDecl *ED,
const NominalTypeDecl *NTD) override {
return OtherPrinter.printSynthesizedExtensionPre(ED, NTD);
}
void printSynthesizedExtensionPost(const ExtensionDecl *ED,
const NominalTypeDecl *NTD) override {
return OtherPrinter.printSynthesizedExtensionPost(ED, NTD);
}
// Prints regular comments of the header the clang node comes from, until
// the location of the node. Keeps track of the comments that were printed
@@ -435,9 +444,6 @@ void swift::ide::printSubmoduleInterface(
if (!shouldPrint(ET, AdjustedOptions))
continue;
Printer << "\n";
Printer << "/// Synthesized extension from ";
ET->getExtendedTypeLoc().getType().print(Printer, AdjustedOptions);
Printer << "\n";
ET->print(Printer, AdjustedOptions);
Printer << "\n";
}