mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
ModuelPrinter: Add delineator to mark Decls from a different source file start.
This commit is contained in:
@@ -339,6 +339,8 @@ void swift::ide::printSubmoduleInterface(
|
||||
SwiftDecls.push_back(D);
|
||||
}
|
||||
}
|
||||
|
||||
llvm::SetVector<Decl*> PrintLineAfter;
|
||||
if (!GroupNames.empty()) {
|
||||
assert(SwiftDecls.empty());
|
||||
for (auto It = FileRangedDecls.begin(); It != FileRangedDecls.end(); ++ It) {
|
||||
@@ -354,8 +356,20 @@ void swift::ide::printSubmoduleInterface(
|
||||
for (auto D : DeclsInFile) {
|
||||
SwiftDecls.push_back(D);
|
||||
}
|
||||
PrintLineAfter.insert(DeclsInFile.back());
|
||||
}
|
||||
}
|
||||
if (!PrintLineAfter.empty())
|
||||
PrintLineAfter.pop_back();
|
||||
|
||||
llvm::SmallString<128> DelineatorBuilder;
|
||||
if (!PrintLineAfter.empty()) {
|
||||
DelineatorBuilder.append("// MARK: -\n");
|
||||
DelineatorBuilder.append("// ");
|
||||
DelineatorBuilder.append(77, '=');
|
||||
DelineatorBuilder.append(2, '\n');
|
||||
}
|
||||
StringRef DelineatorAfterFile = DelineatorBuilder.str();
|
||||
|
||||
// Create the missing import decls and add to the collector.
|
||||
for (auto *SM : NoImportSubModules) {
|
||||
@@ -514,6 +528,8 @@ void swift::ide::printSubmoduleInterface(
|
||||
for (auto *D : SwiftDecls) {
|
||||
if (PrintDecl(D))
|
||||
Printer << "\n";
|
||||
if (PrintLineAfter.count(D) != 0)
|
||||
Printer << DelineatorAfterFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user