mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[SourceKit] Add decl.var.parameters entries to the fully annotated decl
This is the first part of adding parameter substructure so that clients can reason about more of the function declaration. rdar://problem/24292226
This commit is contained in:
@@ -637,19 +637,29 @@ void ClangCommentPrinter::avoidPrintDeclPost(const Decl *D) {
|
||||
}
|
||||
|
||||
void ClangCommentPrinter::printDeclPre(const Decl *D) {
|
||||
if (auto ClangN = D->getClangNode()) {
|
||||
printCommentsUntil(ClangN);
|
||||
if (shouldPrintNewLineBefore(ClangN)) {
|
||||
*this << "\n";
|
||||
printIndent();
|
||||
// Skip parameters, since we do not gracefully handle nested declarations on a
|
||||
// single line.
|
||||
// FIXME: we should fix that, since it also affects struct members, etc.
|
||||
if (!isa<ParamDecl>(D)) {
|
||||
if (auto ClangN = D->getClangNode()) {
|
||||
printCommentsUntil(ClangN);
|
||||
if (shouldPrintNewLineBefore(ClangN)) {
|
||||
*this << "\n";
|
||||
printIndent();
|
||||
}
|
||||
updateLastEntityLine(ClangN.getSourceRange().getBegin());
|
||||
}
|
||||
updateLastEntityLine(ClangN.getSourceRange().getBegin());
|
||||
}
|
||||
return OtherPrinter.printDeclPre(D);
|
||||
}
|
||||
|
||||
void ClangCommentPrinter::printDeclPost(const Decl *D) {
|
||||
OtherPrinter.printDeclPost(D);
|
||||
|
||||
// Skip parameters; see printDeclPre().
|
||||
if (isa<ParamDecl>(D))
|
||||
return;
|
||||
|
||||
for (auto CommentText : PendingComments) {
|
||||
*this << " " << ASTPrinter::sanitizeUtf8(CommentText);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user