[InterfacePrinting] Add a print option to specify whether members of a decl should be separated by empty new lines.

By doing so, SourceKit can print Swift intefaces in the same fashion of what Xcode conventionally does.
rdar://21710381

Swift SVN r30430
This commit is contained in:
Xi Ge
2015-07-21 01:22:44 +00:00
parent 5d3dc0d77b
commit af957bcad8
4 changed files with 9 additions and 14 deletions

View File

@@ -1390,15 +1390,11 @@ void SourceFile::print(ASTPrinter &Printer, const PrintOptions &PO) {
for (auto decl : Decls) {
if (!decl->shouldPrintInContext(PO))
continue;
if(decl->print(Printer, PO)) {
// For a major decl, we print an empty line before it.
if (MajorDeclKinds.find(decl->getKind()) != MajorDeclKinds.end())
Printer << "\n";
if(decl->print(Printer, PO))
Printer << "\n";
// For a major decl, we print an empty line after it.
if (MajorDeclKinds.find(decl->getKind()) != MajorDeclKinds.end()) {
Printer << "\n";
}
}
}
}